template_synthesis.jax.utilities.coordinate_transformations module

File copied from radiotools.coordinatesystems.

Contained here to remove unnecessary methods and such that the translation from np <-> jax can be performed within here instead of re-mapping everything to jax.numpy.

In the future, a jax version of radiotools should be constructed.

class template_synthesis.jax.utilities.coordinate_transformations.cstrafo(zenith: float, azimuth: float, magnetic_field_vector: Array | ndarray | bool | number | bool | int | float | complex | None = None, site: str | None = None)

Bases: object

class to performe coordinate transformations typically used in air shower radio detection

the following transformations are implemented:

From the cartesian ground coordinate system (x: East, y: North, z: up) to
  • to the vxB-vx(vxB) system

  • to the on-sky coordinate system (spherical coordinates eR, eTheta, ePhi)

  • to a ground coordinate system where the y-axis is oriented to magnetic North (instead of geographic North)

  • to a shower plane coordinate system in which the z-axis is parallel to the shower axis and the shower axis projected on ground is in the yz-plane

and vice versa.

get_euler_angles()
get_height_in_showerplane(x, y)
transform_from_azimuth_to_geographic(positions: Array | ndarray | bool | number | bool | int | float | complex)
transform_from_geographic_to_azimuth(positions: Array | ndarray | bool | number | bool | int | float | complex)
transform_from_geographic_to_magnetic(positions: Array | ndarray | bool | number | bool | int | float | complex)
transform_from_ground_to_onsky(positions: Array | ndarray | bool | number | bool | int | float | complex)

on sky coordinates are eR, eTheta, ePhi

transform_from_magnetic_to_geographic(positions: Array | ndarray | bool | number | bool | int | float | complex)
transform_from_onsky_to_ground(positions: Array | ndarray | bool | number | bool | int | float | complex)

on sky coordinates are eR, eTheta, ePhi

transform_from_vxB_vxvxB(station_position: Array | ndarray | bool | number | bool | int | float | complex, core: Array | ndarray | bool | number | bool | int | float | complex | None = None)

transform a single station position or a list of multiple station positions back to x,y,z CS

This function is supposed to transform time traces with the shape (number of polarizations, length of trace) and a list of station positions with the shape of (length of list, 3). The function automatically differentiates between the two cases by checking the length of the second dimension. If this dimension is ‘3’, a list of station positions is assumed to be the input. Note: this logic will fail if a trace will have a shape of (3, 3), which is however unlikely to happen.

transform_from_vxB_vxvxB_2D(station_position: Array | ndarray | bool | number | bool | int | float | complex, core: Array | ndarray | bool | number | bool | int | float | complex | None = None)

transform a single station position or a list of multiple station positions back to x,y,z CS

transform_to_vxB_vxvxB(station_position: Array | ndarray | bool | number | bool | int | float | complex, core: Array | ndarray | bool | number | bool | int | float | complex | None = None)

transform a single station position or a list of multiple station positions into vxB, vxvxB shower plane

This function is supposed to transform time traces with the shape (number of polarizations, length of trace) and a list of station positions with the shape of (length of list, 3). The function automatically differentiates between the two cases by checking the length of the second dimension. If this dimension is ‘3’, a list of station positions is assumed to be the input. Note: this logic will fail if a trace will have a shape of (3, 3), which is however unlikely to happen.

template_synthesis.jax.utilities.coordinate_transformations.e_ce(traces, x, y)

Calculate the charge-excess (or Askaryan) component of electric field in the shower plane, i.e. the electric field should be in the (vxB, vxvxB, v) CS

Parameters:
traces : np.ndarray

The traces in the shower plane, shaped as (antennas, samples, polarisations)

x : float

The antenna position along the vxB axis

y : float

The antenna position along the vxvxB axis

Returns:

e_ce – The charge-excess component of the electric field

Return type:

np.ndarray

template_synthesis.jax.utilities.coordinate_transformations.e_geo(traces, x, y)

Calculate the geomagnetic component from the electric field in the shower plane, i.e. the electric field should be in the (vxB, vxvxB, v) CS

Parameters:
traces : np.ndarray

The traces in the shower plane, shaped as (antennas, samples, polarisations)

x : float

The antenna position along the vxB axis

y : float

The antenna position along the vxvxB axis

Returns:

e_geo – The geomagnetic component of the electric field

Return type:

np.ndarray

template_synthesis.jax.utilities.coordinate_transformations.e_to_geo_ce(traces, x, y)

Decompose the electric field traces into geomagnetic & charge-excess components

template_synthesis.jax.utilities.coordinate_transformations.geo_ce_to_e(traces, x, y)

Combine geomagnetic & charge-excess component of electric field to antenna E-fields

template_synthesis.jax.utilities.coordinate_transformations.get_declination(magnetic_field_vector: Array | ndarray | bool | number | bool | int | float | complex)
template_synthesis.jax.utilities.coordinate_transformations.get_magnetic_field_vector(site: str | None = None)

get the geomagnetic field vector in Gauss. x points to geographic East and y towards geographic North

template_synthesis.jax.utilities.coordinate_transformations.spherical_to_cartesian(zenith: float, azimuth: float)