Specification
- class Specification
Description
Structure containing dimensions of a unit or quantity.
Note that multiple quantities and units may have the same dimensions, yet be treated as different types. This provides the distinction, e.g.
widthis notheight.Format specification is: -
:n- print specification name, if it has one -:e- print specification expression, if it has one -:d- print specification dimensionsBy default, each mode will be tested in order until one succeeds.
Warning
Unnamed quantities are not fully supported yet.
Inheritance:
Members defined in
Specification(13 members)RExact exponents of each nonzero dimension.
RThe expression use to derive this quantity specification.
RWhether this specification is the root of its hierarchy, i.e. a named specification without a parent.
RThe root specification this is part of.
RName given to this quantity specification, e.g.
length,width.RThe expression owned by this specification.
RThe immediate parent specification if this is a child specification.
Try and find a specification common to both left and right.
Whether
othercan be assigned to a quantity specified by this.A dimensionless quantity specification.
Find or create a base quantity specification with a single dimension.
Attributes
- property dimensions: syside.BufferView[tuple[syside.experimental.units.BaseDimension, fractions.Fraction]]
Exact exponents of each nonzero dimension.
- property expression: syside.BufferView[tuple[syside.experimental.units.Specification, fractions.Fraction]]
The expression use to derive this quantity specification.
- property is_base: bool
Whether this specification is the root of its hierarchy, i.e. a named specification without a parent.
- property kind: syside.experimental.units.Kind
The root specification this is part of.
- property name: str | None
Name given to this quantity specification, e.g.
length,width.None if this was derived from an expression.
- property owned_expression: syside.BufferView[tuple[syside.experimental.units.Specification, fractions.Fraction]]
The expression owned by this specification.
May be empty if one is inherited, and not overridden.
- property parent: syside.experimental.units.Specification | None
The immediate parent specification if this is a child specification.
Methods
- common_with(arg: syside.experimental.units.Specification, /) syside.experimental.units.Specification | None
Try and find a specification common to both left and right.
If kinds are different, none is returned.
- common_with(arg: syside.experimental.units.Kind, /) syside.experimental.units.Specification | None
Try to find a specification common with other.
If kinds are different, none is returned, otherwise this, i.e. common type is promoted from kind, rather than demoted to a common kind.
- convertible_from(arg: syside.experimental.units.Specification, /) syside.experimental.units.Convertible
- convertible_from(arg: syside.experimental.units.Kind, /) syside.experimental.units.Convertible
Whether
othercan be assigned to a quantity specified by this.
- static dimensionless() syside.experimental.units.Specification
A dimensionless quantity specification.
- static find_or_create(name: str, dimension: syside.experimental.units.BaseDimension) syside.experimental.units.Specification
Find or create a base quantity specification with a single dimension.
Note that these specifications can never be non-negative, and are always real scalar.
- static find_or_create(name: str, expression: Sequence[tuple[syside.experimental.units.Specification, fractions.Fraction | int]], is_kind: bool = False) syside.experimental.units.Specification
Find or create a derived quantity with an
expression.The given
expressionmay be sorted and deduplicated before searching. Duplicate entries may be discarded.
- static find_or_create(name: str, parent: syside.experimental.units.Specification, expression: Sequence[tuple[syside.experimental.units.Specification, fractions.Fraction | int]], is_kind: bool = False) syside.experimental.units.Specification
Find or create a direct child quantity with a custom
expression.The given
expressionmay be sorted and deduplicated before searching. Duplicate entries may be discarded.
- static find_or_create(name: str, parent: syside.experimental.units.Specification, is_kind: bool = False) syside.experimental.units.Specification
Find or create a direct child quantity.