pyRTX.core.analysis_utils
Functions
|
From a ND array of shape (N, 3), compute RA/DEC |
|
Functions to compute the relative positions of a target body with respect to an observing body. |
|
Functions to compute the relative position and velocity of a target body with respect to an observing body. |
|
Convert a Monte epoch string to a spice epoch string |
|
Convert a TIF map of emissivities to the format needed for assigning values to each face of a planetary 3D mesh |
|
|
|
|
|
|
|
Compute a pyRTX.Spacecraft apparent area as seen by the direction specified by a pair of right ascension - declination |
|
Compute a pyRTX.Spacecraft apparent area as seen by the direction specified by a pair of right ascension - declination |
Classes
|
This class is used to store results in the shape aof a lookup table. |
|
Same concept as the LookupTable class, but allowing for multi-dimensional (>2) tables |
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. |
|
|
- 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 tablelinspace_y (
np.array(M,)) – The y axis of the lookup tablevalues (
np.ndarray (N,M,1)) – The lookup table values
- __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-axisylabel (
str (Optional)) – label for the y-axistitle (
str (Optional)) – title of the plotconversion (
float (Optional, default1)) – a conversion factor for the plotted values. This method will plot X*conversion, Y*conversionclabel (
str (Optional)) – label of the color barcmap (
str (Optional, default'viridis')) – the colormap to use (matplotlib colormaps)saveto (
str (Optional, defaultNone)) – 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:
- __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-axisylabel (
str (Optional)) – label for the y-axistitle (
str (Optional)) – title of the plotconversion (
float (Optional, default1)) – a conversion factor for the plotted values. This method will plot X*conversion, Y*conversionclabel (
str (Optional)) – label of the color barcmap (
str (Optional, default'viridis')) – the colormap to use (matplotlib colormaps)saveto (
str (Optional, defaultNone)) – 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
- add_zone(ZoneLookup='')[source]
Add a zone :param ZoneLookup: :type ZoneLookup:
pyRTX.core.analysis_utils.LookupTableND
- class pyRTX.core.analysis_utils.TiffInterpolator(axes=None, values=None)[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.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.