Module Reference

class tabsim.dask.observation.Observation(latitude: float, longitude: float, elevation: float, ra: float, dec: float, freqs: Array, SEFD: Array, times_mjd: Array, int_time: float = 2.0, chan_width: float = 209000.0, ENU_array: Array | None = None, ENU_path: str | None = None, ITRF_array: Array | None = None, ITRF_path: str | None = None, n_ant: int | None = None, dish_d: float = 13.5, random_seed: int = 0, auto_corrs: bool = False, no_w: bool = False, n_int_samples: int = 4, tel_name: str = 'MeerKAT', target_name: str = 'unknown', max_chunk_MB: float = 100.0)[source]

Construct an Observation object defining a radio interferometry observation.

Parameters:
  • latitude (float) – Latitude of the telescope.

  • longitude (float) – Longitude of the telescope.

  • elevation (float) – Elevation of the telescope.

  • ra (float) – Right Ascension of the phase centre.

  • dec (float) – Declination of the phase centre.

  • times (ndarray (n_time,)) – Time centroids of each data point in seconds as a Greenwich Mean Sidereal Time (GMST).

  • freqs (ndarray (n_freq,)) – Frequency centroids for each observation channel in Hz.

  • SEFD (ndarray (n_freq,)) – System Equivalent Flux Density of the telescope over frequency.

  • chan_width (float) – Frequency channel width in Hz. Only used if n_freq=1, else calculated from freqs.

  • ENU_path (str) – Path to a txt file containing the ENU coordinates of each antenna.

  • ENU_array (ndarray (n_ant, 3)) – ENU coordinates of each antenna.

  • dish_d (float) – Diameter of each antenna dish.

  • random_seed (int) – Random seed to use for random number generator.

  • auto_corrs (bool) – Flag to include autocorrelations in simulation.

  • no_w (bool) – Whether to zero out the w-component of the baselines.

  • n_int_samples (int) – Number of samples per time step which are then averaged. Must be large enough to capture time-smearing of RFI sources on longest baseline.

  • tel_name (str) – Name of the telescope.

  • target_name (str) – Name fo the target field.

addAstro(I: Array, ra: Array, dec: Array)[source]

Add a set of astronomical sources to the observation.

Parameters:
  • I (ndarray (n_src, n_time, n_freq) or) – Intensity of the sources in Jy. If I.ndim==2, then this is assumed to the spectrogram (n_time, n_freq) of a single source. If I.ndim==1, then this is assumed to be the spectral profile of a single source.

  • ra (array (n_src,)) – Right ascension of the sources in degrees.

  • dec (array (n_src,)) – Declination of the sources in degrees.

addAstroExp(I: Array, shape: Array, ra: Array, dec: Array)[source]

Add a set of astronomical sources to the observation.

Parameters:
  • I (Array (n_src, n_time, n_freq) or) – Intensity of the sources in Jy. If I.ndim==2, then this is assumed to the spectrogram (n_time, n_freq) of a single source. If I.ndim==1, then this is assumed to be the spectral profile of a single source.

  • shape (array (n_src,)) – Shape of gaussian sources. Only circular gaussians accepted for now.

  • ra (array (n_src,)) – Right ascension of the sources in degrees.

  • dec (array (n_src,)) – Declination of the sources in degrees.

addAstroGauss(I: Array, major: Array, minor: Array, pos_angle: Array, ra: Array, dec: Array)[source]

Add a set of astronomical sources to the observation.

Parameters:
  • I (Array (n_src, n_time, n_freq) or) – Intensity of the sources in Jy. If I.ndim==2, then this is assumed to the spectrogram (n_time, n_freq) of a single source. If I.ndim==1, then this is assumed to be the spectral profile of a single source.

  • major (Array (n_src,)) – FWHM of major axis of sources in arcseconds.

  • major – FWHM of minor axis of sources in arcseconds.

  • pos_angle (Array (n_src,)) – Position angle of sources in degrees west of north for the major axis.

  • ra (Array (n_src,)) – Right ascension of the sources in degrees.

  • dec (Array (n_src,)) – Declination of the sources in degrees.

addGains(G0_mean: float, G0_std: float, Gt_std_amp: float, Gt_std_phase: float, Gt_corr_amp: float, Gt_corr_phase: float, random_seed=None)[source]

Add complex antenna gains to the simulation. Gain amplitudes and phases are modelled as linear time-variates. Gains for all antennas at t = 0 are randomly sampled from a Gaussian described by the G0 parameters. The rate of change of both ampltudes and phases are sampled from a zero mean Gaussian with standard deviation as provided.

Parameters:
  • G0_mean (float) – Mean of Gaussian at t = 0.

  • G0_std (float) – Standard deviation of Gaussian at t = 0.

  • Gt_std_amp (float) – Standard deviation of Gaussian describing the rate of change in the gain amplitudes in 1/seconds.

  • Gt_std_phase (float) – Standard deviation of Gaussian describing the rate of change in the gain phases in rad/seconds.

  • random_seed (int, optional) – Random number generator key.

addSatelliteRFI(Pv: Array, elevation: Array, inclination: Array, lon_asc_node: Array, periapsis: Array)[source]

Add a satellite-based source of RFI to the observation.

