pytmosph3r.util.geometry

Module Contents

cos_central_angle(lat0, lon0, lat1, lon1)[source]

Returns cosine of central angle between two points (lat0, lon0) and (lat1, lon1).

intersection_circles(d, r1, r2)[source]

Computes the intersection area of two circles or radii r1 and r2, of which the centers are separated by a distance d.

integrate_circles_intersections(d, r1, r2, func, coeffs)[source]

Integrate func(x) for x

Extracted from batman (Kreidberg 2015)

Parameters:
  • func (numba function) – Function to calculate over x

  • d (float) – distance between two circle centers.

  • r1 (float) – radius of 1st circle

  • r2 (float) – radius of 2nd circle

dist(r1, a1, r2, a2)[source]

Distance between two points.

angle_from_sides(r1, r2, r3)[source]

Angle between r1 and r2 in a triangle. r3 is the opposite side.

circular_segment(rS, aS, Rs, r1, a1, r2, a2)[source]

Computes the intersection area of a line (r1, a1) - (r2, a2), with a circle of radius Rs of which the center is (rS, aS).

triangle_surface(r1, a1, r2, a2, r3, a3)[source]

“Surface of a triangle using the coordinates of each vertex.

compute_surface_sector(r, a, a_r, r_a, rS, aS, Rs, n_angular)[source]

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.

Parameters:
  • r (float) – Radius of sector

  • a (float, float) – Delimiting angles of sector

  • a_r (tuple) – Intersections with r (2 solutions max)

  • r_a (tuple) – Intersections with a (2 angles, and 2 solutions max for each)

  • rS (float) – projected distance to star center

  • aS (float) – projected angle to star center

  • Rs (float) – star radius

  • n_angular (float) – Number of angles (simpler calculations if equal to 1)

class PointCircle(radius: float, angle: float)[source]

2D polar coordinates.

property coords: Tuple[float, float]
radius: float

Radius in meters.

angle: float

Angle in radians.

class PointSpherical(radius: float, latitude: float, longitude: float)[source]

3D spherical coordinates.

property coords: Tuple[float, float, float]
radius: float

Radius, in meters.

latitude: float

Latitude in radian \([ -\pi/2, +\pi/2]\)

longitude: float

Longitude in radian \([0,2\pi[\)

class PointCartesian(x: float, y: float, z: float)[source]

3D Cartesian coordinates.

property coords: Tuple[float, float, float]
property norm2: float
property norm: float
fast_solve_latitude(x, latitudes, z_ray, norm_ray, dir_latitude)[source]
class CoordinateSystem(direction: PointCartesian, ray_origin: PointCartesian | None = None)[source]

Computes the intersection of a ray going through ray_origin following the direction direction.

Parameters:
  • direction (PointCartesian) – Direction (x,y,z) of the ray.

  • ray_origin (PointCartesian) – Cartesian coordinates (x,y,z) of the ray intersection point with the terminator.

radius(x)[source]
latitude(x)[source]
longitude(x)[source]
solve_radius(radii)[source]
solve_longitude(longitudes)[source]
class CartesianCoordinateSystem(latitude: float, longitude: float)[source]

Bases: CoordinateSystem

Same as CoordinateSystem, but initialize the system with a direction and an ray origin given in spherical and polar coordinates, respectively.

property y_coeff
solve_latitude(latitudes)[source]
coordinates(radius, angle)[source]

Returns coordinates in Cartesian coordinate system of point at (radius, angle)

add_ray_origin(radius, angle)[source]
class CircleIntersection(star, orbit=None, rays=None)[source]

Class to compute the intersection of the cells of the transmittance grid with the star disk.

Parameters:
  • star (Star) – Star (including coordinates and size)

  • sma (float) – Distance (in \(m\)) between the star and the planet.

  • inclination (float) – Orbit inclination (in degrees).

  • rays (Rays) – Transmittance grid (including the number of radial and angular rays).

property orbit
property sma

Distance between planet and star.

property inclination

Inclination of the orbit.

property rays

Automatize fetching of rays from transmission / building if necessary.

rays

Transmittance grid.

radial_inter

Intersections with each radius (2 solutions each, max).

angular_inter

Intersections with each angle (2 solutions each, max).

dist(phase=None)[source]

Computes distance of each cell of the transmittance to the star center. Does not recompute if phase is not provided (save computation time).

Parameters:

phase (float, optional) – Phase in radians. Defaults to None.

Returns:

Distance of transmittance cells to star center

Return type:

array

intersections(phase, star=None, sma=None, rays=None)[source]

Computes intersection surfaces between star and the grid of rays.

compute_intersections_points()[source]

Compute intersection points of the star with all radii and angles of the transmittance grid.

compute_intersections_surfaces()[source]