:py:mod:`pytmosph3r.util.geometry` ================================== .. py:module:: pytmosph3r.util.geometry Module Contents --------------- .. py:function:: cos_central_angle(lat0, lon0, lat1, lon1) Returns cosine of central angle between two points (lat0, lon0) and (lat1, lon1). .. py:function:: intersection_circles(d, r1, r2) Computes the intersection area of two circles or radii :attr:`r1` and :attr:`r2`, of which the centers are separated by a distance :attr:`d`. .. py:function:: integrate_circles_intersections(d, r1, r2, func, coeffs) Integrate `func(x)` for x Extracted from batman (Kreidberg 2015) :param func: Function to calculate over x :type func: numba function :param d: distance between two circle centers. :type d: float :param r1: radius of 1st circle :type r1: float :param r2: radius of 2nd circle :type r2: float .. py:function:: dist(r1, a1, r2, a2) Distance between two points. .. py:function:: angle_from_sides(r1, r2, r3) Angle between r1 and r2 in a triangle. r3 is the opposite side. .. py:function:: circular_segment(rS, aS, Rs, r1, a1, r2, a2) Computes the intersection area of a line (r1, a1) - (r2, a2), with a circle of radius Rs of which the center is (rS, aS). .. py:function:: triangle_surface(r1, a1, r2, a2, r3, a3) "Surface of a triangle using the coordinates of each vertex. .. py:function:: compute_surface_sector(r, a, a_r, r_a, rS, aS, Rs, n_angular) Surface area of a sector delimited by (r, a) with the intersections points of with the radius r (angles a_r), and the intersections points with the angles a of the sector (radii r_a). There are two solutions (max) for each. :param r: Radius of sector :type r: float :param a: Delimiting angles of sector :type a: float, float :param a_r: Intersections with r (2 solutions max) :type a_r: tuple :param r_a: Intersections with a (2 angles, and 2 solutions max for each) :type r_a: tuple :param rS: projected distance to star center :type rS: float :param aS: projected angle to star center :type aS: float :param Rs: star radius :type Rs: float :param n_angular: Number of angles (simpler calculations if equal to 1) :type n_angular: float .. py:class:: PointCircle(radius: float, angle: float) 2D polar coordinates. .. py:property:: coords :type: Tuple[float, float] .. py:attribute:: radius :type: float Radius in meters. .. py:attribute:: angle :type: float Angle in radians. .. py:class:: PointSpherical(radius: float, latitude: float, longitude: float) 3D spherical coordinates. .. py:property:: coords :type: Tuple[float, float, float] .. py:attribute:: radius :type: float Radius, in meters. .. py:attribute:: latitude :type: float Latitude in radian :math:`[ -\pi/2, +\pi/2]` .. py:attribute:: longitude :type: float Longitude in radian :math:`[0,2\pi[` .. py:class:: PointCartesian(x: float, y: float, z: float) 3D Cartesian coordinates. .. py:property:: coords :type: Tuple[float, float, float] .. py:property:: norm2 :type: float .. py:property:: norm :type: float .. py:function:: fast_solve_latitude(x, latitudes, z_ray, norm_ray, dir_latitude) .. py:class:: CoordinateSystem(direction: PointCartesian, ray_origin: Optional[PointCartesian] = None) Computes the intersection of a ray going through :py:attr:`ray_origin` following the direction :py:attr:`direction`. :param direction: Direction (x,y,z) of the ray. :type direction: :class:`PointCartesian` :param ray_origin: Cartesian coordinates (x,y,z) of the ray intersection point with the terminator. :type ray_origin: :class:`PointCartesian` .. py:method:: radius(x) .. py:method:: latitude(x) .. py:method:: longitude(x) .. py:method:: solve_radius(radii) .. py:method:: solve_longitude(longitudes) .. py:class:: CartesianCoordinateSystem(latitude: float, longitude: float) Bases: :py:obj:`CoordinateSystem` Same as :class:`CoordinateSystem`, but initialize the system with a direction and an ray origin given in spherical and polar coordinates, respectively. .. py:property:: y_coeff .. py:method:: solve_latitude(latitudes) .. py:method:: coordinates(radius, angle) Returns coordinates in Cartesian coordinate `system` of point at (`radius`, `angle`) .. py:method:: add_ray_origin(radius, angle) .. py:class:: CircleIntersection(star, orbit=None, rays=None) Class to compute the intersection of the cells of the transmittance grid with the star disk. :param star: Star (including coordinates and size) :type star: :class:`~pytmosph3r.star.Star` :param sma: Distance (in :math:`m`) between the star and the planet. :type sma: float :param inclination: Orbit inclination (in degrees). :type inclination: float :param rays: Transmittance grid (including the number of radial and angular rays). :type rays: :class:`~pytmosph3r.rays.Rays` .. py:property:: orbit .. py:property:: sma Distance between planet and star. .. py:property:: inclination Inclination of the orbit. .. py:property:: rays Automatize fetching of rays from transmission / building if necessary. .. py:attribute:: rays Transmittance grid. .. py:attribute:: radial_inter Intersections with each radius (2 solutions each, max). .. py:attribute:: angular_inter Intersections with each angle (2 solutions each, max). .. py:method:: dist(phase=None) Computes distance of each cell of the transmittance to the star center. Does not recompute if phase is not provided (save computation time). :param phase: Phase in radians. Defaults to None. :type phase: float, optional :returns: Distance of transmittance cells to star center :rtype: array .. py:method:: intersections(phase, star=None, sma=None, rays=None) Computes intersection surfaces between star and the grid of rays. .. py:method:: compute_intersections_points() Compute intersection points of the star with all radii and angles of the transmittance grid. .. py:method:: compute_intersections_surfaces()