Parameters:
  • Pv (ndarray (n_src, n_time_fine, n_freq)) – Specific Emission Power in W/Hz. If Pv.ndim==1, it is assumed to be of shape (n_freq,) and is the spectrum of a single RFI source. If Pv.ndim==2, it is assumed to be of shape (n_time_fine, n_freq) and is the spectrogram of a single RFI source.

  • elevation (ndarray (n_src,)) – Elevation/Altitude of the orbit in metres.

  • inclination (ndarray (n_src,)) – Inclination angle of the orbit relative to the equatorial plane.

  • lon_asc_node (ndarray (n_src,)) – Longitude of the ascending node of the orbit. This is the longitude of when the orbit crosses the equator from the south to the north.

  • periapsis (ndarray (n_src,)) – Perisapsis of the orbit. This is the angular starting point of the orbit at t = 0.

addStationaryRFI(Pv: Array, latitude: Array, longitude: Array, elevation: Array)[source]

Add a stationary source of RFI to the observation.

Parameters:
  • Pv (ndarray (n_src, n_time_fine, n_freq)) – Specific Emission Power in W/Hz. If Pv.ndim==1, it is assumed to be of shape (n_freq,) and is the spectrum of a single RFI source. If Pv.ndim==2, it is assumed to be of shape (n_time_fine, n_freq) and is the spectrogram of a single RFI source.

  • latitude (ndarray (n_src,)) – Geopgraphic latitude of the source in degrees.

  • longitude (ndarray (n_src,)) – Geographic longitude of the source in degrees.

  • elevation (ndarray (n_src,)) – Elevation/Altitude of the source above sea level in metres.

addTLESatelliteRFI(Pv: Array, norad_ids: list[int], tles: Array)[source]

Add a satellite-based source of RFI to the observation.

Parameters:
  • Pv (ndarray (n_src, n_time_fine, n_freq)) – Specific Emission Power in W/Hz. If Pv.ndim==1, it is assumed to be of shape (n_freq,) and is the spectrum of a single RFI source. If Pv.ndim==2, it is assumed to be of shape (n_time_fine, n_freq) and is the spectrogram of a single RFI source.

  • norad_ids (list[int] (n_src,)) – NORAD IDs for the satellites to include.

  • tles (Array (n_src, 2)) – TLEs of the satellites corresponding to the NORAD IDs.

calculate_vis(flags: bool = True, random_seed=None)[source]

Calculate the total gain amplified visibilities, average down to the originally defined sampling rate and add noise.

create_source_dicts()[source]
write_to_ms(path: str = 'Observation.ms', overwrite: bool = False, ds: Dataset | None = None)[source]

Write the visibilities to disk using Measurement Set format.

write_to_zarr(path: str = 'Observation', overwrite: bool = False)[source]

Write the visibilities to disk using zarr format.

class tabsim.dask.observation.Telescope(latitude: float, longitude: float, elevation: float = 0.0, ENU_array: Array | None = None, ENU_path: str | None = None, ITRF_array: Array | None = None, ITRF_path: str | None = None, tel_name: str | None = None, n_ant: int | None = None)[source]

Construct an Observation object defining a radio interferometry observation.

Parameters:
  • latitude (float) – Latitude of the telescope.

  • longitude (float) – Longitude of the telescope.

  • elevation (float) – Elevation of the telescope.

  • ENU_path (str) – Path to a txt file containing the ENU coordinates of each antenna.

  • ENU_array (ndarray (n_ant, 3)) – ENU coordinates of each antenna.

  • name (str) – Name of the telescope.

createArrayENU(ENU_array=None, ENU_path=None)[source]
createArrayITRF(ITRF_array, ITRF_path)[source]
tabsim.jax.coordinates.ENU_to_GEO(geo_ref: Array, enu: Array) Array[source]

Convert a set of points in ENU co-ordinates to geographic coordinates i.e. (latitude, longitude, elevation).

Parameters:
  • geo_ref (ndarray (3,)) – The latitude, longitude and elevation, (lat,lon,elevation), of the reference position i.e. ENU = (0,0,0).

  • enu (ndarray (n_ants, 3)) – The ENU coordinates of each antenna. (East, North, Up).

Returns:

geo_ants – The geographic coordinates, (lat,lon,elevation), of each antenna.

Return type:

ndarray (n_ant, 3)

tabsim.jax.coordinates.GEO_to_XYZ(geo: Array, times: Array) Array[source]

Convert geographic coordinates to an Earth Centred Inertial (ECI) coordinate frame. This is different to ECEF as ECI remains fixed with the celestial sphere whereas ECEF coordinates rotate w.r.t. the celestial sphere. (0,0,0) is the Earth’s centre of mass, +z points to the North Pole and +x is in the plane of the Equator passing through the Meridian at t = 0 and +y is also in the plane of the Equator and passes through 90 degrees East at t = 0. ECEF and ECI are aligned when t % T_s = 0.

Parameters:
  • geo (ndarray (n_time, 3)) – The geographic coordinates, (lat,lon,elevation), at each point in time.

  • times (ndarray (n_time,)) – The time of each position in seconds.

Returns:

xyz – The ECI coordinates at each time, (lat,lon,elevation), of each antenna.

Return type:

ndarray (n_time, 3)

tabsim.jax.coordinates.GEO_to_XYZ_vmap0(geo: Array, times: Array) Array[source]

