opihiexarata.propagate.polynomial module

For polynomial fitting propagation, using approximations of 1st or 2nd order terms but ignoring some spherical effects.

Although this could be easily implemented in a better method using subclassing rather than having two classes, as having a 3rd order is not really feasible, and for the sake of readability and stability, two separate copy-like classes are written.

class opihiexarata.propagate.polynomial.LinearPropagationEngine(ra: ndarray, dec: ndarray, obs_time: ndarray)[source]

Bases: PropagationEngine

A simple propagation engine which uses 1st order extrapolation of RA DEC points independently to determine future location.

ra_array

The array of right ascension measurements to extrapolate to.

Type:

ndarray

dec_array

The array of declinations measurements to extrapolate to.

Type:

ndarray

obs_time_array

The array of observation times which the RA and DEC measurements were taken at. The values are in Julian days.

Type:

ndarray

ra_poly_param

The polynomial fit parameters for the RA(time) propagation.

Type:

tuple

dec_poly_param

The polynomial fit parameters for the DEC(time) propagation.

Type:

tuple

ra_wrap_around

A flag which signifies that the RA values, as given, wraps around the 0/360 point.

Type:

boolean

__fit_polynomial_function(fit_x: ndarray, fit_y: ndarray) tuple[tuple, tuple]

A wrapper class for fitting the defined specific polynomial function.

Parameters:
  • fix_x (array-like) – The x values which shall be fit.

  • fix_y (array-like) – The y values which shall be fit.

Returns:

  • fit_param (tuple) – The parameters of the polynomial that corresponded to the best fit. Determined by the order of the polynomial function.

  • fit_error (tuple) – The error on the parameters of the fit.

__init__(ra: ndarray, dec: ndarray, obs_time: ndarray) None[source]

Instantiation of the propagation engine.

Parameters:
  • ra (array-like) – An array of right ascensions to fit and extrapolate to, must be in degrees.

  • dec (array-like) – An array of declinations to fit and extrapolate to, must be in degrees.

  • obs_time (array-like) – An array of observation times which the RA and DEC measurements were taken at. This should be in Julian days.

Return type:

None

__linear_function(c0: float, c1: float) ndarray

The linear polynomial function that will be used.

This function is hard coded to be a specific order on purpose. The order may be changed between versions if need be, but should not be changed via configuration.

Parameters:
  • x (array-like) – The input for computing the polynomial.

  • c0 (float) – Coefficient for order 0.

  • c1 (float) – Coefficient for order 1.

Returns:

y – The output after computing the polynomial with the provided coefficients.

Return type:

array-like

_right_ascension_inverse_rotation(rotated_ra: ndarray) ndarray[source]

This function inverses the rotation done because of the transformation to avoid the wraparound in the 0/360 region if it exists.

If there was no wraparound present, then this function just passes the input untouched.

Parameters:

rotation_ra (array-like) – The RA array, after the rotation has been done by the rotation function.

Returns:

inverse_rotated_ra – The array after the inverse rotation, if a wraparound is present.

Return type:

array

_right_ascension_rotation(ra: ndarray) ndarray[source]

If the RA loops around the 0/360 region, this function transforms it via a rotation to +/- 180 so that the polynomial fitting is not problematic.

If there was no wraparound present, then this function just passes the input untouched.

Parameters:

ra (array-like) – The RA without the rotation where there is a possible wraparound.

Returns:

rotated_ra – The array after the rotation, if a wraparound is present.

Return type:

array

forward_propagate(future_time: ndarray) tuple[ndarray, ndarray][source]

Determine a new location(s) based on the polynomial propagation, providing new times to locate in the future.

Parameters:

future_time (array-like) – The set of future times which to derive new RA and DEC coordinates. The time must be in Julian days.

Returns:

  • future_ra (ndarray) – The set of right ascensions that corresponds to the future times, in degrees.

  • future_dec (ndarray) – The set of declinations that corresponds to the future times, in degrees.

class opihiexarata.propagate.polynomial.QuadraticPropagationEngine(ra: ndarray, dec: ndarray, obs_time: ndarray)[source]

Bases: PropagationEngine

A simple propagation engine which uses 2nd order extrapolation of RA DEC points independently to determine future location.

ra_array

The array of right ascension measurements to extrapolate to.

Type:

ndarray

dec_array

The array of declinations measurements to extrapolate to.

Type:

ndarray

obs_time_array

The array of observation times which the RA and DEC measurements were taken at. The values are in Julian days.

Type:

ndarray

ra_poly_param

The polynomial fit parameters for the RA(time) propagation.

Type:

tuple

dec_poly_param

The polynomial fit parameters for the DEC(time) propagation.

Type:

tuple

__fit_polynomial_function(fit_x: ndarray, fit_y: ndarray) tuple[tuple, tuple]

A wrapper class for fitting the defined specific polynomial function.

Parameters:
  • fix_x (array-like) – The x values which shall be fit.

  • fix_y (array-like) – The y values which shall be fit.

Returns:

  • fit_param (tuple) – The parameters of the polynomial that corresponded to the best fit. Determined by the order of the polynomial function.

  • fit_error (tuple) – The error on the parameters of the fit.

__init__(ra: ndarray, dec: ndarray, obs_time: ndarray) None[source]

Instantiation of the propagation engine.

Parameters:
  • ra (array-like) – An array of right ascensions to fit and extrapolate to, must be in degrees.

  • dec (array-like) – An array of declinations to fit and extrapolate to, must be in degrees.

  • obs_time (array-like) – An array of observation times which the RA and DEC measurements were taken at. This should be in Julian days.

Return type:

None

__quadratic_function(c0: float, c1: float, c2: float) ndarray

The polynomial function that will be used.

This function is hard coded to be a specific order on purpose. The order may be changed between versions if need be, but should not be changed via configuration.

Parameters:
  • x (array-like) – The input for computing the polynomial.

  • c0 (float) – Coefficient for order 0.

  • c1 (float) – Coefficient for order 1.

  • c2 (float) – Coefficient for order 2.

Returns:

y – The output after computing the polynomial with the provided coefficients.

Return type:

array-like

_right_ascension_inverse_rotation(rotated_ra: ndarray) ndarray[source]

This function inverses the rotation done because of the transformation to avoid the wraparound in the 0/360 region if it exists.

If there was no wraparound present, then this function just passes the input untouched.

Parameters:

rotation_ra (array-like) – The RA array, after the rotation has been done by the rotation function.

Returns:

inverse_rotated_ra – The array after the inverse rotation, if a wraparound is present.

Return type:

array

_right_ascension_rotation(ra: ndarray) ndarray[source]

If the RA loops around the 0/360 region, this function transforms it via a rotation to +/- 180 so that the polynomial fitting is not problematic.

If there was no wraparound present, then this function just passes the input untouched.

Parameters:

ra (array-like) – The RA without the rotation where there is a possible wraparound.

Returns:

rotated_ra – The array after the rotation, if a wraparound is present.

Return type:

array

forward_propagate(future_time: ndarray) tuple[ndarray, ndarray][source]

Determine a new location(s) based on the polynomial propagation, providing new times to locate in the future.

Parameters:

future_time (array-like) – The set of future times which to derive new RA and DEC coordinates. The time must be in Julian days.

Returns:

  • future_ra (ndarray) – The set of right ascensions that corresponds to the future times, in degrees.

  • future_dec (ndarray) – The set of declinations that corresponds to the future times, in degrees.