operations_lib
- class lsmtool.operations_lib.NormalizedRADec(ra, dec)
Bases:
tuple- dec
Alias for field number 1
- ra
Alias for field number 0
- lsmtool.operations_lib.apply_beam(beamMS, fluxes, RADeg, DecDeg, timeIndx=0.5, invert=False)
Returns flux attenuated by primary beam.
Note: the attenuation is approximated using the array factor beam from the first station in the beam MS only (and it is assumed that this station is at LOFAR core). This approximation has been found to produce reasonable results for a typical LOFAR observation but may not work well for atypical observations.
- Parameters:
beamMS (
str) – Measurement set for which the beam model is madefluxes (
list) – List of fluxes to attenuateRADeg (
list) – List of RA values in degreesDecDeg (
list) – List of Dec values in degreestimeIndx (
float (between 0and1), optional) – Time as fraction of that covered by the beamMS for which the beam is calculatedinvert (
bool, optional) – If True, invert the beam (i.e. to un-attenuate the flux)
- Returns:
attFluxes (
numpy.ndarray) – Attenuated fluxes
- lsmtool.operations_lib.calculateSeparation(ra1, dec1, ra2, dec2)
Returns angular separation between two coordinates (all in degrees).
- Parameters:
ra1 (
floatornumpy.ndarray) – RA of coordinate 1 in degreesdec1 (
floatornumpy.ndarray) – Dec of coordinate 1 in degreesra2 (
float) – RA of coordinate 2 in degreesdec2 (
float) – Dec of coordinate 2 in degrees
- Returns:
separation (
astropy.coordinates.Angleornumpy.ndarray) – Angular separation in degrees
- lsmtool.operations_lib.gaussian_fcn(g, x1, x2, const=False)
Evaluate a Gaussian on the given grid.
- Parameters:
g (
list) – List of Gaussian parameters: [peak_flux, xcen, ycen, FWHMmaj, FWHMmin, PA_E_of_N]x1 (
numpy.ndarray) – Grid coordinates on which to evaluate the Gaussian (as produced bynumpy.mgrid)x2 (
numpy.ndarray) – Grid coordinates on which to evaluate the Gaussian (as produced bynumpy.mgrid)const (
bool, optional) – If True, all values are set to the peak_flux
- Returns:
img (
numpy.ndarray) – Image of Gaussian
- lsmtool.operations_lib.getFluxAtSingleFrequency(LSM, targetFreq=None, aggregate=None)
Returns flux density at given target frequency, adjusted according to the spectral index.
- Parameters:
LSM (
lsmtool.skymodel.SkyModel) – RA of coordinate 1 in degreestargetFreq (
float, optional) – Frequency in Hz. If None, the median is usedaggregate (
str, optional) – Aggregation to use
- Returns:
fluxes (
numpy.ndarray) – Flux densities in Jy
- lsmtool.operations_lib.make_template_image(
- image_name,
- reference_ra_deg,
- reference_dec_deg,
- reference_freq,
- ximsize=512,
- yimsize=512,
- cellsize_deg=0.000417,
- fill_val=0,
Make a blank image and save it to disk
- Parameters:
image_name (
str) – Filename of output imagereference_ra_deg (
float) – RA for center of output imagereference_dec_deg (
float) – Dec for center of output imagereference_freq (
float) – Ref freq of output imageximsize (
int, optional) – Size of output imageyimsize (
int, optional) – Size of output imagecellsize_deg (
float, optional) – Size of a pixel in degreesfill_val (
int, optional) – Value with which to fill the image
- lsmtool.operations_lib.make_wcs(refRA, refDec, crdelt=None)
Makes simple WCS object.
- Parameters:
- Returns:
w (
astropy.wcs.WCS) – A simple TAN-projection WCS object for specified reference position
- lsmtool.operations_lib.matchSky(LSM1, LSM2, radius=0.1, byPatch=False, nearestOnly=False)
Matches two sky models by position.
- Parameters:
LSM1 (
lsmtool.skymodel.SkyModel) – Sky model for which match indices are desiredLSM2 (
lsmtool.skymodel.SkyModel) – Sky model to match againstradius (
floatorstr, optional) – Radius in degrees (if float) or ‘value unit’ (if str; e.g., ‘30 arcsec’) for matching when matchBy=’position’byPatch (
bool, optional) – If True, matching is done by patchesnearestOnly (
bool, optional) – If True, only the nearest of multiple matches is returned
- Returns:
matches1, matches2 (
numpy.ndarray) – matches1 is the array of indices of LSM1 that have matches in LSM2 within the specified radius. matches2 is the array of indices of LSM2 for the same sources.
- lsmtool.operations_lib.normalize_ra_dec(ra, dec)
Normalize RA to be in the range [0, 360) and Dec to be in the range [-90, 90].
- Parameters:
ra (
floatorastropy.coordinates.Angle) – The RA in degrees to be normalized.dec (
floatorastropy.coordinates.Angle) – The Dec in degrees to be normalized.
- Returns:
normalized_ra_dec (
NormalizedRADec) – The normalized RA in degrees in the range [0, 360) and the Dec in degrees in the range [-90, 90], with the following elements:NormalizedRADec.ra: RA in degrees
NormalizedRADec.dec: Dec in degrees
- lsmtool.operations_lib.radec_to_xyz(ra, dec, time)
Convert RA and Dec ICRS coordinates to ITRS cartesian coordinates.
- Parameters:
ra (
astropy.coordinates.Angle) – Right ascensiondec (
astropy.coordinates.Angle) – Declinationtime (
float) – MJD time in seconds
- Returns:
pointing_xyz (
numpy.ndarray) – NumPy array containing the ITRS X, Y and Z coordinates