Convert geographic coordinates to an Earth Centred Inertial (ECI) coordinate frame. This is different to ECEF as ECI remains fixed with the celestial sphere whereas ECEF coordinates rotate w.r.t. the celestial sphere. (0,0,0) is the Earth’s centre of mass, +z points to the North Pole and +x is in the plane of the Equator passing through the Meridian at t = 0 and +y is also in the plane of the Equator and passes through 90 degrees East at t = 0. ECEF and ECI are aligned when t % T_s = 0.

Parameters:
  • geo (ndarray (n_src, n_time, 3)) – The geographic coordinates, (lat,lon,elevation), at each point in time.

  • times (ndarray (n_time,)) – The time of each position in seconds.

Returns:

xyz – The ECI coordinates at each time, (lat,lon,elevation), of each antenna.

Return type:

ndarray (n_src, n_time, 3)

tabsim.jax.coordinates.GEO_to_XYZ_vmap1(geo: Array, times: Array) Array[source]

Convert geographic coordinates to an Earth Centred Inertial (ECI) coordinate frame. This is different to ECEF as ECI remains fixed with the celestial sphere whereas ECEF coordinates rotate w.r.t. the celestial sphere. (0,0,0) is the Earth’s centre of mass, +z points to the North Pole and +x is in the plane of the Equator passing through the Meridian at t = 0 and +y is also in the plane of the Equator and passes through 90 degrees East at t = 0. ECEF and ECI are aligned when t % T_s = 0.

Parameters:
  • geo (ndarray (n_time, n_ant, 3)) – The geographic coordinates, (lat,lon,elevation), at each point in time.

  • times (ndarray (n_time,)) – The time of each position in seconds.

Returns:

xyz – The ECI coordinates at each time, (lat,lon,elevation), of each antenna.

Return type:

ndarray (n_time, n_ant, 3)

tabsim.jax.coordinates.RIC_dev(times: Array, true_orbit_params: Array, estimated_orbit_params: Array) Array[source]

Calculate the Radial (R), In-track (I) and Cross-track (C) deviations between two circular orbits given their orbit parameters at many time steps.

Parameters:
  • times (array (n_time,)) – Times at which to evaluate the RIC deviations.

  • true_orb_params (ndarray (4,)) – Orbit parameters (elevation, inclination, lon_asc_node, periapsis) of the object of most interest. The more accurate measurement when comparing the same object.

  • est_orb_params (array (elevation, inclination, lon_asc_node, periapsis)) – Estimated orbit parameters.

Returns:

RIC – Radial, In-track and Cross-track coordinates, in metres, of the orbiting body relative to the orbit defined by ‘true_orbit_params’.

Return type:

ndarray (n_time, 3)

tabsim.jax.coordinates.R_uvw(times_jd: Array, epoch_jd: float, elements: Array) Array[source]

Calculate the rotation matrices at each time step to transform from an Earth centric reference frame (ECI) to a satellite centric frame given the parameters of its (circular) orbit.

Parameters:
  • times (ndarray (n_time,)) – Times at which to evaluate the rotation matrices.

  • elevation (float) – Elevation/Altitude of the orbit in metres.

  • inclination (float) – Inclination angle of the orbit relative to the equatorial plane.

  • lon_asc_node (float) – Longitude of the ascending node of the orbit. This is the longitude of when the orbit crosses the equator from the south to the north.

  • periapsis (float) – Perisapsis of the orbit. This is the angular starting point of the orbit at t = 0.

Returns:

R – The rotation matrix to orient to a satellite centric (RIC) frame defined by the Radial, In-track, Cross-track components.

Return type:

ndarray (3, 3)

tabsim.jax.coordinates.R_x(angle)[source]
tabsim.jax.coordinates.R_z(angle)[source]
tabsim.jax.coordinates.Rotx(theta: float) Array[source]

Define a rotation matrix about the ‘x-axis’ by an angle theta, in degrees.

Parameters:

theta (float) – Rotation angle in degrees.

Returns:

R – Rotation matrix.

Return type:

ndarray (3, 3)

tabsim.jax.coordinates.Rotz(theta: float) Array[source]

Define a rotation matrix about the ‘z-axis’ by an angle theta, in degrees.

Parameters:

theta (float) – Rotation angle in degrees.

Returns:

R – Rotation matrix.

Return type:

ndarray (3, 3)

tabsim.jax.coordinates.alt_az_of_source(lsa: Array, lat: float, ra: float, dec: float) Array[source]

Calculate the altitude and azimuth of a given source direction over time. Taken from https://astronomy.stackexchange.com/questions/14492/need-simple-equation-for-rise-transit-and-set-time

Parameters:
  • lst (Array (n_time,)) – Local sidereal angle in degrees.

  • lat (float) – Latitude of the observer in degrees.

  • ra (float) – Right ascension of the source in degrees.

  • dec (float) – DEclination of the source in degrees.

Returns:

Altitude and azimuth of the source in degrees relative to the observer.

Return type:

Array (n_time, 2)

tabsim.jax.coordinates.angular_separation(rfi_xyz: Array, ants_xyz: Array, ra: float, dec: float) Array[source]

Calculate the angular separation between the pointing direction of each antenna and the satellite source.

