Classes

SunShadow

SolarPressure

class pyRTX.classes.SRP.SolarPressure(spacecraft, rayTracer=None, baseflux=1361.5, grouped=True, shadowObj=None, lookup=None, precomputation=None)[source]

Bases: object

__init__(spacecraft, rayTracer=None, baseflux=1361.5, grouped=True, shadowObj=None, lookup=None, precomputation=None)[source]
run(epoch)[source]

Method to compute solar pressure acceleration at a single epoch.

Parameters: - epoch: spiceypy epoch

compute(epochs, n_cores=None)[source]

Method to compute the solar pressure acceleration.

Parameters: - epochs: list of epochs - ncores: number of cores to use for parallel computations

lookupCompute(epochs)[source]

Method to compute the solar pressure force with Look Up Table.

Parameters: - epochs: list of epochs

get_flux(epoch)[source]

Method to get the scaled solar flux.

Parameters: - epoch: requested epoch

get_force(flux, mesh_obj, index_tri, index_ray, location, ray_origins, ray_directions, pixel_spacing, materials='None', grouped=True, diffusion=False, num_diffuse=None, diffusion_pack=None)[source]

Compute the SRP force

Parameters: flux: Solar input flux [W/m^2] A: areas of the mesh faces s: incident ray directions r: reflcted ray directions n: normal unit vector to the faces

srp_core(flux, indexes_tri, indexes_ray, N, S, norm_factor, mesh_obj, materials='None', diffusion=False, num_diffuse=None, diffusion_pack=None)[source]

Core of SRP computation. Highly vectorized version. For explicit algorithm implementation refer to the old version

Parameters: flux: solar flux (float, W/m^2) indexes_tri: indexes of intersected triangles indexes_ray: indexes of intersecting rays N: normals S: incident direction vectors norm_factor: normalization factor computed from ray spacing (float) mesh_obj: trimesh.Trimesh object [Not used for now, will be used when interrogating mesh

for surface properties]

Returns: force: np.array of SRP force

Planet

class pyRTX.classes.Planet.Planet(fromFile=None, radius=0, name='', bodyFrame='', sunFixedFrame='', units='km', subdivs=4)[source]

Bases: object

__init__(fromFile=None, radius=0, name='', bodyFrame='', sunFixedFrame='', units='km', subdivs=4)[source]

A class to represent a planet/moon

Input: fromFile : put here an obj file if requested to build the model. If None (default) a sphere with radius defined in “radius” will be built radius : (float) the radius of the planet. Not used if “fromFile” is not None name : (str) the name of the planet bodyFrame: (str) the planet body fixed frame sunFixedFrame: (str) the body centered - sun fixed frame units: (str) [Default: km] the measurement units defining the body (can be km or m) subdivs: (int) [Default: 4] the number of subdivision for the creation of the spherical planet. Note that the number of faces will grow as function of 4 ** subdivisions, so you probably want to keep this under ~5.

mesh(translate=None, rotate=None, epoch=None, targetFrame=None)[source]
albedoFaces(epoch, spacecraft_name)[source]

Public method: Return the idxs of the mesh faces that are needed for albedo computation at time:epoch for the spacecraft:spacectaft name

rot_toSCframe(epoch, scFrame=None)[source]
emissivityFaces(epoch, spacecraft_name)[source]

Public method: Return the idxs of the mesh faces and the temperature of each face that are needed for emissivity computation at time:epoch for the spacecraft:spacectaft name

getFaceAlbedo(epoch)[source]

Return the albedo of each face at epoch

getFaceTemperatures(epoch)[source]

Return the temperature of each face at epoch

getFaceEmissivity(epoch, sunFixedFrame=False)[source]
VFNC(epoch, sunFixedFrame=True)[source]

Public method: Returns V F N C rotating the planet in the sunFixedFrame at epoch epoch V: Vertices F: Faces N: Normals C: Centroids

getScPosSunFixed(epoch, spacecraft_name)[source]
pxform_convert(pxform)[source]
property dayside_temperature
property nightside_temperature
property gridded_temperature
property albedo
property albedo_map
property emissivity

PixelPlane

class pyRTX.classes.PixelPlane.PixelPlane(spacecraft=None, source=None, mode='Fixed', distance=1.0, lon=None, lat=None, width=None, height=None, ray_spacing=0.1, packets=1, units='m')[source]

Bases: object

__init__(spacecraft=None, source=None, mode='Fixed', distance=1.0, lon=None, lat=None, width=None, height=None, ray_spacing=0.1, packets=1, units='m')[source]

“Generate a pixel array for raytracing ad defined in Li et al., 2018 This is the “optimized version”. To explicitly see the algorithm refer to the function definition without _opt extension. Parameters: d0: [float] Distance of the pixel array from the center (in meters) lat: [float] Latitude of the pixel array center (in rad) lon: [float] Longitude of the pixel array center (in rad) width: [float] The width of the plane(in meters). Default = 1 height: [float] the height of the plane(in meters). Default = 1 ray_spacing: [float] the spacing of the rays (in meters). Default = 0.1 packets: [int] the number of ‘ray packets’ to return. This is implemented to avoid the segmentation

fault triggered by the raytracer when the number of rays is too high

Returns: locs: [numpy array (n_rays, 3)] Pixel locations as a numpy array dirs: [numpy array (n_rays, 3)] the ray directions as a numpy array

dump(epoch=None)[source]
update_latlon(lon=None, lat=None)[source]

Spacecraft

class pyRTX.classes.Spacecraft.Spacecraft(name=None, base_frame=None, spacecraft_model=None, units='m', mass=0.0)[source]

Bases: object

This is the main class for defining spacecraft objects.

__init__(name=None, base_frame=None, spacecraft_model=None, units='m', mass=0.0)[source]
Parameters:
  • name (str) – Spacecraft name

  • base_frame (str) – Spacecraft body (base) frame

  • spacecraft_model (dict) – dict of {file:str, frame_type:str, frame_name:str, center:list, specular:float, diffuse:float, UD_rotation:trimesh.rotation}

  • of (a dictionary with keys the name) –

    file: str

    the obj file for the part

    frame_type: str

    ’Spice’ or ‘UD’ to choose wether to define a reference to a spice frame or UserDefined one in the case of ‘UD’ a rotation matrix must be specified in the UD_rotation (optional) key

    frame_name: str

    The name of the Spice (or UD) frame

    center: list

    position of the origin of the object (in km) with respect to the base frame

    specular: float

    specular coefficient

    diffuse: float

    diffuse coefficient

    UD_rotation: trimesh.rotation

    optional specify a user defined rotations matrix

  • units (str) – units for transformations

  • mass (float or nc file) – Spacecraft mass. Can be a float value or an xarray with times and mass values

Returns:

bla

Return type:

pyRTX.classes.Spacecraft

add_parts(spacecraft_model=None)[source]

Add parts to the model instance :param spacecraft_model: See the main constructor documentation :type spacecraft_model: dict

subset(elem_names)[source]

Return an instance of Spacecraft with only the elements contained in the list elem_names. Suppose the Spacecraft (self) is composed of elements A,B,C Spacecraft.subset([‘A’,’B’]) would return a new instance of Spacecraft with only the elements A and B

remove_part(name)[source]
pxform_convert(pxform)[source]
apply_transforms(epoch)[source]

Method to rotate and translate the components.

Parameters: - epoch: epoch of the transformation

materials()[source]
dump(epoch=None, split=False)[source]
dump_materials()[source]
info()[source]