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:
- arrayArrayWUnits
Value or values with associated units to be defined in the given reference frame.
- units_or_frameUnits or Frame
Units or Frame objects to be linked with the object.
- frameFrame, optional
Frame object to be linked with the ArrayWFrame. Defaults to
None.
- 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.
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
- append(other: Self, axis: int = None) Self#
Append another ArrayWFrame to this one along the given axis.
- Parameters:
- otherArrayWFrame
The ArrayWFrame to append. Must share the same reference frame.
- axisint, optional
Axis along which to append. Passed directly to
ArrayWUnits.append(). Defaults toNone(flatten).
- Returns:
- outArrayWFrame
A new ArrayWFrame containing the concatenated values in the same frame.
- 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_targetFrame
The target frame to convert to.
- epochEpochArray, 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.).
- norm() ArrayWUnits#
Matrix or vector norm operator for ArrayWFrame objects.
Returns an
ArrayWUnits, not anArrayWFrame: a norm is a magnitude with no direction, so there is no frame for it to be expressed in. Rotating the input leaves it unchanged, which is precisely what makes a frame label meaningless here — unlikeunitary()ortranspose(), whose results do live in the frame and so keep it.
- 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.