dreambeam.rime package

Submodules

dreambeam.rime.conversion_utils module

Functions for converting between astronomical reference frames, etc.

dreambeam.rime.conversion_utils.CEL2TOPOpnts(obsTimes, stnPos, celPnt)[source]
dreambeam.rime.conversion_utils.IAU_pol_basis(src_az, src_el)[source]

Compute the (x_hat, y_hat, z_hat) basis in IAU polarization system for a direction given by (azimuth, elevation) tuple typically Ra, Dec.

dreambeam.rime.conversion_utils.basis2basis_transf(basis_from, basis_to)[source]

Compute tranform matrix between two bases.

The basis matrices are assumed to be in the last two axes, and that the component vector is summed over the last index (i.e. applied to basis matrix from the left).

Parameters:
  • basis_from (array) – The basis matrices that wishes to transform from. Matrices reside in last two axes.
  • basis_to (array) – The basis matrices that wishes to transform to. Matrices reside in last two axes.
Returns:

The transformation matrix.

Return type:

array

Notes

Given some coord sys, and two bases, any vector must be equal in these two bases:

basis_to . v_to = basis_from . v_from

where ‘.’ stands from matrix vector multiplication. So the transformation from the ‘from’ system to the ‘to’ is

v_to = basis_to^H . basis_from . v_from = T . v_from

where ‘^H’ stands for hermitian transpose and

T = basis_to^H . basis_from

is the transformation matrix that is returned.

dreambeam.rime.conversion_utils.computeParaMat_me(rfFrom, rfTo, aDir_me, me)[source]

Compute parallactic rotation matrix. me contains epoch

dreambeam.rime.conversion_utils.computeParaMat_tc(rfFrom, rfTo, aDir_me, me)[source]
dreambeam.rime.conversion_utils.computeSph2CrtMat(lmnMatrix)[source]
dreambeam.rime.conversion_utils.computeSphBasis(rfFrom, rfTo, order, aDir_me, me)[source]
dreambeam.rime.conversion_utils.convertBasis(me, rbasis, from_refFrame, to_refFrame)[source]
dreambeam.rime.conversion_utils.crt2sph(dir_crt, branchcut_neg_x=True)[source]

Cartesian to spherical conversion.

Parameters:
  • dir_crt (array_like) – Cartesian 3D direction where dir_crt[0], dir_crt[1], dir_crt[2] is x, y, z respectively.
  • branchcut_neg_x (bool) – Whether the branch cut for the azimuthal angle should be on the default negative x axis, so azi is on [-pi,pi]. If False the branch cut will be on the positive axis, so azi is on [0,2*pi].
Returns:

azi, ele – The azimuth and elevation corresponding to the dir_crt direction vectors.

Return type:

array_like, array_like

Note

When using direction cosines (Db uses them), regions outside the horizon (such as l,m=1,1) will have an imaginary vertical component. This function will neglect the imaginary part of the vertical component, so the elevation will be 0, rather than raise an exception. This is so that further processing can proceed. The user should check the vertical component of the radial base of the basis attribute, i.e. jones.basis[…,0,2], to see if it is imaginary and act accordingly.

dreambeam.rime.conversion_utils.dc_hrz2vrt(ll, mm, hemisph=1)[source]

Compute vertical component of an array of 2D horizontal direction cosines.

dreambeam.rime.conversion_utils.getParallacticRot(obsTimes, stnPos, srcDir, doPolPrec=True)[source]
dreambeam.rime.conversion_utils.getRotbetweenRefFrames(rfFrom, rfTo, me)[source]
dreambeam.rime.conversion_utils.getSkyPrecessionMat(me, srcDirection)[source]

Compute precession matrix. This is the 2D rotation along srcDirection between J2000 and current epoch.

At J2000 epoch: compute 2 cartesian vectors orthogonal to srcDirection: alpha & delta. alpha is the orthogonal direction on equator.

dreambeam.rime.conversion_utils.getSph2CartTransf(r)[source]

Compute the transformation matrix from a spherical basis to a Cartesian basis at the field point given by the input ‘r’. The output ‘transf_sph2cart’ is defined such that:

[[v_x], [v_y], [v_z]]=transf_sph2cart*matrix([[v_r], [v_phi], [v_theta]]).

dreambeam.rime.conversion_utils.getSph2CartTransfArr(r)[source]

(Array version) Compute the transformation matrix from a spherical basis to a Cartesian basis at the field point given by the input ‘r’. The output ‘transf_sph2cart’ is defined such that:

[[v_x], [v_y], [v_z]]=transf_sph2cart*matrix([[v_r], [v_phi], [v_theta]]).

dreambeam.rime.conversion_utils.printJones(Jn)[source]
dreambeam.rime.conversion_utils.pyTimes2meTimes(pyTimes)[source]
dreambeam.rime.conversion_utils.rotzMat2ang(rotMat)[source]
dreambeam.rime.conversion_utils.setEpoch(obsTimesArr, obsTimeUnit)[source]
dreambeam.rime.conversion_utils.shiftmat2back(arr)[source]
dreambeam.rime.conversion_utils.sph2crt(azi, ele)[source]

Converts spherical angles to cartesian coordinates. The spherical angles are azimuth and elevation.

dreambeam.rime.conversion_utils.sph2crt_me(sphme)[source]
dreambeam.rime.conversion_utils.sphmeshgrid(nr_ele=128, nr_azi=256)[source]

Provides a polar angles grid on a 2-sphere. Azimuthal dimension should not wrap around to ensure uniqueness on sphere. The mesh has theta increasing along rows and phi along columns.

dreambeam.rime.diagnostics module

dreambeam.rime.diagnostics.display_pointings(jones, obsinfo=None, do_3D=False, do_parallactic_rot=None)[source]

