QuantityAttribute¶
- class astropy.coordinates.QuantityAttribute(default=None, secondary_attribute='', unit=None, shape=None)[source]¶
Bases:
Attribute
A frame attribute that is a quantity with specified units and shape (optionally).
Can be
None
, which should be used for special cases in associated frame transformations like “this quantity should be ignored” or similar.- Parameters:
- defaultnumber or
Quantity
orpython:None
, optional Default value for the attribute if the user does not supply one. If a Quantity, it must be consistent with
unit
, or if a value,unit
cannot be None.- secondary_attribute
python:str
, optional Name of a secondary instance attribute which supplies the value if
default is None
and no value was supplied during initialization.- unitastropy:unit-like or
python:None
, optional Name of a unit that the input will be converted into. If None, no unit-checking or conversion is performed
- shape
python:tuple
orpython:None
, optional If given, specifies the shape the attribute must be
- defaultnumber or
Methods Summary
convert_input
(value)Checks that the input is a Quantity with the necessary units (or the special value
0
).Methods Documentation
- convert_input(value)[source]¶
Checks that the input is a Quantity with the necessary units (or the special value
0
).- Parameters:
- value
object
Input value to be converted.
- value
- Returns:
- out, convertedcorrectly-typed
object
, bool Tuple consisting of the correctly-typed object and a boolean which indicates if conversion was actually performed.
- out, convertedcorrectly-typed
- Raises:
ValueError
If the input is not valid for this attribute.