orca.utils package

Submodules

orca.utils.beam module

class orca.utils.beam.beam(msfile)[source]

Bases: object

For loading and returning LWA dipole beam values (derived from DW beam simulations) on the ASTM. Last edit: 08 August 2016

plotbeam()[source]

Show the IQUV beams at MS center frequency, and azimuth,elevation grids.

srcIQUV(az, el)[source]

Compute beam scaling factor :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]

class orca.utils.beam.jones(msfile)[source]

Bases: object

For loading and returning LWA dipole beam values (derived from DW beam simulations) on the ASTM. Last edit: 11 September 2020

srcjones(l, m)[source]

Compute beam scaling factor :param (l,m) coordinates:

Returns: Jones matrix at coordinates (l,m)

orca.utils.calibrationutils module

orca.utils.calibrationutils.calibration_time_range(utc_times_txt_path: str, start_time: datetime.datetime, end_time: datetime.datetime, duration_min: float = 20)[source]

Get dada file names based on Cygnus A transit for calibration. Get list of .dada file names to use for calibration. Selects .dada files that span {duration_min} centered on transit of Cygnus A.

Parameters
  • utc_times_txt_path – Path to utc_times.txt file.

  • start_time – Start time of data for which to derive calibration tables, datetime format.

  • end_time – End time of data for which to derive calibration tables, datetime format.

  • duration_min – In minutes, amount of time used for calibration. Default is 20 min.

Returns

cal_start_time and cal_end_time covering {duration_min} calibration range,

in datetime format.

orca.utils.calibrationutils.gen_model_from_dict(ms: str, npzfile: str)[source]
orca.utils.calibrationutils.gen_model_ms_stokes(ms: str, zest: bool = False)[source]

Generate component lists for calibration / polarized peeling in CASA. Currently only includes Cas A & Cyg A.

Parameters
  • ms – Measurement set to generate model for.

  • zest – For supplying component lists for polarized peeling. Default is False.

Returns

Returns path to component list(s). If zest=True, will return a list of paths to single-source component lists.

orca.utils.commandline module

Wrapper on top of subprocess (under construction)

orca.utils.commandline.check_output(cmd: List[str]) → str[source]

Wrapper on top of subprocess.check_output. If success, returns the stdout. If failure, logs the stderr and throws CalledProcessError. shell=True is not allowed since it is not secure and does mess up how Popen handles errors. :param cmd:

Returns:

orca.utils.constants module

orca.utils.coordutils module

Coordinates utilities having to do with local coordinates. For image plane pixel numbers, use the fits header and astropy.WCS.

orca.utils.coordutils.get_altaz_at_ovro(coordinates: astropy.coordinates.sky_coordinate.SkyCoord, utc_time: datetime.datetime) → astropy.coordinates.sky_coordinate.SkyCoord[source]

Get the AltAz coordinates at OVRO.

Parameters
  • coordinates – coordinates.

  • utc_time – time of observation.

Returns: SkyCoord that is in AltAz.

orca.utils.coordutils.is_visible(coordinates: Union[astropy.coordinates.sky_coordinate.SkyCoord, astropy.coordinates.builtin_frames.icrs.ICRS], utc_time: datetime.datetime, altitude_limit: astropy.units.quantity.Quantity = <Quantity 5. deg>, check_mountain: bool = True) → bool[source]

Check if a source with coord is altitude_limit (default to 5 deg) above the horizon (and optionally the mountains)

Parameters
  • coordinates – coordinates of the object to check for visibility

  • utc_time – utc timestamp for the time of observation

  • altitude_limit – altitude limit above the horizon/mountain top

  • check_mountain – determines whether to take the altitude of the mountain into account

Returns: whether the coordinate is visible

orca.utils.coordutils.sun_icrs(utc_time: datetime.datetime) → astropy.coordinates.sky_coordinate.SkyCoord[source]

orca.utils.datetimeutils module

Utilities for timestamps.

orca.utils.datetimeutils.find_closest(pivot: datetime.datetime, date_time_list: Iterable) → datetime.datetime[source]

Find closest datetime to pivot in the list of date time.

Parameters
  • pivot – The datetime object to find the closest one to.

  • date_time_list – The list of datetime objects.

Returns: The datetime in the list that’s closest to pivot.

orca.utils.fitsutils module

fits related utilities.

orca.utils.fitsutils.co_add(fits_list: List[str], output_fits_path: str, header_index: Optional[int] = None) → str[source]
orca.utils.fitsutils.co_add_arr(fits_list, dims)[source]
orca.utils.fitsutils.get_sample_header() → astropy.io.fits.header.Header[source]
orca.utils.fitsutils.read_image_fits(fn: str) → Tuple[numpy.ndarray, astropy.io.fits.header.Header][source]
orca.utils.fitsutils.write_fits_mask_with_box_xy_coordindates(output_fits_path: str, imsize: int, center_list: List[Tuple[int, int]], width_list: List[int]) → str[source]

Writes a fits mask with a list of boxes to file. Writes a fits mask with a list of boxes to file. Both im+list and center_list are in WCS X Y coordindates (i.e. transpose of the numpy array from astropy.fits. The fits will NOT have a header that is accurate since only the pixels will be used. If you only need one box you can use one-element lists for the arguments.

Parameters
  • output_fits_path – The fits file path.

  • imsize – size of the image.

  • center_list – A list of enters of the boxes. Must be in XY index (i.e. what ds9 shows).

  • width_list – A list of widths of the boxes in pixels, with each element being the width of the corresponding

center_list element.

Returns: The fits mask path.

orca.utils.fitsutils.write_image_fits(fn, header, data, overwrite=False)[source]

orca.utils.image_sub module

orca.utils.sourcemodels module

Just a bunch of dictionaries of source models.

orca.utils.validationutils module

Validation utilities.

orca.utils.validationutils.check_collection_not_empty(l: Collection)[source]

orca.utils.vis_sub module

Visibility subtraction (not tested)

orca.utils.vis_sub.diff(early_vis, late_vis, out_vis)[source]

Module contents