Parameters:
  • rfi_xyz (ndarray (n_src, n_time, 3)) – Position of the RFI sources in ECEF reference frame over time. This is the same frame as ants_xyz.

  • ants_xyz (ndarray (n_time, n_ant, 3)) – Position of the antennas in ECEF reference frame over time.

  • ra (float) – Right ascension of the pointing in decimal degrees.

  • dec (float) – Declination of the pointing in decimal degrees.

Returns:

angles – Angular separation (in degrees) between the pointing direction and RFI source for each antenna.

Return type:

ndarray (n_src, n_time, n_ant)

tabsim.jax.coordinates.calculate_fringe_frequency(times_mjd: Array, freq: float, rfi_xyz: Array, ants_itrf: Array, ants_u: Array, dec: float) Array[source]

Calculate the fringe frequency of an RFI source.

Parameters:
  • times_mjd (Array (n_time,)) – Times are which the RFI and antenna positions are given in Modified Julian Date.

  • freq (float) – Observational frequency in Hz.

  • rfi_xyz (Array (n_time, 3)) – Position of the RFI source in the ECI frame in metres.

  • ants_itrf (Array (n_ant, 3)) – Antenna positions in the ITRF (ECEF) frame in metres.

  • ants_u (Array (n_time, n_ant)) – U component of the antennas in UVW frame in metres.

  • dec (float) – Phase centre declination in degrees.

Returns:

Fringe frequencies on each baseline.

Return type:

Array (n_time, n_bl)

tabsim.jax.coordinates.calculate_sat_corr_time(sat_xyz: Array, ants_xyz: Array, orbit_el: float, lat: float, dish_d: float, freqs: Array) float[source]

Calculate the expected correlation time for a Gaussian process model of the RFI signal due to a satellite moving through the sidelobes of the primary beam.

Parameters:
  • rfi_xyz (Array (n_time, 3)) – Position of the RFI source over time in metres

  • ants_xyz (Array (n_time, n_ant, 3)) – Positions of the antennas over time in metres.

  • orbit_el (float) – Orbit elevation in metres.

  • lat (float) – Latitude of the antennas in degrees.

  • dish_d (float) – Dish diameter in metres. The primary beam is modelled by an Airy disk based on this.

  • freqs (Array (n_freq,)) – Observational frequencies in Hz.

Returns:

Expected minimum correlation time in seconds.

Return type:

float

tabsim.jax.coordinates.days_to_secs(days)[source]
tabsim.jax.coordinates.earth_radius(lat: float) float[source]

Calculate the earth radius according to the ellipsoidal model at a given latitude.

Parameters:

lat (float) – Latitude of the location in degrees.

Returns:

Earth radius in metres at the given latitude.

Return type:

float

tabsim.jax.coordinates.enu_to_itrf(enu: Array, lat: float, lon: float, el: float) Array[source]

Calculate ITRF coordinates from ENU coordinates of antennas given the latitude and longitude of the antenna array centre.

Paramters

enu: Array (n_ant, 3)

The East, North, Up coordinates of each antenna.

lat: float

The latitude of the observer/telescope.

lon: float

The longitude of the observer/telescope.

el: float

The elevation of the observer/telescope.

returns:

itrf – The ITRF coordinates of the antennas.

rtype:

Array (n_ant, 3)

tabsim.jax.coordinates.enu_to_xyz_local(enu, lat)[source]

https://web.njit.edu/~gary/728/Lecture6.html

tabsim.jax.coordinates.equation_of_equinoxes(mjd: float) float[source]

Taken from OSKAR simulator

tabsim.jax.coordinates.gmsa_from_jd(jd: float) float[source]

Get the Greenwich Mean Sidereal Angle in degrees from the Julian Day (UT1). Calculated using https://aa.usno.navy.mil/faq/GAST

Parameters:

jd (float) – Julian Day (UT1).

Returns:

Greenwich Mean Sidereal Angle in degrees.

Return type:

float

tabsim.jax.coordinates.itrf_to_geo(itrf: Array) Array[source]

Convert ITRF coordinates to geodetic coordinates.

Parameters:

itrf (Array (n_ant, 3)) – ITRF coordinates.

Returns:

Geodetic coordinates (latitude, longitude, elevation)

Return type:

Array (n_ant, 3)

tabsim.jax.coordinates.itrf_to_uvw(itrf: Array, h0: Array, dec: float) Array[source]

Calculate uvw coordinates from ITRF/ECEF coordinates, source hour angle and declination. Use the Greenwich hour angle when using true ITRF coordinates such as those produced with ‘enu_to_itrf’ or provided in an MS file. Use local hour angle when using local ‘xyz’ coordinates as defined in most radio interferometry textbooks or those produced with ‘enu_to_xyz_local’.

Parameters:
  • ITRF (Array (n_ant, 3)) – Antenna positions in the ITRF frame in units of metres.

  • h0 (Array (n_time,)) – The hour angle of the target in decimal degrees.

  • dec (float) – The declination of the target in decimal degrees.

Returns:

uvw – The uvw coordinates of the antennas for a given observer location, time and target (ra,dec).

Return type:

Array (n_time, n_ant, 3)

tabsim.jax.coordinates.itrf_to_xyz(itrf: Array, gsa: Array) Array[source]

Transform coordinates from the ITRF (ECEF) frame to an ECI frame that aligns with the celestial sphere.

