pyRTX.core.analysis_utils

Functions

computeRADEC(vecs[, periodicity])

From a ND array of shape (N, 3), compute RA/DEC

compute_body_positions(target, epochs, ...)

Functions to compute the relative positions of a target body with respect to an observing body.

compute_body_states(target, epochs, frame, obs)

Functions to compute the relative position and velocity of a target body with respect to an observing body.

convertEpoch(monteEpoch)

Convert a Monte epoch string to a spice epoch string

convertTIFtoMesh([tifFile, latSampling, ...])

Convert a TIF map of emissivities to the format needed for assigning values to each face of a planetary 3D mesh

epochRange([startEpoch, duration, step])

epochRange2([startEpoch, endEpoch, step])

getSunAngles([scName, scFrame, epoch, ...])

get_spacecraft_area(spacecraft, rays[, ra, ...])

Compute a pyRTX.Spacecraft apparent area as seen by the direction specified by a pair of right ascension - declination

get_sun_exposed_area(sc, rtx, epoch)

Compute a pyRTX.Spacecraft apparent area as seen by the direction specified by a pair of right ascension - declination

Classes

LookupTable(linspace_x, linspace_y, values)

This class is used to store results in the shape aof a lookup table.

LookupTableND([axes, values, info, np_array])

Same concept as the LookupTable class, but allowing for multi-dimensional (>2) tables

ScatterLookup()

A class for dealing with zone-scattered lookup tables Intended for creating a lookup table of sets of computed values that lie in distinct, DISJUNCT, zones of the axes space.

TiffInterpolator([axes, values])

class pyRTX.core.analysis_utils.LookupTable(linspace_x, linspace_y, values)[source]

This class is used to store results in the shape aof a lookup table. This is mainly used to store the resultas of a set of raytracing results example: the solar pressure for a body is computed for a grid of RA/DEC values. these values can be stored in the LookupTable object and later retrieved. This class offers the possibility of not oly retrieving pre-computed values, but aslso interpolating between grid points.

NOTE: the grid of the lookup table does not need to be regular the interpolation is based on numpy griddata method which is able to cope with unstructured grids

The main way of retrieving values is through indexing. The following are implemented:

LUT[a,b]: if a, b are in the original lookup table, the original values are returned, otherwise they are interpolated LUT[:,:] or LUT[a:b, c:d]: return the original lut sliced as requested LUT[:,a]: return the original lut (all elements of first axis, integer-indexed elements of second axis) LUT[array-like, array-like]: return the lookup table interpolated in the array-like points

Parameters:
  • linspace_x (np.array(N,)) – The x axis of the lookup table

  • linspace_y (np.array(M,)) – The y axis of the lookup table

  • values (np.ndarray (N,M,1)) – The lookup table values

__init__(linspace_x, linspace_y, values)[source]
set_interpType(interpType)[source]
interp_point(x, y)[source]
__getitem__(idxs)[source]

Implement a getitem method. Several usages are possible:

LUT[a,b]: if a, b are in the original lookup table, the original values are returned, otherwise they are interpolated LUT[:,:] or LUT[a:b, c:d]: return the original lut sliced as requested LUT[:,a]: return the original lut (all elements of first axis, integer-indexed elements of second axis) LUT[array-like, array-like]: return the lookup table interpolated in the array-like points

quickPlot(xlabel=None, ylabel=None, title=None, conversion=1, clabel=None, cmap='viridis', saveto=None)[source]

Produce a quick plot of the lookup table

Parameters:
  • xlabel (str (Optional)) – label for the x-axis

  • ylabel (str (Optional)) – label for the y-axis

  • title (str (Optional)) – title of the plot

  • conversion (float (Optional, default 1)) – a conversion factor for the plotted values. This method will plot X*conversion, Y*conversion

  • clabel (str (Optional)) – label of the color bar

  • cmap (str      (Optional, default 'viridis')) – the colormap to use (matplotlib colormaps)

  • saveto (str (Optional, default None)) – if not None: the path to save the plot to (the file extension defines the format)

class pyRTX.core.analysis_utils.LookupTableND(axes=None, values=None, info=None, np_array=None)[source]

Same concept as the LookupTable class, but allowing for multi-dimensional (>2) tables

Parameters:
  • axes (tuple of np.array) – The axes of the lookup table

  • values (np.ndarray(N,M,L,...,1)) –

  • info (str) – A string field to store information about the lookup table. This is set as a class property so it can be requested trhough instance.info

  • np.array (np.array) – unset

__init__(axes=None, values=None, info=None, np_array=None)[source]
set_interpType(interpType)[source]
get_idx(ind, search_list)[source]
interp_point(vals)[source]
__getitem__(idxs)[source]

Implement a getitem method. Several usages are possible:

LUT[a,b]: if a, b are in the original lookup table, the original values are returned, otherwise they are interpolated LUT[:,:] or LUT[a:b, c:d]: return the original lut sliced as requested LUT[:,a]: return the original lut (all elements of first axis, integer-indexed elements of second axis) LUT[array-like, array-like]: return the lookup table interpolated in the array-like points

axisExtent()[source]
quickPlot(xlabel=None, ylabel=None, title=None, conversion=1, clabel=None, cmap='viridis', saveto=None)[source]

Produce a quick plot of the lookup table

