orca.transform package

Submodules

orca.transform.averagems module

Average measurement sets.

orca.transform.averagems.average_ms(ms_list: List[str], ref_ms_index: int, out_ms: str, column: str, tolerate_ms_io_error: bool = False) → str[source]

Average the list of measurement sets’ select column.

Parameters
  • ms_list – the list of the measurement set.

  • ref_ms_index – the index of the measurement set in ms_list to create the averaged measurement set from.

  • out_ms – output measurement set path.

  • column – Name of the column.

  • tolerate_ms_io_error – Skip a measurement set if an exception was raised while trying to access it.

Returns: Path to the averaged measurement set.

orca.transform.calibration module

orca.transform.calibration.bandpass_correction(spectrumfile: str, bcalfile: str = None, plot: bool = False)[source]

Generate calibration tables to correct bandpass flux scale based on Cyg A spectrum.

Parameters
  • spectrumfile – .npz file output by orca.transform.spectrum

  • bcalfile – .bcal table to duplicate and fill with bandpass amplitude correction.

  • plot – whether to make a plot.

Returns

path to .bcal2 file if {bcalfile} specified. Otherwise returns None.

orca.transform.calibration.calibration_steps(ms: str) → str[source]

Perform full Stokes DI calibration steps on measurement set. Generates model component list. Takes visibilities from the DATA column, and writes calibrated visibilities to CORRECTED_DATA.

Parameters

ms – Measurement set.

Returns: Path to the measurement set.

orca.transform.gainscaling module

Transforms that relate to amplitude scaling.

It uses autocorrelation to figure out the scaling factor between two snapshots on a per-antenna per-channel per-pol basis.

NOTE: It uses the autocorrelation flags to figure out which antennas are flagged and does not solve for those antennas.

orca.transform.gainscaling.apply_gain_scale_in_place(data: numpy.ndarray, scale_spectrum: numpy.ndarray) → None[source]

Apply single pol scaling factor per antenna to cross-correlated data. This is similar to applycal in CASA. It multiples a cross-correlation by the scaling factor that corresponds to the two antennas (each of which has 2 polarizations) involved. Warning: this mutates data in place while returning a reference to it.

Parameters
  • data – Cross-correlated data with shape (N_vis, N_chan, 4), ordered by antennas

  • scale_spectrum – Single polarization scaling factors; shape (N_ant, N_chan, 2), ordered by antennas

Returns: data multiplied by scale_spectrum

orca.transform.gainscaling.auto_corr_data_and_flag(t: casacore.tables.table.table, data_column: str) → Tuple[numpy.ndarray, numpy.ndarray][source]
orca.transform.gainscaling.calculate_gain_scale(to_scale_data: numpy.ndarray, to_scale_flag: numpy.ndarray, target_data: numpy.ndarray, target_flag: numpy.ndarray)[source]

Calcualte the gain scaling factor required to scale to_scale to target.

Parameters
  • to_scale_data

  • to_scale_flag

  • target_data

  • target_flag

Returns:

orca.transform.gainscaling.correct_scaling(to_scale_ms: str, target_ms: str, data_column: str = 'CORRECTED_DATA')[source]

Correct for per-antenna per-pol per-channel scaling between two measurement sets. Scales data in target_ms such that the autocorrelation for baseline_ms and target_ms are the same.

Parameters
  • to_scale_ms – Measurement set to scale to

  • target_ms – Measurement set that this function modifies so that the autocorr is the same as baseline_ms

  • data_column – The data column to apply this operation to.

Returns:

orca.transform.imaging module

Transforms that make images

orca.transform.imaging.get_peak_around_source(im_T: numpy.ndarray, source_coord: astropy.coordinates.sky_coordinate.SkyCoord, w: astropy.wcs.wcs.WCS) → Tuple[int, int][source]
orca.transform.imaging.make_dirty_image(ms_list: List[str], output_dir: str, output_prefix: str, make_psf: bool = False, briggs: float = 0, inner_tukey: Optional[int] = None, n_thread: int = 10, more_args: Optional[List[str]] = None) → Union[str, Tuple[str, str]][source]

Make dirty image out of list of measurement sets.

