orca.utils.beam_nmahesh
Primary beam models for OVRO-LWA (N. Mahesh implementation).
This module provides classes for computing primary beam corrections using various beam models including analytic approximations and simulated beam patterns. Used for source flux density corrections and calibrator modeling.
- Classes:
analytic_beam: Simple sin^1.6 elevation-based beam model. jones_beam: Full Jones matrix beam from HDF5 simulation files.
Classes
Analytic primary beam model using sin^1.6 elevation dependence. |
|
This class uses a beam_file_path. This path is the location where all the relevant |
|
For loading and returning LWA dipole beam values (derived from simulations made by Nivedita) |
Functions
|
Find nearest neighbor of array of points in a multi-dimensional grid. |
|
Calculate primary beam correction value for a polarization. |
Module Contents
- orca.utils.beam_nmahesh.knn_search(arr, grid)[source]
Find nearest neighbor of array of points in a multi-dimensional grid.
- Parameters:
arr – Query points array.
grid – Grid of reference points.
- Returns:
Index of nearest neighbor.
- Source:
glowingpython.blogspot.com/2012/04/k-nearest-neighbor-search.html
- orca.utils.beam_nmahesh.primary_beam_correction_val(pol, jones_matrix)[source]
Calculate primary beam correction value for a polarization.
- Parameters:
pol – Polarization type (‘XX’, ‘YY’, or ‘I’).
jones_matrix – 2x2 Jones matrix.
- Returns:
Beam correction factor for the specified polarization.
- class orca.utils.beam_nmahesh.analytic_beam(msfile=None, beam_file_path='/opt/beam/', freq=None)[source]
Analytic primary beam model using sin^1.6 elevation dependence.
A simplified beam model that approximates the OVRO-LWA primary beam as a function of elevation only, ignoring azimuthal structure.
- Parameters:
msfile – Path to measurement set (unused).
beam_file_path – Path to beam files (unused).
freq – Observing frequency (unused).
- class orca.utils.beam_nmahesh.woody_beam(msfile=None, beam_file_path='/opt/beam/', freq=None)[source]
This class uses a beam_file_path. This path is the location where all the relevant beamfiles are located. If freq is provided, then msfile is not required. However, if freq is not provided, msfile is must. In this case, the frequency used is the central frequency corresponding to the msfile. This code can only accept one frequency, but can work simulatenously over multiple sources. This code uses the Woody beam model.
- get_beam_file()[source]
Gets all the beamfiles from the relevant location and then chooses the file while is most relevant for the frequency which the user has requested.
- read_beam_file()[source]
Reads the beamfile. If reading the beamfile is unsuccessfull, then it switches to the analytical beam.
- srcjones(az, el)[source]
The function name is srcjones to keep naming consistent with Jones_beam class. But this function returns I,Q,U,V beams. Compute beam scaling factor Can work simulatenously over multiple sources. So the az and el can be two arrays. The number of sources is assumed to be equal to the number of elements in alt/az :param az: azimuth in degrees :param el: elevation in degrees
Returns: [I,Q,U,V] flux factors, where for an unpolarized source [I,Q,U,V] = [1,0,0,0]
- static get_source_pol_factors(jones_matrix)[source]
I am assuming that the source is unpolarised. At these low frequencies this is a good assumption. Since the jones matrix in this class is essentially the source pol factors, just returning.
- class orca.utils.beam_nmahesh.jones_beam(beam_file_path='/lustre/msurajit/beam_model_nivedita/OVRO-LWA_soil_pt.h5', msfile=None, freq=None)[source]
For loading and returning LWA dipole beam values (derived from simulations made by Nivedita) Can only take one frequency at a time now. The beamfile path should contain the absolute path of the beamfile. If freq is provided, then msfile is not required. However, if freq is not provided, msfile is must. In this case, the frequency used is the central frequency corresponding to the msfile.
- read_beam_file()[source]
az,za units: radian. Note that while the beamfiles accept in radian units, this function takes the alt,azimuth in degrees. The altitude is converted to zenith angle within the code. The jones matrices will be normalised with respect to the zenith
- srcjones(az, el)[source]
Compute beam scaling factor Can work simultaneously over multiple sources. So the az and el can be two arrays. The number of sources is assumed to be equal to the number of elements in alt/az We have implemented an approximate normalization of the beam, which is used by default. While the function to do a more accurate normalization is already implemented, it is not used by default. :param (az: :param el) coordinates in degrees:
Returns: Jones matrix at coordinates (az,el)
- get_source_pol_factors(jones_matrix)[source]
I am assuming that the source is unpolarised. At these low frequencies this is a good assumption.