Parameters:
  • itrf (Array (n_ant, 3)) – ITRF coordinates in metres.

  • gsa (Array (n_time,)) – Greenwich sidereal angle in degrees.

Returns:

ECI coordinates in metres.

Return type:

Array (n_time, n_ant, 3)

tabsim.jax.coordinates.jd_from_gmst(gmst: float) float[source]

Get the Julian Date (UT1) from the Greenwich Mean Sidereal Time in seconds.

Parameters:

gmst (float) – Greenwich Mean Sidereal Time in seconds.

Returns:

Julian Date (UT1).

Return type:

float

tabsim.jax.coordinates.jd_to_mjd(jd)[source]
tabsim.jax.coordinates.kepler_RIC_dev(times_jd: Array, epoch_jd: float, true_elements: Array, estimated_elements: Array) Array[source]

Calculate the Radial (R), In-track (I) and Cross-track (C) deviations between two circular orbits given their orbit parameters at many time steps.

Parameters:
  • times (array (n_time,)) – Times at which to evaluate the RIC deviations.

  • true_orb_params (ndarray (4,)) – Orbit parameters (elevation, inclination, lon_asc_node, periapsis) of the object of most interest. The more accurate measurement when comparing the same object.

  • est_orb_params (array (elevation, inclination, lon_asc_node, periapsis)) – Estimated orbit parameters.

Returns:

RIC – Radial, In-track and Cross-track coordinates, in metres, of the orbiting body relative to the orbit defined by ‘true_orbit_params’.

Return type:

ndarray (n_time, 3)

tabsim.jax.coordinates.kepler_orbit(times, t_epoch, params)[source]

Compute orbit position over time for a single satellite.

times: (T,) params: (6,) = [a, e, i, Ω, ω, M0] Returns: (T, 3)

tabsim.jax.coordinates.kepler_orbit_fisher(times_jd: Array, epoch_jd: float, elements: Array, RIC_std: Array) Array[source]

Calculate the inverse covariance (Fisher) matrix in orbital elements induced by errors in the RIC frame of an orbiting object. This is essentially linear uncertainty propagation assuming Gaussian errors.

Parameters:
  • times (ndarray (n_time,)) – Times at which the RIC covariance/standard deviations is defined.

  • orbit_params (ndarray (4,)) – Orbit parameters (elevation, inclination, lon_asc_node, periapsis) for the orbit defining the origin of the RIC frame.

  • RIC_std (ndarray (3,)) – The standard deviation in the Radial, In-track and Cross-track directions.

Returns:

fisher – The inverse covariance (Fisher) matrix for the orbit parameters induced by the orbit uncertainties in the RIC frame.

Return type:

ndarray (6, 6)

tabsim.jax.coordinates.kepler_orbit_many(times_jd: Array, epoch_jd: Array, elements: Array)[source]

Propagate Keplerian orbits for a set of satellites using orbital elements as defined in a TLE.

Parameters:
  • times_jd (Array (n_time,)) – Propagation times in Julian Date.

  • epoch_jd (Array (n_sat,)) – Epoch of the TLE in Julian Date.

  • semi_major (Array (n_sat,)) – Semi major axis of the orbit in km.

  • eccentricity (Array (n_sat,)) – Eccentricity of the orbit.

  • inclination (Array (n_sat,)) – Inclination of the orbit in degrees.

  • ra_of_asc_node (Array (n_sat,)) – Right ascension of the ascending node in degrees.

  • arg_of_peri (Array (n_sat,)) – Argument of the pericentre in degrees.

  • mean_anomaly (Array (n_sat,)) – Mean anomaly of the orbit at the epoch time in degrees.

tabsim.jax.coordinates.kepler_orbit_velocity(times_jd: Array, epoch_jd: float, elements: Array) Array[source]
tabsim.jax.coordinates.lst_deg2sec(lst: Array) Array[source]

Convert a sidereal time in degrees to seconds.

Parameters:

lst (Array) – Sidereal time in degrees to convert.

Returns:

Sidereal time in seconds.

Return type:

Array

tabsim.jax.coordinates.lst_sec2deg(lst: Array) Array[source]

Convert a sidereal time from seconds to degrees.

Parameters:

lst (Array) – Sidereal time in seconds to convert.

Returns:

Sidereal time in degrees.

Return type:

Array

tabsim.jax.coordinates.mjd_to_gast(mjd: float) float[source]

Taken from OSKAR simulator

tabsim.jax.coordinates.mjd_to_gmst(mjd: float) float[source]

Taken from OSKAR simulator

tabsim.jax.coordinates.mjd_to_jd(mjd)[source]
tabsim.jax.coordinates.orbit(times: Array, elevation: float, inclination: float, lon_asc_node: float, periapsis: float) Array[source]

Calculate orbital path of a satellite in perfect circular orbit.

Parameters:
  • times (ndarray (n_time,)) – Times at which to evaluate the positions.

  • elevation (float) – Elevation/Altitude of the orbit in metres.

  • inclination (float) – Inclination angle of the orbit relative to the equatorial plane.

  • lon_asc_node (float) – Longitude of the ascending node of the orbit. This is the longitude of when the orbit crosses the equator from the south to the north.

  • periapsis (float) – Perisapsis of the orbit. This is the angular starting point of the orbit at t = 0.

Returns:

positions – The position vector of the orbiting object at each specified time.