Parameters
  • ms_list

  • output_dir

  • output_prefix

  • make_psf

  • briggs

  • inner_tukey

  • n_thread

  • more_args

Returns: if make_psf, (image path, psf path), else just the image path.

orca.transform.imaging.make_movie_from_fits(fits_tuple: Tuple[str], output_dir: str, scale: float, output_filename: Optional[str] = None) → str[source]
orca.transform.imaging.make_residual_image_with_source_removed(ms_list: List[str], timestamp: datetime.datetime, output_dir: str, output_prefix: str, tmp_dir: str, briggs: float = 0.0, inner_tukey: Optional[int] = None, n_thread: int = 10, more_args: Optional[List[str]] = None) → str[source]

Make images with bright source(s) removed. Makes a dirty image. Remove the Sun and/or the Crab when they are up.

Parameters
  • ms_list – List of measurement sets to make an image out of.

  • timestamp – Timestamp used to calculate what sources are up.

  • output_dir – Output directory for the images.

  • output_prefix – Image prefix (as required by wsclean).

  • tmp_dir – Temporary directory to hold wsclean re-ordered files.

  • briggs – briggs weighting

  • inner_tukey – Inner Tukey Parameter.

  • n_thread – Number of threads for wsclean to use.

  • more_args – Extra parameters for imaging.

Returns: Path to the output image (residing in output_dir).

orca.transform.integrate module

Make a phased measurement set out of many measurement sets.

orca.transform.integrate.integrate(ms_list: List[str], out_ms: str, phase_center: Optional[str] = None, use_virtualconcat: bool = False) → str[source]

Integrate a list of ms (assumed to be time sorted) chgcentre, concat, and then changing the field id. Common phase center is defaulted to the phase center of the first scan in the list.

Parameters
  • ms_list – List of (time-sorted) measurement sets to integrate.

  • out_ms – output measurement set path.

  • phase_center – Phase center for the integrated ms, a string like ‘09h18m05.8s -12d05m44s’

  • use_virtualconcat – Whether to use virtualconcat, which MOVES the data to create a multi-ms. The original data file will not stay there.

Returns: Path to integrated measurement set.

orca.transform.peeling module

Peeling related transforms

orca.transform.peeling.ttcal_peel_from_data_to_corrected_data(ms: str, utc_time: datetime.datetime, include_rfi_source: bool = True) → str[source]

Use TTCal to peel. Read from DATA column and write to CORRECTED_DATA If the CORRECTED_DATA column exists, it does not do anything.

Parameters
  • ms – Path to measurement set.

  • utc_time – datetime object to figure out what sources are up.

  • include_rfi_source – Include near-field generic RFI sources in peel.

Returns: The output measurement set (which is the same thing as the input measurement set).

orca.transform.peeling.zest_with_casa(ms: str, reverse: bool = False)[source]

Polarized peeling with CASA. Currently, peeling list will only include at most CasA & CygA. The peeled visibilities will be placed in CORRECTED_DATA.

Parameters
  • ms – The measurement set.

  • reverse – Reverse the peeling process. Default is False.

Returns

Path to measurement set that was modified.

orca.transform.phasecenter module

orca.transform.siderealsubtraction module

orca.transform.spectrum module

orca.transform.spectrum.gen_spectrum(ms: str, sourcename: str, data_column: str = 'CORRECTED_DATA', timeavg: bool = False, outdir: str = None, target_coordinates: str = None, apply_weights: str = None, apply_beam: bool = False)[source]

Generate spectrum (I,V,XX,XY,YX,YY) from the visibilities; if target_coordinates not assigned, assumes source of interest is already at phase center; if apply_weights not assigned, no weights applied.

Parameters
  • ms – The measurement set.

  • sourcename – The source for which spectrum is being generated. Used for naming output file.

  • data_column – MS data column on which to operate. Default is CORRECTED_DATA.

  • timeavg – Average in time. Default is False.

  • outdir – Path to where output .npz file should be written. Default is path to input ms.

  • apply_weights – Imaging weights npy file (from wsclean-2.5 -store-imaging-weights, IMAGING_WEIGHT_SPECTRUM column).

Returns

Path to output .npz file containing spectrum.

Module contents