Coordinates#
Coordinate utilities for (u, v) maps, polar angle and separation.
This module provides utilities to generate normalized spatial coordinate maps (u, v), the polar angle θ and angular separation ρ over a given field of view, plus conversion helpers between (θ, ρ) and (u, v).
Docstrings follow the Google style (compatible with Sphinx Napoleon).
- phise.modules.coordinates.get_maps_jit(
- N: int,
- fov: float,
Generate (u, v), θ and ρ maps in polar representation (njit version).
- Parameters:
N – Grid resolution (samples per axis).
fov – Total field of view (same unit as ρ; scalar value, e.g. in mas or rad).
- Returns:
x_map (np.ndarray): Normalized u map of shape (N, N) in [-1, 1].
y_map (np.ndarray): Normalized v map of shape (N, N) in [-1, 1].
alpha (np.ndarray): Polar angle θ map in radians, shape (N, N).
theta (np.ndarray): Separation ρ map, shape (N, N), expressed in
fovunits.
- Return type:
Tuple with
- phise.modules.coordinates.get_maps(
- N: int,
- fov: Quantity,
Generate (u, v), θ and ρ maps with units handling.
This interface converts and annotates outputs with
astropyunits.- Parameters:
N – Grid resolution (samples per axis).
fov – Total field of view as an
astropy.units.Quantity(e.g. mas, rad).
- Returns:
x_map (np.ndarray): Normalized u map of shape (N, N) in [-1, 1].
y_map (np.ndarray): Normalized v map of shape (N, N) in [-1, 1].
alpha (Quantity): θ map in radians (
u.rad), shape (N, N).theta (Quantity): ρ map, shape (N, N), in
fovunits.
- Return type:
Tuple with
- phise.modules.coordinates.plot_uv_map(extent: tuple[float, float, float, float])[source]#
Display u, v, ρ and θ maps for a quick visual inspection.
Note
This function internally generates the maps via
get_mapsand displays them in a 2x2 figure. Theextentargument controls the (u, v) axis frame passed tomatplotlib.pyplot.imshow.- Parameters:
extent – Axis bounds (u_min, u_max, v_min, v_max) passed to imshow.
- Returns:
None. Shows a matplotlib figure.
- phise.modules.coordinates.ρθ_to_xy(
- ρ: Quantity,
- θ: Quantity,
- fov: Quantity,
Convert (θ, ρ) to Cartesian coordinates (u, v) with units.
- Parameters:
θ – Parallactic angle in angle units (converted to
u.rad).ρ – Angular separation (converted to radians for computation).
fov – Total field of view (converted to radians for normalization).
- Returns:
Tuple
(u, v)as unitless Quantities (normalized values), corresponding to normalized coordinates in [-1, 1].
- phise.modules.coordinates.ρθ_to_xy_jit(
- ρ: float,
- θ: float,
- fov: float,
Convert (θ, ρ) to normalized Cartesian coordinates (u, v) (njit version).
- Parameters:
θ – Parallactic angle in radians.
ρ – Angular separation in radians.
fov – Total field of view in radians (used for normalization).
- Returns:
Tuple
(u, v)representing normalized positions in [-1, 1].