Return type:

ndarray (n_time, 3)

tabsim.jax.coordinates.orbit_fisher(times: Array, orbit_params: Array, RIC_std: Array) Array[source]

Calculate the inverse covariance (Fisher) matrix in orbital elements induced by errors in the RIC frame of an orbiting object. This is essentially linear uncertainty propagation assuming Gaussian errors.

Parameters:
  • times (ndarray (n_time,)) – Times at which the RIC covariance/standard deviations is defined.

  • orbit_params (ndarray (4,)) – Orbit parameters (elevation, inclination, lon_asc_node, periapsis) for the orbit defining the origin of the RIC frame.

  • RIC_std (ndarray (3,)) – The standard deviation in the Radial, In-track and Cross-track directions.

Returns:

fisher – The inverse covariance (Fisher) matrix for the orbit parameters induced by the orbit uncertainties in the RIC frame.

Return type:

ndarray (4, 4)

tabsim.jax.coordinates.orbit_velocity(times: Array, elevation: float, inclination: float, lon_asc_node: float, periapsis: float) Array[source]

Calculate the velocity of a circular orbit at specific times.

Parameters:
  • times (ndarray (n_time,)) – Times at which to evaluate the rotation matrices.

  • elevation (float) – Elevation/Altitude of the orbit in metres.

  • inclination (float) – Inclination angle of the orbit relative to the equatorial plane.

  • lon_asc_node (float) – Longitude of the ascending node of the orbit. This is the longitude of when the orbit crosses the equator from the south to the north.

  • periapsis (float) – Perisapsis of the orbit. This is the angular starting point of the orbit at t = 0.

Returns:

velocity – The velocity vector at the specified times.

Return type:

ndarray (n_time, 3)

tabsim.jax.coordinates.orbit_vmap(times: Array, elevation: Array, inclination: Array, lon_asc_node: Array, periapsis: Array) Array[source]

Calculate orbital path of a satellite in perfect circular orbit.

Parameters:
  • times (ndarray (n_time,)) – Times at which to evaluate the positions.

  • elevation (nd_array (n_orbits,)) – Elevation/Altitude of the orbit in metres.

  • inclination (nd_array (n_orbits,)) – Inclination angle of the orbit relative to the equatorial plane.

  • lon_asc_node (nd_array (n_orbits,)) – Longitude of the ascending node of the orbit. This is the longitude of when the orbit crosses the equator from the south to the north.

  • periapsis (nd_array (n_orbits,)) – Perisapsis of the orbit. This is the angular starting point of the orbit at t = 0.

Returns:

positions – The position vectors of the orbiting objects at each specified time.

Return type:

ndarray (n_orbits, n_time, 3)

tabsim.jax.coordinates.radec_to_XYZ(ra: Array, dec: Array) Array[source]

Convert Right ascension and Declination to unit vector in ECI coordinates.

Parameters:
  • ra (ndarray (n_src,)) – Right-ascension in degrees.

  • dec (ndarray (n_src,)) – Declination in degrees.

Returns:

xyz – The ECI coordinate unit vector of each source.

Return type:

ndarray (n_src, 3) or (3,)

tabsim.jax.coordinates.radec_to_lmn(ra: Array, dec: Array, phase_centre: Array) Array[source]

Convert right-ascension and declination positions of a set of sources to direction cosines.

Parameters:
  • ra (ndarray (n_src,)) – Right-ascension in degrees.

  • dec (ndarray (n_src,)) – Declination in degrees.

  • phase_centre (ndarray (2,)) – The ra and dec coordinates of the phase centre in degrees.

Returns:

lmn – The direction cosines, (l,m,n), coordinates of each source.

Return type:

ndarray (n_src, 3)

tabsim.jax.coordinates.rise_and_set_of_source(lat: float, ra: float, dec: float) Array[source]
tabsim.jax.coordinates.secs_to_days(seconds)[source]
tabsim.jax.coordinates.solve_kepler(M, e, max_iter=100)[source]

Newton-Raphson solver for Kepler’s equation.

tabsim.jax.coordinates.time_above_horizon(lat: float, dec: float) float[source]

The number of degrees an object is above the horizon in a given day.

tabsim.jax.coordinates.transit_altitude(lat: float, dec: float) float[source]

Calculate the altitude of a source at transit given an observer’s latitude.

Parameters:
  • lat (float) – Latitude of the observer in degrees.

  • dec (float) – Declination of the source in degrees.

Returns:

Altitude of the source at transit in degrees.

Return type:

float

tabsim.jax.coordinates.xyz_to_itrf(xyz: Array, gsa: Array) Array[source]

Transform coordinates from the ECI frame to the ITRF (ECEF) frame that is fixed with the Earth.

Parameters:
  • xyz (Array (n_time, 3)) – ECI coordinates in metres.

  • gsa (Array (n_time,)) – Greenwich sidereal time in degrees.

Returns:

ITRF (ECEF) coordinates in metres.

Return type:

Array (n_time, 3)

tabsim.jax.interferometry.Pv_to_Sv(Pv: Array, d: Array) Array[source]

Convert emission power to received intensity in Jy. Assumes constant power across the bandwidth.

Parameters:
  • Pv (ndarray (n_src, n_time, n_freq)) – Specific emission power in W/Hz.

  • d (ndarray (n_src, n_time, n_ant)) – Distances from source to receiving antennas in m.