Display pointings in topocentric station coordinates, the antenna basis and the antenna response to IAU x and y. The plots are based on the final cumulative jones. For informative labelling, include the optional argument obsinfo, which contains fields ‘stnid’, ‘band’, ‘freq’, ‘starttime’, and ‘antmodel’.

dreambeam.rime.jones module

This module provides a Jones matrix framework for radio interferometric measurement equations.

class dreambeam.rime.jones.DualPolFieldPointSrc(src_dir, dualPolField=<sphinx.ext.autodoc.importer._MockObject object>, iaucmp=True)[source]

Bases: dreambeam.rime.jones.Jones

This is a mock Jones point source. It does not model a real source. It’s purpose is for testing. It can be seen as a source that first transmits in one polarization and then in another, then 2 transmissions given in the 2 columns. It may have a spectral dimension. The src_dir should be a tuple with (az, el, ref).

class dreambeam.rime.jones.DualPolFieldRegion(refframe='J2000', dualPolField=<sphinx.ext.autodoc.importer._MockObject object>, iaucmp=True, lmgrid=None)[source]

Bases: dreambeam.rime.jones.Jones

This is a Jones unit flux density field.

class dreambeam.rime.jones.DualPolFieldSink[source]

Bases: dreambeam.rime.jones.Jones

computeJonesRes()[source]
class dreambeam.rime.jones.EJones(dualPolElem, position, stnRot, freqSel=None)[source]

Bases: dreambeam.rime.jones.Jones

This is the antenna or feed Jones. It is given by a set of complex gain patterns for each frequency and polarization channel.

computeJonesRes()[source]

Compute the Jones that results from applying the E-Jones to the right. The structure of the jonesrbasis is [timeIdx, sphIdx, skycompIdx].

getPosRot(position)[source]

Compute the nominal transformation from the geodetic position to ITRF. (Not implemented yet)

class dreambeam.rime.jones.Jones[source]

Bases: object

This is the base class for Jones algebra. It contains the Jones matrix itself and a basis w.r.t. which the Jones matrix is given. The basis is such that:

self.jonesbasis = array([[r_hat], [phi_hat], [theta_hat]]).
computeJonesRes()[source]
convert2iaucmp()[source]
getValue()[source]

Return value of the Jones matrix

get_basis()[source]

Return basis of the Jones matrix

get_refframe()[source]

Return the reference frame of the Jones matrix.

op(jonesobjright)[source]

Operate this Jones on to the Jones passed in the argument.

sph2lud3_basis(jonesbasis_sph, alignment=None)[source]

Convert sph basis to Ludwig3 frame with an optional rotation alignment.

class dreambeam.rime.jones.JonesChain[source]

Bases: object

jonesproducts = []
class dreambeam.rime.jones.PJones(obsTimespy, ITRF2stnrot, do_parallactic_rot=True)[source]

Bases: dreambeam.rime.jones.Jones

This is a P-Jones or parallactic Jones. This has a temporal dependence given by the epoch of observation.

computeJonesRes()[source]
computeJonesRes_overfield()[source]

Compute the PJones over field of directions for one frequency.

computeJonesRes_overtime()[source]

Compute and apply the P-Jones matrix. The structure is:

jones[time, sphcomp, skycomp] =
    Pjones[time, sphcomp, comp]*jonesr[comp, skycomp]

The P-Jones matrix is computed as follows: consider a direction vector d. Let jonesrbasis be the column concatenation of the 3 spherical basis vectors corresponding to d in the J2000 reference frame, so

jonesrbasis = [[r_J2000],[phi_J2000],[theta_J2000]].T

where r_J2000 is along the direction d and theta, phi are the remaining two spherical basis vectors. Let jonesbasis be the basis vectors corresponding to the same direction d but in the STN reference frame, so

jonesbasis = [[r_STN],[phi_STN],[theta_STN]].T

where r_STN is along the direction d and theta, phi are the remaining two spherical basis vectors in the spherical system associated with the STN.

The algorithm takes r_J2000 from component 0 of the jonesrbasis and converts it to STN (i.e. finds r_STN) using casacore measures module, along with the other 2 J2000 basis vectors. These converted vectors are called jonesrbasis_to. With r_STN, it also computes the corresponding jonesbasis. A vector in the cartesian J2000 ref sys converted to STN must be equal to the same vector expressed in the cartesian STN ref sys via a conversion from spherical, so

jonesbasis * V_STN^sph = jonesrbasis_to * V_J2000^sph

which implies that we can convert directly from spherical J2000 to the spherical STN like this

V_STN^sph = (jonesbasis.H * jonesrbasis_to) * V_J2000^sph

where the matrix in parentheses is the P-Jones matrix.

The P-Jones matrix is then applied to the operand Jones matrix.

dreambeam.rime.jones.fix_imaginary_directions(jonesobj, fill=<sphinx.ext.autodoc.importer._MockObject object>)[source]

Replace jones matrices with imaginary directions in a Jones object.

When specifying 2D Cartesian direction cosines, it is possible that the corresponding direction is not physical, e.g. when l,m = 1,1. In such cases, the Jones radius basis will have an imaginary vertical component. This function will find such ‘directions’ and replace the corresponding Jones matrix will the fill matrix specified by the fill argument.

dreambeam.rime.jones.inverse(jonesobj)[source]

Return a Jones object that is the inverse of jonesobj.

dreambeam.rime.jones.plotJonesField(jonesfld, jbasis, refframe, rep='abs-Jones', mask_belowhorizon=True)[source]

Plot a Jones field.

dreambeam.rime.scenarios module

dreambeam.rime.tests module

Module contents

RIME stands for Radio Interferometric Measurement Equation.