pyRTX.classes.SRP

Classes

SolarPressure(spacecraft[, rayTracer, ...])

Computes the solar radiation pressure (SRP) on a spacecraft.

SunShadow([spacecraft, body, bodyRadius, ...])

Computes the solar flux ratio considering eclipse effects.

class pyRTX.classes.SRP.SunShadow(spacecraft=None, body=None, bodyRadius=None, numrays=100, sunRadius=600000.0, bodyShape=None, bodyFrame=None, limbDarkening='Standard', precomputation=None)[source]

Computes the solar flux ratio considering eclipse effects.

This class simulates the shadow cast by a celestial body on a spacecraft, accounting for solar limb darkening effects to provide a precise solar flux ratio.

__init__(spacecraft=None, body=None, bodyRadius=None, numrays=100, sunRadius=600000.0, bodyShape=None, bodyFrame=None, limbDarkening='Standard', precomputation=None)[source]

Initializes the SunShadow object.

Parameters:
  • spacecraft (object, optional) – An object representing the spacecraft, containing position and orientation.

  • body (str, optional) – The name of the celestial body causing the eclipse (e.g., ‘Moon’).

  • bodyRadius (float, optional) – The radius of the occulting body in kilometers.

  • numrays (int, default 100) – The number of rays to trace across the Sun’s diameter.

  • sunRadius (float, default 600e3) – The radius of the Sun in kilometers.

  • bodyShape (object or str, optional) – A Planet object or a path to a shape model file.

  • bodyFrame (str, optional) – The SPICE reference frame for the body’s shape model.

  • limbDarkening (str, default 'Standard') – The solar limb darkening model to use (‘Standard’, ‘Eddington’, or None).

  • precomputation (object, optional) – A Precompute object with precomputed SPICE data.

run(epoch)[source]

Compute the eclipse ratio for a single epoch.

Parameters:

epoch (float) – The SPICE ephemeris time for the computation.

Returns:

The solar flux ratio (1.0 for full sun, 0.0 for total eclipse).

Return type:

float

compute(epochs, n_cores=None)[source]

Compute eclipse ratios for multiple epochs.

Parameters:
  • epochs (list or array) – A list or array of SPICE ephemeris times.

  • n_cores (int, optional) – The number of CPU cores to use for parallel computation.

Returns:

An array of solar flux ratios for each epoch.

Return type:

array

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

Computes the solar radiation pressure (SRP) on a spacecraft.

This class orchestrates the SRP calculation by using a ray-tracer to simulate sunlight hitting a spacecraft model. It accounts for material properties, self-shadowing, and eclipse conditions.

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

Initializes the SolarPressure object.

Parameters:
  • spacecraft (object) – The spacecraft model, containing geometry and material properties.

  • rayTracer (object, optional) – A RayTracer object to perform the ray-tracing simulation.

  • baseflux (float, default 1361.5) – The nominal solar flux at 1 AU in W/m^2.

  • grouped (bool, default True) – If True, returns the total force vector; otherwise, returns forces per-face.

  • shadowObj (object, optional) – A SunShadow object to compute eclipse factors.

  • lookup (object, optional) – A lookup table for precomputed SRP values.

  • precomputation (object, optional) – A Precompute object with precomputed SPICE data.

run(epoch)[source]

Compute the solar pressure acceleration for a single epoch.

Parameters:

epoch (float) – The SPICE ephemeris time for the computation.

Returns:

The 3D solar pressure acceleration vector.

Return type:

array

compute(epochs, n_cores=None)[source]

Compute the solar pressure acceleration for multiple epochs.

Parameters:
  • epochs (list or array) – A list or array of SPICE ephemeris times.

  • n_cores (int, optional) – The number of CPU cores to use for parallel computation.

Returns:

An array of 3D acceleration vectors for each epoch.

Return type:

array

lookupCompute(epochs)[source]

Compute the solar pressure force using a lookup table.

Parameters:

epochs (list or array) – A list or array of SPICE ephemeris times.

Returns:

An array of 3D acceleration vectors for each epoch.

Return type:

array

get_flux(epoch)[source]

Get the scaled solar flux at a given epoch.

Parameters:

epoch (float) – The SPICE ephemeris time for the computation.

Returns:

The solar flux in W/m^2, scaled by the spacecraft’s distance from the Sun.

Return type:

float

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 total SRP force from ray-tracing results.

Parameters:
  • flux (float) – The incident solar flux in W/m^2.

  • mesh_obj (object) – The trimesh object representing the spacecraft.

  • index_tri (list) – A list of arrays of intersected triangle indices for each bounce.

  • index_ray (list) – A list of arrays of intersecting ray indices for each bounce.

  • location (list) – A list of arrays of intersection locations for each bounce.

  • ray_origins (list) – A list of arrays of ray origins for each bounce.

  • ray_directions (list) – A list of arrays of ray directions for each bounce.

  • pixel_spacing (float) – The spacing between rays, used for normalization.

  • materials (str or dict, default 'None') – A dictionary of material properties for each face.

  • grouped (bool, default True) – If True, returns the total force vector.

  • diffusion (bool, default False) – If True, computes diffuse reflection forces.

  • num_diffuse (int, optional) – The number of diffuse rays to sample per intersection.

  • diffusion_pack (list, optional) – A list containing data from the diffusion ray-tracing pass.

Returns:

The total SRP force vector, or a list of per-face forces if grouped is False.

Return type:

array or list

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 computation of the SRP force (vectorized).

Parameters:
  • flux (float) – The incident solar flux in W/m^2.

  • indexes_tri (array) – The indices of the intersected triangles.

  • indexes_ray (array) – The indices of the intersecting rays.

  • N (array) – The normal vectors of the mesh faces.

  • S (array) – The incident ray direction vectors.

  • norm_factor (float) – The normalization factor computed from ray spacing.

  • mesh_obj (object) – The trimesh object representing the spacecraft.

  • materials (str or dict, default 'None') – A dictionary of material properties for each face.

  • diffusion (bool, default False) – If True, computes diffuse reflection forces.

  • num_diffuse (int, optional) – The number of diffuse rays to sample per intersection.

  • diffusion_pack (list, optional) – A list containing data from the diffusion ray-tracing pass.

Returns:

A tuple containing the SRP force vector and the new flux for the next bounce.

Return type:

tuple