ArrayWFrame#
- class ArrayWFrame(array: ArrayWUnits | ndarray | float, units_or_frame: Units | Frame, frame: Frame = None)#
Bases:
objectDefines a a value or values with associated units and reference frame.
Accepts two calling conventions:
ArrayWFrame(awu, frame)— wrap an existing ArrayWUnits in a frame.ArrayWFrame(array, units, frame)— wrap a raw array with units and frame.
- Parameters:
array (
ArrayWUnits) – Value or values with associated units to be defined in the given reference frame.units_or_frame (
UnitsorFrame) – Units or Frame objects to be linked with the object.frame (
Frame, optional) – Frame object to be linked with the ArrayWFrame. Defaults toNone.
See also
scarabaeus.Framedefine a Frame object that carry information about a SPICE-defined frame with origin and orientation
scarabaeus.Unitsdefine Units to be attached to numpy arrays
scarabaeus.ArrayWUnitsdefine an ArrayWUnits that carry information about numpy arrays and units linked to their content
Examples
Create an ArrayWFrame by assigning a Frame to an ArrayWUnits:
>>> import scarabaeus as scb >>> from pathlib import Path >>> mk_path = Path('path/to/example_mk.tm') >>> scb.SpiceManager.load_kernel_from_mkfile(str(mk_path)) # furnish metakernel >>> km = scb.Units.get_units('km') # define units >>> J2000 = scb.Frame('J2000') # define reference frame >>> pos_vec = scb.ArrayWUnits([1, 2, 3], km) # define position >>> pos_J2000 = scb.ArrayWFrame(pos_vec, J2000) # define position in J2000
- Attributes:
Methods
T()Same as self.transpose()
append(other[, axis])Append another ArrayWFrame to this one along the given axis.
convert_to(frame_target[, epoch])Convert an entire AWF from its current frame to a target frame at given epochs.
cos()Trigonometric cosine operator for ArrayWFrame objects.
cross(other)Cross product operation between two ArrayWFrame objects.
exp()Exponential operator for ArrayWFrame objects.
exp2()Exponential base 2 operator for ArrayWFrame objects.
inverse()Inverse operator for ArrayWFrame objects.
log()Natural log operator for ArrayWFrame objects.
log10()Log base 10 operator for ArrayWFrame objects.
log2()Log base 2 operator for ArrayWFrame objects.
norm()Matrix or vector norm operator for ArrayWFrame objects.
Pseudo-inverse operator for ArrayWFrame objects.
sin()Trigonometric sine operator for ArrayWFrame objects.
Sum all elements in the ArrayWFrame object, if units allow.
tan()Trigonometric tangent operator for ArrayWFrame objects.
Transpose operator for ArrayWFrame objects.
unitary()Converts a given ArrayWFrame vector into a unit vector with the same units.
- append(other: Self, axis: int = None) Self#
Append another ArrayWFrame to this one along the given axis.
- Parameters:
other (
ArrayWFrame) – The ArrayWFrame to append. Must share the same reference frame.axis (
int, optional) – Axis along which to append. Passed directly toArrayWUnits.append(). Defaults toNone(flatten).
- Returns:
out – A new ArrayWFrame containing the concatenated values in the same frame.
- Return type:
- convert_to(frame_target: Frame, epoch: EpochArray = None) None#
Convert an entire AWF from its current frame to a target frame at given epochs.
- Parameters:
frame_target (
Frame) – The target frame to convert to.epoch (
EpochArray, optional) – Given an array of ET at which the transformations hold. Required if the AWF has time-dependent data.
- Raises:
ValueError – If the transformation requirements are not met (shape mismatch, incompatible frames, etc.).
- unitary() Self#
Converts a given ArrayWFrame vector into a unit vector with the same units.
Only valid for vectorial ArrayWFrame.
- property quantity: ArrayWUnits#
The quantity or quantities linked to the Frame.