heyoka.model.sgp4_propagator_flt#
- class heyoka.model.sgp4_propagator_flt#
SGP4 propagator (single precision).
Added in version 5.1.0.
Note
A tutorial explaining the use of this class is available.
Methods
__call__
(self, times[, out])Propagation.
__init__
(self, sat_list[, diff_order])Constructor.
get_dslice
(self, order[, component])Fetch a slice of derivatives.
get_mindex
(self, i)Fetch a differentiation multiindex.
replace_sat_data
(self, sat_list)Replace the GPE data.
Attributes
The list of differentiation arguments.
The differentiation order.
Data type representing Julian dates with a fractional component.
The total number of outputs, including the derivatives.
The total number of satellites.
The GPE data.
- __call__(self, times: numpy.ndarray, out: numpy.ndarray[numpy.single] | None = None) numpy.ndarray[numpy.single] #
Propagation.
The call operator will propagate the states of all the satellites (and, if requested, their derivatives) up to the specified times.
The times array can contain either floating-point values (of type
numpy.single
), or Julian dates (represented via thejdtype
type). In the former case, the input times will be interpreted as minutes elapsed since the GPE reference epochs (which in general differ from satellite to satellite). In the latter case, the states will be propagated up to the specified Julian dates, which must be provided in the UTC scale of time.times can be either a one-dimensional array, or a two-dimensional one. In the former case (scalar propagation), its length must be exactly
nsats
(i.e., one time/date per satellite). In the latter case (batch-mode propagation), the number of columns must be exactlynsats
, while the number of rows represents how many propagations per satellite will be performed.The return value is either a two-dimensional (scalar propagation) or three-dimensional (batch-mode propagation) array. In the former case, the number of rows will be equal to
nouts
, while the number of columns will be equal tonsats
. In the latter case, the first dimension will be equal to the number of propagations performed per satellite, the second dimension will be equal tonouts
, and the third dimension will be equal tonsats
.If an out array with the correct data type and shape is provided, it will be used as the return value. Otherwise, a new array will be returned.
All input arguments must be C-style contiguous arrays, with no memory overlap between times and out.
- Parameters:
times – the propagation times/dates.
out – the output array.
- Returns:
the result of the propagation.
- Raises:
ValueError – if an invalid input array is detected, as explained above.
- __init__(self, sat_list: list | numpy.ndarray[numpy.single], diff_order: int = 0, **kwargs)#
Constructor.
Added in version 7.0.0: This function now also accepts sat_list as a NumPy array.
Note
As an alternative to this constructor, consider using the factory function
sgp4_propagator()
.The constructor will initialise the propagator from sat_list, which must be either a list of general perturbations element sets (GPEs) represented as
Satrec
objects from the sgp4 Python module, or a 2D array.In the former case, the GPE data is taken directly from the
Satrec
objects. In the latter case, sat_list is expected to be a 9 xn
C-style contiguous array, wheren
is the total number of satellites and the rows contain the following GPE data:the mean motion (in [rad / min]),
the eccentricity,
the inclination (in [rad]),
the right ascension of the ascending node (in [rad]),
the argument of perigee (in [rad]),
the mean anomaly (in [rad]),
the BSTAR drag term (in the same unit as given in the GPE),
the reference epoch (as a Julian date),
a fractional correction to the epoch (in Julian days).
Epochs must be provided in the UTC scale of time, following the convention that days in which leap seconds are added/removed are 1 second longer/shorter than one SI day.
The diff_order argument indicates the desired differentiation order. If equal to 0, then derivatives are disabled.
kwargs can optionally contain keyword arguments from the LLVM kwargs set and the cfunc kwargs set.
- Parameters:
sat_list – the GPE data.
diff_order – the derivatives order.
- Raises:
ImportError – if sat_list is a list and the sgp4 Python module is not available.
TypeError – if sat_list is a list and one or more of its elements is not a
Satrec
object.ValueError – if sat_list is an invalid array, as explained above.
- property diff_args#
The list of differentiation arguments.
Note
This property is available only if derivatives were requested on construction.
- Return type:
- get_dslice(self, order: int, component: int | None = None) slice #
Fetch a slice of derivatives.
Note
This method is available only if derivatives were requested on construction.
This method will return a slice representing the range of indices containing the derivatives of order order in the result of a propagation. If component is
None
, then the output range encompasses the derivatives of all the propagated quantities. Otherwise, the output range includes only the derivatives of the component-th propagated quantity.- Parameters:
order – the differentiation order.
component – the component to consider.
- Returns:
a range of indices into the output of a propagation containing the requested derivatives.
- get_mindex(self, i: int) list[int] #
Fetch a differentiation multiindex.
Note
This method is available only if derivatives were requested on construction.
This method will return the differentiation multiindex corresponding to the i-th row of the propagation output of a differentiable SGP4 propagator.
The multiindex begins with the component index (that is, the index of the output quantity whose derivatives have been computed). The remaining indices are the differentiation orders with respect to the quantities listed in
diff_args
.For instance, if the return value is
[2, 0, 1, 0, 0, 0, 0, 0]
, the multiindex refers to the first-order derivative of the output quantity at index 2 (i.e., the Cartesian \(z\) coordinate) with respect to the second differentiation argument.- Parameters:
i – the input index.
- Returns:
a differentiation multiindex.
- property jdtype#
Data type representing Julian dates with a fractional component.
This is a structured NumPy datatype consisting of two fields of type
numpy.single
, the first one calledjd
and representing a Julian date, the second one calledfrac
representing a fractional correction tojd
(so that the full Julian date isjd + frac
).- Return type:
- replace_sat_data(self, sat_list: list | numpy.ndarray[numpy.single]) None #
Replace the GPE data.
Added in version 7.0.0: This function now also accepts sat_list as a NumPy array.
This method will replace the GPE data in the propagator with the data from sat_list. sat_list must be either a list of GPEs represented as
Satrec
objects from the sgp4 Python module, or a 2D NumPy array. See the documentation of theconstructor
for more information on sat_list.The number of satellites in sat_list must be equal to the number of satellites in the propagator - that is, it is not possible to change the total number of satellites in the propagator via this method.
- Parameters:
sat_list – the new GPE data.
- Raises:
TypeError – if sat_list is a list and one or more of its elements is not a
Satrec
object.ValueError – if sat_list is an invalid array or if the number of satellites in sat_list differs from the number of satellites in the propagator.
- property sat_data#
The GPE data.
A 9 x
nsats
array containing the general perturbations element sets (GPEs) of each satellite.The rows contain the following quantities:
the mean motion (in [rad / min]),
the eccentricity,
the inclination (in [rad]),
the right ascension of the ascending node (in [rad]),
the argument of perigee (in [rad]),
the mean anomaly (in [rad]),
the BSTAR drag term (in the same unit as given in the GPE),
the reference epoch (as a Julian date),
a fractional correction to the epoch (in Julian days).
- Return type: