pytmosph3r.rays

Module Contents

class RaysGrid(n_radial=None, n_angular=None)[source]

Bases: pytmosph3r.grid.Grid

Polar grid defining the number of rays on the terminator plane

(plane going through the center of the planet and orthogonal to the rays).

The grid has n_radial radial points located at the middle of the layers (see z),

and n_angular angular points (see angles).

property n_radial
property n_angular
property shape: Tuple[int, int]

Shape of the grid (n_radial,:py:attr:n_angular).

property unit_angle

Angular length of one slice (in radians).

n_radial

Number of radial points in the grid. Equal to n_layers by default.

n_angular

Number of angular points in the grid. Equal to 2* n_latitudes by default.

top_altitude

does not represent the altitude of the highest ray, but the altitude of the maximum level of the grid. The rays are then passing through the middle of each layer.

Type:

Top altitude to consider for the rays. Warning

dz

Distance between levels.

r

Impact parameters of the rays, i.e., their distance to the center of the planet. Note that they are passing through the middle of the layers of the grid.

angles

Azimuthal angles of the rays.

r_limits

Delimiting radii of each transmittance cell.

angles_limits

Delimiting angles of each transmittance cell.

compute_radii()[source]

Compute the altitudes (in m) over the grid by discretizing the space between the surface and top_altitude into n_radial intervals. The altitudes are then computed as the middle of these intervals.

compute_angles()[source]

Compute the angles of the grid in radians.

class Rays(n_radial=None, n_angular=None, observer=None, grid=None)[source]

Bases: pytmosph3r.planetary_system.Observer, RaysGrid

Rays are orthogonal to the terminator plane (going through the center of the planet) of which the direction is defined by Observer. The discretization of the plane is handled by RaysGrid.

Set the observer’s position with:

Parameters:
  • latitude (float, Unit, optional) – Latitude (in \(rad\) or astropy units). Default to 0.

  • longitude (float, Unit, optional) – Longitude (in \(rad\) or astropy units). Default to $pi$.

property latitude
property longitude
property units
property orbit
property cartesian_system

Cartesian coordinate system (x,y,z) of which:

  • z is oriented along the rotation axis (pointing towards the North Pole)

  • x points towards a reference point on the equator that corresponds to a longitude equal to zero

  • y is chosen to have a direct basis.

The coordinates of the unit vector defining the direction of the rays are then computed through CartesianCoordinateSystem using its spherical coordinates ( latitude, longitude).

observer

Position of the observer.

rays_lengths

Lengths of each subsegment of each ray, ordered by their coordinates.

rays_indices

Control if rays lengths will be stored as a 1D array (or 2D, which is the default behavior).

build(model)[source]

Initialize the class with data from other modules for later computations.

init_subrays()[source]

Initialize the data for the computation of subrays.

compute_sub_rays(bounds=None)[source]

Subdivision of the rays into smaller segments (‘subrays’) based on the atmospheric grid. Each subray is associated to coordinates and their lengths are stored in rays_lengths. The function iterates over RaysGrid.angles and computes compute_sub_rays_angle() for each of these angles.

Parameters:

bounds (tuple) – Must be ((r_s,r_e), (a_s,a_e)), where r_s and r_e are the radial start and end points, and a_s and a_e the angular ones.

Returns:

Coordinates in the atmospheric grid with at least one subray, which will be given to the opacity module (Exo_k).

Return type:

dict

compute_sub_rays_angles(angles)[source]

Subdivision of rays for multiple angles.

compute_sub_rays_angle(bounds=None)[source]

Subdivision of the rays at the angle angle_idx. WARNING: the parameter to this function is NOT the angle, but the bounds of radial points to consider. See compute_sub_rays(). If opacity_coords is not initialized, it creates one.

Parameters:

bounds (tuple) – Must be (r_s,r_e), where r_s and r_e are the radial start and end points.

levels_intersection(points, atm_layer_idx)[source]

Computes the intersection of a ray (of coordinates (radius, angle)) with atmospheric levels (spheres). Returns a list of points [dist, r, lat, lon].

latitudes_intersection(points)[source]
longitudes_intersection(points)[source]
filter_out(points)[source]

Filter out spheres that are larger than atmosphere and sort

subrays_length(points, ray_radius)[source]

Find coordinates of subrays and compute their length. Stored their coordinates into a dictionary: {(altitude, latitude, longitude): True} to allow merging

the coordinates shared with other rays.

outputs()[source]
init_rays(obj)[source]

Returns a Rays class with either a dictionary or a Rays object.