flint.selfcal.casa¶
Utilities related to using casa tasks to perform self-calibration.
This tooling is mostly centred on using gaincal from casatasks.
Classes¶
Options provided to the casatasks gaincal function. Most options correspond to those in gaincal. |
Functions¶
|
|
|
Create a copy of a measurement set in preparation for selfcalibration |
|
Use the casa task mstransform to create nspw spectral windows |
|
Perform self-calibration using casa's gaincal and applycal tasks against |
|
|
|
Attempt to merge together all SPWs in the input measurement |
Module Contents¶
- class flint.selfcal.casa.GainCalOptions(/, **data: Any)[source]¶
Bases:
flint.options.BaseOptionsOptions provided to the casatasks gaincal function. Most options correspond to those in gaincal.
- minsnr: float = 0.0[source]¶
Minimum signal-to-noise of the solutions. Below this the solutions and data are flagged.
- flint.selfcal.casa.copy_and_clean_ms_casagain(ms: flint.options.MS, round: int = 1, verify: bool = True, rename_ms: bool = False) flint.options.MS[source]¶
Create a copy of a measurement set in preparation for selfcalibration using casa’s gaincal and applycal. Applycal only works when calibrating DATA and creating a CORRECTED_DATA column. Columns are removed in the copied MS to allow this.
If the MS is large the move_ms option will simply renamed the input MS, adjusting the columns appropriately. Note that this potentially involves deleting the DATA column if present and renaming CORRECTED_DATA.
- Parameters:
ms (MS) – Measurement set that would go through self-calibration.
round (int, optional) – The self-calibration round. Defaults to 1.
verify (bool, optional) – Verify that copying the measurementt set (done in preparation for gaincal) was successful. Uses a call to rsync. Defaults to True.
move_ms (bool, optional) – Rather than copying the MS, simple renamed the MS and modify columns appropriately. Defaults to False.
- Returns:
Copy of input measurement set with columns removed as required.
- Return type:
- flint.selfcal.casa.create_spws_in_ms(casa_container: pathlib.Path, ms_path: pathlib.Path, nspw: int) pathlib.Path[source]¶
Use the casa task mstransform to create nspw spectral windows in the input measurement set. This is necessary when attempting to use gaincal to solve for some frequency-dependent solution.
- Parameters:
casa_container (Path) – Path to the singularity container with CASA tooling
ms_path (Path) – The measurement set that should be reformed to have nspw spectral windows
nspw (int) – The number of spectral windows to create
- Returns:
The path to the measurement set that was updated
- Return type:
Path
- flint.selfcal.casa.gaincal_applycal_ms(ms: flint.options.MS, casa_container: pathlib.Path, round: int = 1, gain_cal_options: GainCalOptions | None = None, update_gain_cal_options: dict[str, Any] | None = None, archive_input_ms: bool = False, raise_error_on_fail: bool = True, skip_selfcal: bool = False, rename_ms: bool = False, archive_cal_table: bool = False) flint.options.MS[source]¶
Perform self-calibration using casa’s gaincal and applycal tasks against an input measurement set.
- Parameters:
ms (MS) – Measurement set that will be self-calibrated.
round (int, optional) – Round of self-calibration, which is used for unique names. Defaults to 1.
casa_container (Path) – A path to a singularity container with CASA tooling.
gain_cal_options (Optional[GainCalOptions], optional) – Options provided to gaincal. Defaults to None.
update_gain_cal_options (Optional[Dict[str, Any]], optional) – Update the gain_cal_options with these. Defaults to None.
archive_input_ms (bool, optional) – If True, the input measurement set will be compressed into a single file. Defaults to False.
raise_error_on_fail (bool, optional) – If gaincal does not converge raise en error. If False and gain cal fails return the input ms. Defaults to True.
skip_selfcal (bool, optional) – Should this self-cal be skipped. If True, the a new MS is created but not calibrated the appropriate new name and returned.
rename_ms (bool, optional) – It True simply rename a MS and adjust columns appropriately (potentially deleting them) instead of copying the complete MS. If True archive_input_ms is ignored. Defaults to False.
archive_cal_table (bool, optional) – Archive the output calibration table in a tarball. Defaults to False.
- Raises:
GainCallError – Raised when raise_error_on_fail is True and gaincal does not converge.
- Returns:
The self-calibrated measurement set.
- Return type:
- flint.selfcal.casa.merge_spws_in_ms(casa_container: pathlib.Path, ms_path: pathlib.Path) pathlib.Path[source]¶
Attempt to merge together all SPWs in the input measurement set using the cvel casa task. This can be a little fragile.
The cvel task creates a new measurement set, so there would temporially be a secondary measurement set.
- Parameters:
ms_path (Path) – The measurement set that should have its SPWs merged together.
- Returns:
The measurement set with merged SPWs. It will have the same path as ms_path, but is a new measurement set.
- Return type:
Path