:py:mod:`pytmosph3r.rays` ========================= .. py:module:: pytmosph3r.rays Module Contents --------------- .. py:class:: RaysGrid(n_radial=None, n_angular=None) Bases: :py:obj:`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 :py:attr:`n_radial` radial points located at the middle of the layers (see :py:attr:`z`), and :py:attr:`n_angular` angular points (see :py:attr:`angles`). .. py:property:: n_radial .. py:property:: n_angular .. py:property:: shape :type: Tuple[int, int] Shape of the grid (:py:attr:`n_radial`,:py:attr:`n_angular`). .. py:property:: unit_angle Angular length of one slice (in `radians`). .. py:attribute:: n_radial Number of radial points in the grid. Equal to :attr:`~pytmosph3r.Model.n_layers` by default. .. py:attribute:: n_angular Number of angular points in the grid. Equal to 2* :attr:`~pytmosph3r.Model.n_latitudes` by default. .. py:attribute:: 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 .. py:attribute:: dz Distance between levels. .. py:attribute:: 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. .. py:attribute:: angles Azimuthal angles of the rays. .. py:attribute:: r_limits Delimiting radii of each transmittance cell. .. py:attribute:: angles_limits Delimiting angles of each transmittance cell. .. py:method:: compute_radii() Compute the altitudes (in `m`) over the grid by discretizing the space between the surface and :py:attr:`top_altitude` into :py:attr:`n_radial` intervals. The altitudes are then computed as the middle of these intervals. .. py:method:: compute_angles() Compute the angles of the grid in `radians`. .. py:class:: Rays(n_radial=None, n_angular=None, observer=None, grid=None) Bases: :py:obj:`pytmosph3r.planetary_system.Observer`, :py:obj:`RaysGrid` Rays are orthogonal to the terminator plane (going through the center of the planet) of which the direction is defined by :class:`Observer`. The discretization of the plane is handled by :class:`RaysGrid`. Set the observer's position with: :param latitude: Latitude (in :math:`rad` or astropy units). Default to 0. :type latitude: float, Unit, optional :param longitude: Longitude (in :math:`rad` or astropy units). Default to $\pi$. :type longitude: float, Unit, optional .. py:property:: latitude .. py:property:: longitude .. py:property:: units .. py:property:: orbit .. py: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 :class:`~pytmosph3r.util.geometry.CartesianCoordinateSystem` using its spherical coordinates ( :py:attr:`latitude`, :py:attr:`longitude`). .. py:attribute:: observer Position of the observer. .. py:attribute:: rays_lengths Lengths of each subsegment of each ray, ordered by their coordinates. .. py:attribute:: rays_indices Control if rays lengths will be stored as a 1D array (or 2D, which is the default behavior). .. py:method:: build(model) Initialize the class with data from other modules for later computations. .. py:method:: init_subrays() Initialize the data for the computation of subrays. .. py:method:: compute_sub_rays(bounds=None) 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 :py:attr:`rays_lengths`. The function iterates over :py:attr:`RaysGrid.angles` and computes :py:func:`compute_sub_rays_angle` for each of these angles. :param bounds: 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. :type bounds: tuple :returns: Coordinates in the atmospheric grid with at least one subray, which will be given to the opacity module (``Exo_k``). :rtype: :py:obj:`dict` .. py:method:: compute_sub_rays_angles(angles) Subdivision of rays for multiple angles. .. py:method:: compute_sub_rays_angle(bounds=None) Subdivision of the rays at the angle :py:attr:`angle_idx`. WARNING: the parameter to this function is NOT the angle, but the :attr:`bounds` of radial points to consider. See :py:func:`compute_sub_rays`. If :attr:`opacity_coords` is not initialized, it creates one. :param bounds: Must be (r_s,r_e), where r_s and r_e are the radial start and end points. :type bounds: tuple .. py:method:: levels_intersection(points, atm_layer_idx) Computes the intersection of a ray (of coordinates (radius, angle)) with atmospheric levels (spheres). Returns a list of points [dist, r, lat, lon]. .. py:method:: latitudes_intersection(points) .. py:method:: longitudes_intersection(points) .. py:method:: filter_out(points) Filter out spheres that are larger than atmosphere and sort .. py:method:: subrays_length(points, ray_radius) 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. .. py:method:: outputs() .. py:function:: init_rays(obj) Returns a :class:`Rays` class with either a dictionary or a Rays object.