Returns:

Sv – Spectral flux density at the receiving antennas in Jy.

Return type:

ndarray (n_src, n_time, n_ant, n_freq)

tabsim.jax.interferometry.SEFD_to_noise_std(SEFD: Array, chan_width: Array, int_time: Array)[source]

Calculate the standard deviation of the complex noise in a visibility given the system equivalent flux density, the channel width and integration time.

Parameters:
  • SEFD (ndarray (n_freq, )) – System equivalent flux density in Jy.

  • chan_width (ndarray (n_time, n_ant, n_freq)) – Channel width in Hz.

  • int_time (float) – Integration time in seconds.

Returns:

noise_std – Standard deviation of the complex noise in a visibility.

Return type:

ndarray (n_time, n_ant, n_freq)

tabsim.jax.interferometry.add_noise(vis: Array, noise_std: Array, key: Array)[source]

Add complex gaussian noise to the integrated visibilities. The real and imaginary components will each get this level of noise.

Parameters:
  • vis (ndarray (n_time, n_bl, n_freq)) – The visibilities to add noise to.

  • noise_std ((n_freq, )) – Standard deviation of the complex noise.

  • key (jax.random.PRNGKey) – Random number generator key.

tabsim.jax.interferometry.airy_beam(theta: Array, freqs: Array, dish_d: float)[source]

Calculate the primary beam voltage at a given angular distance from the pointing direction. The beam intensity model is the Airy disk as defined by the dish diameter. This is the same a the CASA default.

Parameters:
  • theta ((n_src, n_time, n_ant)) – The angular separation (in degrees) between the pointing direction and the source.

  • freqs ((n_freq,)) – The frequencies at which to calculate the beam in Hz.

  • dish_d (float) – The diameter of the dish in meters.

Returns:

E – The beam voltage at each frequency.

Return type:

ndarray (n_src, n_time, n_ant, n_freq)

tabsim.jax.interferometry.amp_to_intensity(amps, a1, a2)[source]

Calculate intensity on a baseline ffrom the amplitudes at each antenna.

Parameters:
  • amps (jnp.ndarray) – Amplitudes at the antennas. (n_src, n_time, n_int, n_ant, n_freq)

  • a1 (jnp.ndarray) – Antenna 1 indexes, between 0 and n_ant-1. (n_bl,)

  • a2 (jnp.ndarray) – Antenna 2 indexes, between 0 and n_ant-1. (n_bl,)

Returns:

Intensity on baselines.

Return type:

jnp.ndarray

tabsim.jax.interferometry.ants_to_bl(G, a1, a2)[source]

Calculate the complex gains for each baseline given the per antenna gains.

Parameters:
  • G (array_like (n_time, n_ant, n_freq)) – Complex gains at each antenna over time.

  • a1 (array_like (n_bl,)) – Antenna 1 indexes, between 0 and n_ant-1.

  • a2 (array_like (n_bl,)) – Antenna 2 indexes, between 0 and n_ant-1.

Returns:

G_bl – Complex gains on each baseline over time.

Return type:

array_like (n_time, n_bl, n_freq)

tabsim.jax.interferometry.apply_gains(vis_ast: Array, vis_rfi: Array, gains: Array, a1: Array, a2: Array)[source]

Apply antenna gains to visibilities.

Parameters:
  • vis_ast (ndarray (n_time, n_bl, n_freq)) – The astronomical visibilities.

  • vis_rfi (ndarray (n_time, n_bl, n_freq)) – The RFI visibilities.

  • gains (ndarray (n_time, n_ant, n_freq)) – The antenna gains.

  • a1 (ndarray (n_bl,)) – The first antenna index for each baseline.

  • a2 (ndarray (n_bl,)) – The second antenna index for each baseline.

Returns:

vis_obs – The visibilities with gains applied.

Return type:

ndarray (n_time, n_bl, n_freq)

tabsim.jax.interferometry.astro_vis(sources, uvw, lmn, freqs)[source]

Calculate visibilities from a set of point sources using DFT.

Parameters:
  • sources (array_like (n_src, n_time, n_freq)) – Array of point source intensities in Jy.

  • uvw (array_like (ntime, n_bl, 3)) – (u,v,w) coordinates of each baseline.

  • lmn (array_like (n_src, 3)) – (l,m,n) coordinate of each source.

  • freqs (array_like (n_freq,)) – Frequencies in Hz.

Returns:

vis – Visibilities of the given set of sources and baselines.

Return type:

array_like (n_time, n_bl, n_freq)

tabsim.jax.interferometry.astro_vis_exp(sources, shapes, uvw, lmn, freqs)[source]

Calculate visibilities from a set of point sources using DFT.

Parameters:
  • sources (array_like (n_src, n_time, n_freq)) – Array of point source intensities in Jy.

  • shapes (array_like (n_src,)) – Array of standard deviations of the gaussian shape sources. These are assumed to be circular gaussians for now.

  • uvw (array_like (ntime, n_bl, 3)) – (u,v,w) coordinates of each baseline.

  • lmn (array_like (n_src, 3)) – (l,m,n) coordinate of each source.

  • freqs (array_like (n_freq,)) – Frequencies in Hz.

Returns:

vis – Visibilities of the given set of sources and baselines.

Return type:

array_like (n_time, n_bl, n_freq)

tabsim.jax.interferometry.astro_vis_gauss(sources, major, minor, pos_angle, uvw, lmn, freqs)[source]

Calculate visibilities from a set of point sources using DFT.

Parameters:
  • sources (array_like (n_src, n_time, n_freq)) – Array of point source intensities in Jy.

  • shapes (array_like (n_src,)) – Array of standard deviations of the gaussian shape sources. These are assumed to be circular gaussians for now.

  • uvw (array_like (ntime, n_bl, 3)) – (u,v,w) coordinates of each baseline.

  • lmn (array_like (n_src, 3)) – (l,m,n) coordinate of each source.

  • freqs (array_like (n_freq,)) – Frequencies in Hz.

Returns:

vis – Visibilities of the given set of sources and baselines.

Return type:

array_like (n_time, n_bl, n_freq)

tabsim.jax.interferometry.db_to_lin(dB: float)[source]

Convert deciBels to linear units.

Parameters:

dB (float, ndarray) – deciBel value to convert.

Returns:

lin

Return type:

float, ndarray

tabsim.jax.interferometry.exp_uv(uvw, shapes, freqs)[source]
tabsim.jax.interferometry.gauss(uvw, shapes, freqs)[source]
tabsim.jax.interferometry.gauss_lm(l, m, a, b, c)[source]
tabsim.jax.interferometry.gauss_uv(uvw, major, minor, pos_a, freqs)[source]
tabsim.jax.interferometry.generate_gains(G0_mean: complex, G0_std: float, Gt_std_amp: float, Gt_std_phase: float, times: Array, n_ant: int, n_freq: int, key: Array)[source]

Generate complex antenna gains. Gain amplitudes and phases are modelled as linear time-variates. Gains for all antennas at t = 0 are randomly sampled from a Gaussian described by the G0 parameters. The rate of change of both ampltudes and phases are sampled from a zero mean Gaussian with standard deviation as provided.

Parameters:
  • G0_mean (complex) – Mean of Gaussian at t = 0.

  • G0_std (float) – Standard deviation of Gaussian at t = 0.

  • Gt_std_amp (float) – Standard deviation of Gaussian describing the rate of change in the gain amplitudes in 1/seconds.

  • Gt_std_phase (float) – Standard deviation of Gaussian describing the rate of change in the gain phases in rad/seconds.

  • key (jax.random.PRNGKey) – Random number generator key.

tabsim.jax.interferometry.int_sample_times(times: Array, n_int_samples: int = 1)[source]

Calculate the times at which to sample the visibilities given the time centroids. This shoudl produce n_int_samples times per integration time that are evenly spaced around the time centroid.

Parameters:
  • times (ndarray (n_time, )) – The time centroids at which to sample the visibilities.

  • n_int_samples (int) – The number of samples to take per integration time.

Returns:

times_fine – The times at which to sample the visibilities.

Return type:

ndarray (n_time * n_int_samples, )

tabsim.jax.interferometry.minus_two_pi_over_lamda(freqs)[source]

Calculate -2pi/lambda for each frequency.

Parameters:

freqs (jnp.ndarray) – Frequencies in Hz. (n_freq,)

Returns:

-2pi/lambda for each frequency. (n_freq,)

Return type:

jnp.ndarray

tabsim.jax.interferometry.phase_from_distances(distances, a1, a2, freqs)[source]

Calculate phase differences between antennas from distances.

Parameters:
  • distances (jnp.ndarray) – Distances to antennas. (n_src, n_time, n_int, n_ant)

  • a1 (jnp.ndarray) – Antenna 1 indexes, between 0 and n_ant-1. (n_bl,)

  • a2 (jnp.ndarray) – Antenna 2 indexes, between 0 and n_ant-1. (n_bl,)

  • freqs (jnp.ndarray) – Frequencies in Hz. (n_freq,)

Returns:

Phases on baselines.

Return type:

jnp.ndarray

tabsim.jax.interferometry.rfi_vis(app_amplitude, c_distances, freqs, a1, a2)[source]

Calculate visibilities from distances to rfi sources.

Parameters:
  • app_amplitude (array_like (n_src, n_time, n_ant, n_freq)) – Apparent amplitude at the antennas.

  • c_distances (array_like (n_src, n_time, n_ant)) – The phase corrected distances between the rfi sources and the antennas in metres.

  • freqs (array_like (n_freq,)) – Frequencies in Hz.

  • a1 (array_like (n_bl,)) – Antenna 1 indexes, between 0 and n_ant-1.

  • a2 (array_like (n_bl,)) – Antenna 2 indexes, between 0 and n_ant-1.

Returns:

vis – The visibilities.

Return type:

array_like (n_time, n_bl, n_freq)

tabsim.jax.interferometry.source_to_abc(major, minor, pa)[source]

Calculate the coefficients of the quadratic for a Gaussian source.

tabsim.jax.interferometry.time_avg(vis: Array, n_int_samples: int = 1)[source]

Average visibilities in time.

Parameters:
  • vis (ndarray (n_time_fine, n_bl, n_freq)) – The visibilities to average in time.

  • n_int_samples (int) – The number of samples to take per integration time.

Returns:

vis_avg – The averaged visibilities.

Return type:

ndarray (n_time, n_bl, n_freq)