Data Structures API#
This section provides detailed API documentation for Furax data structures.
Stokes Parameters#
Abstract Base Class#
- class furax.obs.stokes.Stokes[source]#
Bases:
ABC- property structure: PyTree[jax._src.api.ShapeDtypeStruct]#
- classmethod class_for(stokes: Literal['I']) type[StokesI][source]#
- classmethod class_for(stokes: Literal['QU']) type[StokesQU]
- classmethod class_for(stokes: Literal['IQU']) type[StokesIQU]
- classmethod class_for(stokes: Literal['IQUV']) type[StokesIQUV]
Returns the StokesPyTree subclass associated to the specified Stokes types.
- classmethod from_stokes(i: Array | ndarray | bool | number | bool | int | float | complex) StokesI[source]#
- classmethod from_stokes(i: ShapeDtypeStruct) StokesI
- classmethod from_stokes(q: Array | ndarray | bool | number | bool | int | float | complex, u: Array | ndarray | bool | number | bool | int | float | complex) StokesQU
- classmethod from_stokes(q: ShapeDtypeStruct, u: ShapeDtypeStruct) StokesQU
- classmethod from_stokes(i: Array | ndarray | bool | number | bool | int | float | complex, q: Array | ndarray | bool | number | bool | int | float | complex, u: Array | ndarray | bool | number | bool | int | float | complex) StokesIQU
- classmethod from_stokes(i: ShapeDtypeStruct, q: ShapeDtypeStruct, u: ShapeDtypeStruct) StokesIQU
- classmethod from_stokes(i: Array | ndarray | bool | number | bool | int | float | complex, q: Array | ndarray | bool | number | bool | int | float | complex, u: Array | ndarray | bool | number | bool | int | float | complex, v: Array | ndarray | bool | number | bool | int | float | complex) StokesIQUV
- classmethod from_stokes(i: ShapeDtypeStruct, q: ShapeDtypeStruct, u: ShapeDtypeStruct, v: ShapeDtypeStruct) StokesIQUV
Returns a StokesPyTree according to the specified Stokes vectors.
Examples
>>> tod_i = Stokes.from_stokes(i) >>> tod_qu = Stokes.from_stokes(q, u) >>> tod_iqu = Stokes.from_stokes(i, q, u) >>> tod_iquv = Stokes.from_stokes(i, q, u, v)
- abstract classmethod from_iquv(i, q, u, v)[source]#
Returns a StokesPyTree ignoring the Stokes components not in the type.
- Parameters:
i (Float[Array, '...'])
q (Float[Array, '...'])
u (Float[Array, '...'])
v (Float[Array, '...'])
- Return type:
Self
Stokes Implementations#
Landscapes#
Abstract Base Classes#
- class furax.obs.landscapes.Landscape(shape, dtype=<class 'numpy.float64'>)[source]#
Bases:
ABC- abstract normal(key)[source]#
- Parameters:
key (Key[Array, ''])
- Return type:
PyTree[jaxtyping.Shaped[Array, ‘…’]]
- class furax.obs.landscapes.StokesLandscape(shape=None, stokes='IQU', dtype=<class 'numpy.float64'>, pixel_shape=None)[source]#
Bases:
LandscapeClass representing a multidimensional map of Stokes vectors.
We assume that integer pixel values fall at the center of pixels (as in the FITS WCS standard, see Section 2.1.4 of Greisen et al., 2002, A&A 446, 747).
- Variables:
shape – The shape of the array that stores the map values. The dimensions are in the reverse order of the FITS NAXIS* keywords. For a 2-dimensional map, the shape corresponds to (NAXIS2, NAXIS1) or (\(n_\mathrm{row}\), \(n_\mathrm{col}\)), i.e. (\(n_y\), \(n_x\)).
pixel_shape – The shape in reversed order. For a 2-dimensional map, the shape corresponds to (NAXIS1, NAXIS2) or (\(n_\mathrm{col}\), \(n_\mathrm{row}\)), i.e. (\(n_x\), \(n_y\)).
stokes – The identifier for the Stokes vectors (I, QU, IQU or IQUV)
dtype – The data type for the values of the landscape.
- Parameters:
- property structure: PyTree[jax._src.api.ShapeDtypeStruct]#
- normal(key)[source]#
- Parameters:
key (Key[Array, ''])
- Return type:
PyTree[jaxtyping.Shaped[Array, ‘{self.npixel}’]]
- world2index(theta, phi)[source]#
- Parameters:
theta (Float[Array, '*dims'])
phi (Float[Array, '*dims'])
- Return type:
Integer[Array, ‘*dims’]
- pixel2index(*coords)[source]#
Converts multidimensional pixel coordinates into 1-dimensional indices.
For a map of shape \((n_y, n_x)\), the indices of the pixels are walked from the rightmost dimension \(n_x\) to the leftmost dimension \(n_y\) (row-major layout). In such a map, the pixel with float coordinates \((p_x, p_y)\) has an index \(i = round(p_x) + n_x round(p_y)\).
The indices travel from bottom to top, like the Y-coordinates.
Integer values of the pixel coordinates correspond to the pixel centers. The points \((p_x, p_y)\) strictly inside a pixel centered on the integer coordinates \((i_x, i_y)\) verify
\(i_x - ½ < p_x < i_x + ½\)
\(i_y - ½ < p_y < i_y + ½\)
The convention for pixels and indices is that the first one starts at zero.
- Parameters:
*coords (Float[Array, '*dims']) – The floating-point pixel coordinates along the X, Y, Z, … axes.
- Returns:
The 1-dimensional integer indices associated to the pixel coordinates. The data type is int32, unless the landscape largest index would overflow, in which case it is int64.
- Return type:
Integer[Array, ‘*ndims’]
- quat2pixel(quat)[source]#
Converts quaternion to floating-point pixel coordinates.
- Parameters:
quat (Float[Array, '*dims 4'])
- Return type:
tuple[Float[Array, ‘*dims’], …]
- quat2index(quat)[source]#
Converts quaternion to 1-dimensional pixel indices.
- Parameters:
quat (Float[Array, '*dims 4'])
- Return type:
Integer[Array, ‘*dims’]
- world2interp(theta, phi)[source]#
Returns (indices, weights) with a trailing neighbor dimension for interpolation.
Subclasses must override this to support interpolated pointing.
- Parameters:
theta (Float[Array, '*dims'])
phi (Float[Array, '*dims'])
- Return type:
tuple[Integer[Array, ‘…’], Float[Array, ‘…’]]
Implementations#
- class furax.obs.landscapes.HealpixLandscape(nside, stokes='IQU', dtype=<class 'numpy.float64'>, nested=False)[source]#
Bases:
StokesLandscapeClass representing a Healpix-projected map of Stokes vectors.
- Parameters: