Quantity Ranges
- class nettlesome.quantities.QuantityRange(**data)
Base class for ranges that can be assigned to Predicates.
- __hash__ = None
- consistent_dimensionality(other)
Test if
other
has a quantity parameter consistent withself
.- Return type
- expression_comparison()
Convert text to a comparison with a quantity.
- property interval: Union[sympy.sets.sets.FiniteSet, sympy.sets.sets.Interval, sympy.sets.sets.Union]
Get the range that the Comparison may refer to.
- property lower_bound
Get lower bound of the range that the Comparison may refer to.
- abstract property magnitude: Union[decimal.Decimal, int, float]
Get amount of max or minimum of the quantity range, without a unit.
- reverse_meaning()
Change self.sign in place to reverse the range of numbers covered.
>>> quantity_range = UnitRange(quantity="100 meters", sign=">") >>> str(quantity_range) 'greater than 100 meter' >>> quantity_range.reverse_meaning() >>> quantity_range.sign '<=' >>> str(quantity_range) 'no more than 100 meter'
- Return type
- class nettlesome.quantities.UnitRange(**data)
A range defined relative to a pint Quantity.
- __hash__ = None
- consistent_dimensionality(other)
Compare dimensionality of Quantities for
self
andother
.For instance, two units representing distance divided by time have the same dimensionality, even if one uses feet while the other uses meters.
- Parameters
other (
QuantityRange
) – another QuantityRange with a quantity to compare- Return type
- Returns
whether the two dimensionalities are the same
- property domain: sympy.sets.sets.Set
Get the domain of the quantity range.
- Return type
- get_unit_converted_interval(other)
Get
other
’s interval if it was denominated inself
’s units.
- implies(other)
Check if
self
’s quantity range is a subset ofother
’s.
- property pint_quantity: pint.quantity.Quantity
Get the Quantity as a Pint object.
- Return type
- class nettlesome.quantities.IntRange(**data)
A range defined relative to an integer or float.
- __hash__ = None
- property domain: sympy.sets.sets.Set
Set domain as natural numbers.
- Return type
- class nettlesome.quantities.DecimalRange(**data)
A range defined relative to an integer or float.
- __hash__ = None
- property domain: sympy.sets.sets.Set
Set domain as natural numbers.
- Return type
- property magnitude: decimal.Decimal
Return quantity attribute.
- Return type
- class nettlesome.quantities.DateRange(**data)
A range defined relative to a date.
- __hash__ = None
- property domain: sympy.sets.sets.Set
Set domain as natural numbers.
- Return type