Parameters:
  • xlabel (str (Optional)) – label for the x-axis

  • ylabel (str (Optional)) – label for the y-axis

  • title (str (Optional)) – title of the plot

  • conversion (float (Optional, default 1)) – a conversion factor for the plotted values. This method will plot X*conversion, Y*conversion

  • clabel (str (Optional)) – label of the color bar

  • cmap (str      (Optional, default 'viridis')) – the colormap to use (matplotlib colormaps)

  • saveto (str (Optional, default None)) – if not None: the path to save the plot to (the file extension defines the format)

class pyRTX.core.analysis_utils.ScatterLookup[source]

A class for dealing with zone-scattered lookup tables Intended for creating a lookup table of sets of computed values that lie in distinct, DISJUNCT, zones of the axes space. Example: the value of a variable has been computed in X = [0,1] Y = [0,1] and X = [3,4] Y = [-2,-1]

After instantiating the empty class, the different zones are added. Example

sc = ScatterLookup() zone1 = LookupTableND(*args, **kwargs) zone2 = LookupTableND(*args, **kwargs) sc.addZone(zone1) sc.addZone(zone2)

The value retrieval follows the same rules of indexing as the LookupTable and LookupTableND classes

__init__()[source]
add_zone(ZoneLookup='')[source]

Add a zone :param ZoneLookup: :type ZoneLookup: pyRTX.core.analysis_utils.LookupTableND

zone_determination(idxs)[source]
class pyRTX.core.analysis_utils.TiffInterpolator(axes=None, values=None)[source]
__init__(axes=None, values=None)[source]
interpolator(vals)[source]
set_interpType(interpType)[source]
get_idx(ind, search_list)[source]
interp_point(vals)[source]
__getitem__(idxs)[source]

Implement a getitem method. Several usages are possible:

LUT[a,b]: if a, b are in the original lookup table, the original values are returned, otherwise they are interpolated LUT[:,:] or LUT[a:b, c:d]: return the original lut sliced as requested LUT[:,a]: return the original lut (all elements of first axis, integer-indexed elements of second axis) LUT[array-like, array-like]: return the lookup table interpolated in the array-like points

pyRTX.core.analysis_utils.getSunAngles(scName=None, scFrame=None, epoch=None, correction='LT+S')[source]
pyRTX.core.analysis_utils.epochRange(startEpoch=None, duration=None, step=100)[source]
pyRTX.core.analysis_utils.epochRange2(startEpoch=None, endEpoch=None, step=100)[source]
pyRTX.core.analysis_utils.computeRADEC(vecs, periodicity=360)[source]

From a ND array of shape (N, 3), compute RA/DEC

Parameters: vecs: [ndarray (N,3)] Returns: RA, DEC

pyRTX.core.analysis_utils.convertTIFtoMesh(tifFile='', latSampling='', inferSampling=False, lonSampling='', planet='', lat0=-1.5707963267948966, lat1=1.5707963267948966, lon0=0, lon1=6.283185307179586)[source]

Convert a TIF map of emissivities to the format needed for assigning values to each face of a planetary 3D mesh

Parameters: tifFile : [str] the path to the TIFF file latSampling: [float, in rad] sampling step of latitude lonSampling: [float, in rad] sampling step of longitude planet: [class.Planet] Planet object containing the mesh and the planetary frames inferSampling: [bool] wether the importer shall infer the sampling or not Returns: emissivityInterpolator: [class.LookupTableND] an interpolator for mapping the temperatures on the mesh faces. This is intended to be passed

to the Planet class via the setter method: Planet.emissivity = emissivityInterpolator

pyRTX.core.analysis_utils.convertEpoch(monteEpoch)[source]

Convert a Monte epoch string to a spice epoch string

pyRTX.core.analysis_utils.get_spacecraft_area(spacecraft, rays, ra=0.0, dec=0.0, epoch=None)[source]

Compute a pyRTX.Spacecraft apparent area as seen by the direction specified by a pair of right ascension - declination

Input: spacecraft [pyRTX.Spacecraft] : the spacecraft object rays [pyRTX.PixelPlane] : the pixel plane for raytracing ra [float] : right ascension (in rad) dec [float] : declination (rad) epoch [float or None] : epoch for the computation (this is used when moving Spice

frames are used for the Spacecraft definition)

Output: area [float] : the apparent area. The measurement units depend on the units of the

Spacecraft object

TODO: avoid hardcoded width/height but rather use an automated method

pyRTX.core.analysis_utils.get_sun_exposed_area(sc, rtx, epoch)[source]

Compute a pyRTX.Spacecraft apparent area as seen by the direction specified by a pair of right ascension - declination

Input: spacecraft [pyRTX.Spacecraft] : the spacecraft object ra [float] : right ascension (in rad) dec [float] : declination (rad) epoch [float or None] : epoch for the computation (this is used when moving Spice

frames are used for the Spacecraft definition)

Output: area [float] : the apparent area. The measurement units depend on the units of the

Spacecraft object

TODO: avoid hardcoded width/height but rather use an automated method

pyRTX.core.analysis_utils.compute_body_positions(target, epochs, frame, obs, abcorr='LT + S')[source]

Functions to compute the relative positions of a target body with respect to an observing body.

Parameters: - target: target body name - epochs: list of epochs - frame: reference frame of output position vector - obs: observing body name - abcorr: aberration correction flag.

pyRTX.core.analysis_utils.compute_body_states(target, epochs, frame, obs, abcorr='LT + S')[source]

Functions to compute the relative position and velocity of a target body with respect to an observing body.

Parameters: - target: target body name - epochs: list of epochs - frame: reference frame of output position vector - obs: observing body name - abcorr: aberration correction flag.