P-AIRCARS Pipeline Module

This module does all pipeline handling all calibration and imaging jobs and provides command-line interface.

paircars.pipeline.basic_cal module

paircars.pipeline.basic_cal.cli()[source]
paircars.pipeline.basic_cal.filtered_final_caltables(caltables, workdir)[source]

Filter last round bandpass and crossphase caltables

Parameters:
  • caltables (list) – Caltable list

  • workdir (str) – Work directory

Returns:

  • list – Bandpass list

  • list – Crossphase list

paircars.pipeline.basic_cal.main(mslist, metafits, workdir, outdir, refant='', uvrange='', perform_polcal=True, keep_backup=False, cpu_frac=0.8, mem_frac=0.8, logfile=None, jobid=0, start_remote_log=False, verbose=False, dask_client=None)[source]

Main function to perform basic calibration

Parameters:
  • mslist (str) – Measurement set list (comma separated)

  • metafits (str) – Metafits file

  • workdir (str) – Work directory

  • outdir (str) – Output directory

  • refant (str, optional) – Reference antenna

  • uvrange (str, optional) – UV-range

  • perform_polcal (bool, optional) – Perform polarization calibration

  • keep_backup (bool, optional) – Keep backup

  • cpu_frac (float, optional) – CPU fraction

  • mem_frac (float, optional) – Memory fraction

  • logfile (str, optional) – Log file name

  • jobid (str, optional) – Pipeline Job ID

  • verbose (bool, optional) – Verbose logs

  • start_remote_log (bool, optional) – Start logging to remote logger or not

  • dask_client (dask.client, optional) – Dask client

Returns:

Success message

Return type:

int

paircars.pipeline.basic_cal.run_applycal(msname, applymode='', flagbackup=True, gaintable=[], gainfield=[], interp=[], calwt=[], n_threads=1)[source]

Perform apply calibration

paircars.pipeline.basic_cal.run_bandpass(msname, workdir, uvrange='', refant='', solint='inf', combine='', gaintable=[], gainfield=[], interp=[], n_threads=1)[source]

Perform bandpass calibration

paircars.pipeline.basic_cal.run_basic_cal_rounds(mslist, dask_client, workdir, outdir='', refant='', uvrange='', keep_backup=False, perform_polcal=False, n_threads=1, mem_limit=1, logger=None)[source]

Perform basic calibration rounds

Parameters:
  • mslist (str) – List of measurement sets

  • dask_client (dask.client) – Dask client

  • workdir (str) – Warking directory

  • outdir (str) – Output directory

  • refant (str, optional) – Reference antenna

  • uvrange (str, optional) – UV-range

  • perform_polcal (bool, optional) – Perform polarization calibration for fullpolar data

  • keep_backup (bool, optional) – Keep backup of ms after each calibration rounds

  • n_threads (int, optional) – CPU threads to use

  • mem_limit (float, optional) – Memory to use in GB

Returns:

  • int – Success message

  • list – Bandpass caltables

  • list – Crossphase caltables

  • int – Succeeded ms number

  • int – Failed ms number

paircars.pipeline.basic_cal.run_crossphasecal(msname, workdir, uvrange='', gaintable=[], n_threads=1)[source]

Perform crosshand phase calibration

paircars.pipeline.basic_cal.run_postcal_flag(msname='', datacolumn='residual', threshold=5.0, n_threads=1, mem_limit=1)[source]

Perform apply calibration

paircars.pipeline.basic_cal.single_ms_cal_and_flag(msname, workdir, cal_round, refant, uvrange, do_polcal=True, applysol=True, do_postcal_flag=True, flag_threshold=5.0, n_threads=1, mem_limit=1)[source]

Single ms calibration and post-calibration flagging

Parameters:
  • msname (str) – Name of the measurement set

  • workdir (str) – Work directory

  • cal_round (int) – Calibration round number

  • refant (str) – Reference antenna

  • uvrange (str) – UV-range

  • do_polcal (bool, optional) – Perform polarisation calibration

  • applysol (bool, optional) – Apply solutions for post-calibration flagging

  • do_postcal_flag (bool, optional) – Peform post-calibration flagging

  • flag_threshold (float, optional) – Flag threshold

  • n_threads (int, optional) – Number of OpenMP threads

  • mem_limit (float, optional) – Memory limit in GB

Returns:

  • str – Caltables

  • bool – Whether postcal flagging is successful or not

paircars.pipeline.basic_cal.single_ms_cal_and_flag_wrapper(*args, **kwargs)[source]
paircars.pipeline.basic_cal.single_round_cal_and_flag(mslist, dask_client, workdir, cal_round, refant=1, uvrange='', do_polcal=True, applysol=True, do_postcal_flag=True, flag_threshold=5.0, n_threads=1, mem_limit=1, logger=None)[source]

Single round calibration and flagging for a set of measurement sets in parallel

Parameters:
  • mslist (list) – Measurement set list

  • dask_client (dask.client) – Dask client

  • workdir (str) – Working directory

  • cal_round (int) – Calibration round

  • refant (str, optional) – Reference antenna

  • uvrange (str, optional) – UV-range

  • do_polcal (bool, optional) – Perform polarisation calibration

  • applysol (bool, optional) – Apply solutions

  • do_postcal_flag (bool or list, optional) – Perform post-calibration flagging for each measurement set

  • flag_threashold (float, optional) – Flagging threshold

  • n_threads (int, optional) – CPU threads to use

  • mem_limit (float, optional) – Memory to use in GB

Returns:

  • dict – A python dictionary cotaining measurement set name and its caltables

  • int – Succeeded ms number

  • int – Failed ms number

  • list – List whether postcal flag is successful or not

paircars.pipeline.beam_interpolate module

paircars.pipeline.beam_interpolate.cli()[source]
paircars.pipeline.beam_interpolate.do_beam_interpolate(original_pb_file, new_freq_res=160)[source]

Interpolate MWA beam coefficient to obtain beam file at finer spectral resolution

Parameters:
  • mwapb_file (str) – Original MWA primary beam file

  • new_freq_res (int, optional) – Frequency resolution of final beam in kHz

Returns:

Output file name

Return type:

str

paircars.pipeline.do_apply_basiccal module

paircars.pipeline.do_apply_basiccal.applysol(msname, workdir, gaintable=[], gainfield=[], interp=[], only_amplitude=False, applymode='calflag', quartical_table=[], overwrite_datacolumn=False, n_threads=1, mem_limit=1, force_apply=False, soltype='basic')[source]

Apply calibration solutions

Parameters:
  • msname (str) – Measurement set

  • workdir (str) – Work directory

  • gaintable (list, optional) – Caltable list

  • gainfield (list, optional) – Gain field list

  • interp (list, optional) – Gain interpolation

  • only_amplitude (bool, optional) – Apply only amplitude

  • applymode (str, optional) – Apply mode

  • quartical_table (list, optional) – Quartical caltables

  • overwrite_datacolumn (bool, optional) – Overwrite data column with corrected solutions

  • n_threads (int, optional) – Number of OpenMP threads

  • mem_limit (float, optional) – Memory limit in GB

  • force_apply (bool, optional) – Force to apply solutions if it is already applied

  • soltype (str, optional) – Solution type

Returns:

  • int – Success message of gain solution

  • int – Success message of polarisation solution

paircars.pipeline.do_apply_basiccal.applysol_wrapper(*args, **kwargs)[source]
paircars.pipeline.do_apply_basiccal.cli()[source]
paircars.pipeline.do_apply_basiccal.main(mslist, target_metafits, workdir, caldir, applymode='calflag', only_amplitude=False, overwrite_datacolumn=False, force_apply=False, do_post_flag=False, start_remote_log=False, cpu_frac=0.8, mem_frac=0.8, logfile=None, jobid=0, verbose=False, dask_client=None)[source]

Apply calibration solutions to a list of measurement sets with optional post-flagging.

Parameters:
  • mslist (str) – Measurement set list (comma separated).

  • target_metafits (str) – Target metafits file

  • workdir (str) – Directory for logs, PID files, and temporary data products.

  • caldir (str) – Path to directory containing calibration tables (e.g., bandpass, gain, polarization).

  • applymode (str, optional) – CASA calibration application mode (e.g., “calonly”, “calflag”, “flagonly”). Default is “calflag”.

  • only_amplitude (bool, optional) – Apply only amplitude

  • overwrite_datacolumn (bool, optional) – If True, overwrites the CORRECTED column during calibration. Default is False.

  • force_apply (bool, optional) – If True, forces re-application of calibration even if it appears already applied. Default is False.

  • start_remote_log (bool, optional) – Whether to enable remote logging using job credentials in workdir. Default is False.

  • cpu_frac (float, optional) – Fraction of CPU resources to allocate per worker. Default is 0.8.

  • mem_frac (float, optional) – Fraction of system memory to allocate per worker. Default is 0.8.

  • logfile (str or None, optional) – Path to the logfile. If None, logging to file is disabled. Default is None.

  • jobid (int, optional) – Identifier for tracking the job and saving PID. Default is 0.

  • verbose (bool, optional) – Verbose logs

  • dask_client (dask.client, optional) – Dask client

Returns:

  • int – Success message

  • int – Succeeded ms number

  • int – Failed ms number

paircars.pipeline.do_apply_basiccal.run_all_applysol(mslist, target_metafits, dask_client, workdir, caldir, overwrite_datacolumn=False, applymode='calflag', only_amplitude=False, force_apply=False, n_threads=1, mem_limit=1, logger=None)[source]

Apply basic-calibration solutions on all target scans

Parameters:
  • mslist (list) – Measurement set list

  • target_metafits (str) – Target metafits file

  • dask_client (dask.client) – Dask client

  • workdir (str) – Working directory

  • caldir (str) – Calibration directory

  • overwrite_datacolumn (bool, optional) – Overwrite data column or not

  • applymode (str, optional) – Apply mode

  • only_amplitude (bool, optional) – Apply only amplitude

  • force_apply (bool, optional) – Force to apply solutions even already applied

  • n_threads (int, optional) – CPU threads to use

  • mem_limit (float, optional) – Memory to use in GB

Returns:

  • list – Calibrated target scans

  • int – Succeeded ms number

  • int – Failed ms number

paircars.pipeline.do_apply_selfcal module

paircars.pipeline.do_apply_selfcal.cli()[source]
paircars.pipeline.do_apply_selfcal.main(mslist, metafits, workdir, caldir, applymode='calonly', overwrite_datacolumn=False, force_apply=False, start_remote_log=False, cpu_frac=0.8, mem_frac=0.8, logfile=None, jobid=0, verbose=False, dask_client=None)[source]

Apply calibration solutions to a list of measurement sets.

Parameters:
  • mslist (str) – Comma-separated list of measurement set paths to apply calibration to.

  • metafits (str) – Metafits file

  • workdir (str) – Directory for logs, intermediate files, and PID tracking.

  • caldir (str) – Directory containing calibration tables (e.g., gain, bandpass, polarization).

  • applymode (str, optional) – Mode for applying calibration (e.g., “calonly”, “calflag”, “flagonly”). Default is “calonly”.

  • overwrite_datacolumn (bool, optional) – If True, overwrites the existing corrected data column. Default is False.

  • force_apply (bool, optional) – If True, applies calibration even if it appears to have been applied already. Default is False.

  • start_remote_log (bool, optional) – Whether to enable remote logging using credentials found in workdir. Default is False.

  • cpu_frac (float, optional) – Fraction of available CPU resources to allocate per task. Default is 0.8.

  • mem_frac (float, optional) – Fraction of system memory to allocate per task. Default is 0.8.

  • logfile (str or None, optional) – Path to the logfile for saving logs. If None, logging to file is disabled. Default is None.

  • jobid (int, optional) – Job ID for PID tracking and logging. Default is 0.

  • verbose (bool, optional)

  • logs (Verbose)

  • dask_client (dask.client, optional) – Dask client address

Returns:

  • int – Succeeded gain solution ms number

  • int – Failed gain solution ms number

  • int – Succeeded polarisation solution ms number

  • int – Failed polarisation solution ms number

paircars.pipeline.do_apply_selfcal.run_all_applysol(mslist, metafits, dask_client, workdir, caldir, overwrite_datacolumn=False, applymode='calonly', force_apply=False, n_threads=1, mem_limit=1, logger=None)[source]

Apply self-calibrator solutions on all target scans

Parameters:
  • mslist (list) – Measurement set list

  • metafits (str) – Metafits file

  • dask_client (dask.client) – Dask client

  • workdir (str) – Working directory

  • caldir (str) – Calibration directory

  • overwrite_datacolumn (bool, optional) – Overwrite data column or not

  • applymode (str, optional) – Apply mode

  • force_apply (bool, optional) – Force to apply solutions even already applied

  • n_threads (int, optional) – CPU threads to use

  • mem_limit (float, optional) – Memory to use in GB

Returns:

  • int – Succeeded gain solution ms number

  • int – Failed gain solution ms number

  • int – Succeeded polarisation solution ms number

  • int – Failed polarisation solution ms number

paircars.pipeline.do_imaging module

paircars.pipeline.do_imaging.cli()[source]
paircars.pipeline.do_imaging.main(mslist, workdir, outdir, freqrange='', timerange='', datacolumn='CORRECTED_DATA', pol='I', freqres=-1, timeres=-1, weight='briggs', robust=0.0, minuv=0, threshold=1.0, cutout_rsun=10.0, use_multiscale=True, use_solar_mask=True, savemodel=True, saveres=True, make_plots=True, start_remote_log=False, cpu_frac=0.8, mem_frac=0.8, logfile=None, jobid=0, verbose=False, dask_client=None)[source]

Perform distributed spectropolarimetric snapshot imaging on multiple measurement sets.

Parameters:
  • mslist (str) – Comma-separated list of measurement set paths to be imaged.

  • workdir (str) – Directory for intermediate files, logs, and temporary outputs.

  • outdir (str) – Directory where final images, models, and plots will be saved.

  • freqrange (str, optional) – Frequency range to image (e.g., “500~1000MHz”). Default is “” (all frequencies).

  • timerange (str, optional) – Time range to image (e.g., “09:30:00~09:40:00”). Default is “” (all times).

  • datacolumn (str, optional) – Data column to image (e.g., “DATA”, “CORRECTED_DATA”). Default is “CORRECTED_DATA”.

  • pol (str, optional) – Polarization product to image (e.g., “I”, “XX”, “RR”, “QUV”). Default is “I”.

  • freqres (float, optional) – Frequency resolution in MHz for slicing the MS. Use -1 to disable. Default is -1.

  • timeres (float, optional) – Time resolution in seconds for snapshot imaging. Use -1 to disable. Default is -1.

  • weight (str, optional) – Weighting scheme for imaging (“natural”, “uniform”, “briggs”). Default is “briggs”.

  • robust (float, optional) – Robustness parameter for Briggs weighting. Default is 0.0.

  • minuv (float, optional) – Minimum uv-distance (in wavelengths) to include in imaging. Default is 0.0.

  • threshold (float, optional) – Cleaning threshold in sigma. Default is 1.0.

  • cutout_rsun (float, optional) – Radius in solar radii to cut out around solar center. Default is 10.0.

  • use_multiscale (bool, optional) – If True, enables multiscale CLEAN deconvolution. Default is True.

  • use_solar_mask (bool, optional) – If True, applies a solar disk mask during CLEAN to reduce sidelobe artifacts. Default is True.

  • savemodel (bool, optional) – If True, saves the CLEAN model images. Default is True.

  • saveres (bool, optional) – If True, saves the residual images. Default is True.

  • make_plots (bool, optional) – If True, generates diagnostic plots for each image. Default is True.

  • start_remote_log (bool, optional) – Whether to enable remote logging using credentials in the workdir. Default is False.

  • cpu_frac (float, optional) – Fraction of total CPUs to use per task. Default is 0.8.

  • mem_frac (float, optional) – Fraction of total system memory to use per task. Default is 0.8.

  • logfile (str, optional) – Log file

  • jobid (int, optional) – Unique job identifier for logging and PID tracking. Default is 0.

  • verbose (bool, optional) – Verbose logs

  • dask_client (dask.client, optional) – Dask client

Returns:

  • int – Success message

  • int – Succeeded ms number

  • int – Failed ms number

  • int – Total images

paircars.pipeline.do_imaging.perform_imaging(msname='', workdir='', datacolumn='CORRECTED_DATA', freqrange='', timerange='', imagedir='', imsize=1024, cellsize=2, image_freqres=-1, image_timeres=-1, pol='I', weight='briggs', robust=0.0, minuv=0, threshold=1.0, use_multiscale=True, use_solar_mask=True, mask_radius=40, savemodel=True, saveres=True, cutout_rsun=10.0, make_plots=True, logfile='imaging.log', ncpu=1, mem=1)[source]

Perform spectropolarimetric snapshot imaging of a ms

Parameters:
  • msname (str) – Name of the measurement set

  • workdir (str) – Work directory name

  • datacolumn (str, optional) – Data column

  • freqrange (str, optional) – Frequency range to image

  • timerange (str, optional) – Time range to image

  • imagedir (str, optional) – Image directory name (default: workdir). Images, models, residuals will be saved in directories named images. models, residuals inside imagedir

  • imsize (int, optional) – Image size in pixels

  • cellsize (float, optional) – Cell size in arcseconds

  • image_freqres (float, optional) – Frequency resolution of image in MHz

  • image_timeres (float, optional) – Time resolution of image in seconds

  • pol (str, optional) – Stokes parameters to image

  • weight (str, optional) – Image weighting scheme

  • robust (float, optional) – Briggs weighting robustness parameter

  • minuv (float, optional) – Minimum UV-lambda to be used in imaging

  • threshold (float, optional) – CLEAN threshold

  • use_multiscale (bool, optional) – Use multiscale or not

  • use_solar_mask (bool, optional) – Use solar mask

  • mask_radius (float, optional) – Mask radius in arcminute

  • savemodel (bool, optional) – Save model images or not

  • saveres (bool, optional) – Save residual images or not

  • cutout_rsun (float, optional) – Cutout image size in solar radii from center (default: 10.0 solar radii)

  • make_plots (bool, optional) – Make radio map helioprojective plots

  • logfile (str, optional) – Log file name

  • ncpu (int, optional) – Number of CPU threads to use

  • mem (float, optional) – Memory in GB to use

Returns:

  • int – Success message

  • list – List of images [[images],[models],[residuals]]

paircars.pipeline.do_imaging.run_all_imaging(mslist, dask_client, workdir='', outdir='', freqrange='', timerange='', datacolumn='CORRECTED_DATA', freqres=-1, timeres=-1, weight='briggs', robust=0.0, minuv=0, pol='I', threshold=1.0, use_multiscale=True, use_solar_mask=True, imaging_params={}, savemodel=False, saveres=False, cutout_rsun=10.0, make_plots=True, n_threads=1, mem_limit=1, logger=None)[source]

Run spectropolarimetric snapshot imaging on a list of measurement sets

Parameters:
  • mslist (list) – Measurement set list

  • dask_client (dask.client) – Dask client

  • workdir (str) – Work directory

  • outdir (str) – Output directory

  • freqrange (str, optional) – Frequency range to image

  • timerange (str, optional) – Time range

  • datacolumn (str, optional) – Data column

  • freqres (float, optional) – Frequency resolution of spectral chunk in MHz

  • timeres (float, optional) – Time resolution of temporal chunk in seconds

  • weight (str, optional) – Image weighting

  • robust (float, optional) – Briggs weighting robust parameter

  • minuv (float, optional) – Minimum UV-lambda to use in imaging

  • pol (str, optional) – Stokes parameters to image

  • threshold (float, optional) – CLEAN threshold

  • use_multiscale (bool, optional) – Use multiscale or not

  • use_solar_mask (bool, optional) – Use solar mask

  • savemodel (bool, optional) – Save model images or not

  • saveres (bool, optional) – Save residual images or not

  • cutout_rsun (float, optional) – Cutout image size (width and height is : 2 times cutout_rsun) Default value: 10 solar radii Note: default FoV is 20 solar solar radii. If cutout_rsun is chosen larger than 20 solar radii, FoV will be increased accordingly.

  • make_plots (bool, optional) – Make radio image helioprojective plots

  • n_threads (int, optional) – CPU threads to use

  • mem_limit (float, optional) – Memory to use in GB

Returns:

  • int – Success message

  • int – Succeeded ms number

  • int – Failed ms number

  • int – Total images

paircars.pipeline.do_selfcal module

paircars.pipeline.do_selfcal.cli()[source]
paircars.pipeline.do_selfcal.do_full_selfcal(msname='', workdir='', selfcaldir='', metafits='', cal_applied=True, start_threshold=5, end_threshold=3, max_iter=30, max_DR=100000, intselfcal_min_iter=3, polselfcal_min_iter=5, DR_convergence_frac=0.1, uvrange='', minuv=0, solint='60s', weight='briggs', robust=0.0, do_apcal=True, do_polcal=True, min_tol_factor=1.0, applymode='calonly', solar_selfcal=True, use_solarflagger=False, ncpu=1, mem=1, logfile_prefix='selfcal', logger=None)[source]

Perform both intensity and polarisation self-calibration

Returns:

  • int – Intensity selfcal success message

  • int – Polarisation selfcal success message

  • list – Intensity selfcal gaintables

  • list – Polarisation selfcal gaintables

  • str – Leakage information file

  • float – Final intensity selfcal dynamic range

  • float – Final polarisation selfcal dynamic range

paircars.pipeline.do_selfcal.do_polselfcal(msname='', workdir='', selfcaldir='', metafits='', refant='', max_iter=10, max_DR=100000, min_iter=5, threshold=3.0, DR_convergence_frac=0.1, uvrange='', minuv=0, weight='briggs', robust=0.0, solar_selfcal=True, use_solarflagger=False, try_nondisk_flag=True, ncpu=1, mem=1, logfile='polselfcal.log')[source]

Do selfcal iterations and use convergence rules to stop

Parameters:
  • msname (str) – Name of the measurement set

  • workdir (str) – Work directory

  • selfcaldir (str) – Working directory

  • metafits (str) – Metafits file

  • refant (str, optional) – Reference antenna

  • max_iter (int, optional) – Maximum numbers of selfcal iterations

  • max_DR (float, optional) – Maximum dynamic range

  • min_iter (int, optional) – Minimum numbers of seflcal iterations at different stages

  • threshold (float, optional) – Threshold of CLEANing

  • DR_convergence_frac (float, optional) – Dynamic range fractional change to consider as converged

  • uvrange (str, optional) – UV-range for calibration

  • minuv (float, optionial) – Minimum UV-lambda to use in imaging

  • weight (str, optional) – Imaging weighting

  • robust (float, optional) – Briggs weighting robust parameter (-1 to 1)

  • solar_selfcal (bool, optional) – Whether is is solar selfcal or not

  • use_solarflagger (bool, optional) – Use solar flagger or not

  • try_nondisk_flag (bool, optional) – Try to flag non-disk data chunks or not

  • ncpu (int, optional) – Number of CPU threads to use

  • mem (float, optional) – Memory in GB to use

  • logfile (str, optional) – Log file name

Returns:

  • int – Success message

  • str – Polarisation self-calibrated measurement set

  • str – Final caltable

  • str – Leakage file

  • float – Final image dynamic range

paircars.pipeline.do_selfcal.do_selfcal(msname='', workdir='', selfcaldir='', metafits='', cal_applied=True, refant='', start_threshold=5, end_threshold=3, max_iter=30, max_DR=100000, min_iter=3, DR_convergence_frac=0.1, uvrange='', minuv=0, solint='60s', weight='briggs', robust=0.0, do_apcal=True, min_tol_factor=1.0, applymode='calonly', solar_selfcal=True, use_solarflagger=False, ncpu=1, mem=1, logfile='intselfcal.log')[source]

Do selfcal iterations and use convergence rules to stop

Parameters:
  • msname (str) – Name of the measurement set

  • workdir (str) – Work directory

  • selfcaldir (str) – Working directory

  • metafits (str) – Metafits file

  • cal_applied (bool, optional) – Basic calibration applied or not

  • refant (str, optional) – Reference antenna

  • start_threshold (int, optional) – Start CLEAN threhold

  • end_threshold (int, optional) – End CLEAN threshold

  • max_iter (int, optional) – Maximum numbers of selfcal iterations (In each selfcal mode)

  • max_DR (float, optional) – Maximum dynamic range

  • min_iter (int, optional) – Minimum numbers of seflcal iterations at different stages

  • DR_convergence_frac (float, optional) – Dynamic range fractional change to consider as converged

  • uvrange (str, optional) – UV-range for calibration

  • minuv (float, optionial) – Minimum UV-lambda to use in imaging

  • solint (str, optional) – Solutions interval

  • weight (str, optional) – Imaging weighting

  • robust (float, optional) – Briggs weighting robust parameter (-1 to 1)

  • do_apcal (bool, optional) – Perform ap-selfcal or not

  • min_tol_factor (float, optional) – Minimum tolerable variation in temporal direction in percentage

  • applymode (str, optional) – Solution apply mode

  • solar_selfcal (bool, optional) – Whether is is solar selfcal or not

  • use_solarflagger (bool, optional) – Use solar flagging or not

  • ncpu (int, optional) – Number of CPU threads to use

  • mem (float, optional) – Memory in GB to use

  • logfile (str, optional) – Log file name

Returns:

  • int – Success message

  • str – Self-calibrated measurement set

  • str – Final caltable

  • bool – Whether non-disk data chunks flagging was successful or not

  • float – Final dynamic range

paircars.pipeline.do_selfcal.main(mslist, metafits, workdir, caldir, cal_applied=True, start_thresh=5, stop_thresh=3, max_iter=30, max_DR=100000, intselfcal_min_iter=3, polselfcal_min_iter=5, conv_frac=0.1, solint='60s', uvrange='', minuv=0, weight='briggs', robust=0.0, applymode='calonly', min_tol_factor=1.0, do_apcal=True, do_polcal=True, solar_selfcal=True, use_solarflagger=False, keep_backup=False, cpu_frac=0.8, mem_frac=0.8, logfile=None, jobid=0, verbose=False, start_remote_log=False, dask_client=None)[source]

Perform iterative self-calibration on a list of measurement sets.

Parameters:
  • mslist (str) – Comma-separated list of target measurement sets to be self-calibrated.

  • metafits (str) – Metafits file

  • workdir (str) – Path to the working directory for outputs, intermediate files, and logs.

  • caldir (str) – Directory containing calibration tables (e.g., from flux or phase calibrators).

  • cal_applied (bool, optional) – Basic initial calibration applied or not.

  • start_thresh (float, optional) – Initial image dynamic range threshold to start self-calibration. Default is 5.

  • stop_thresh (float, optional) – Target dynamic range at which to stop iterative self-calibration. Default is 3.

  • max_iter (int, optional) – Maximum number of self-calibration iterations. Default is 30.

  • max_DR (float, optional) – Maximum dynamic range allowed before halting iterations. Default is 100000.

  • intselfcal_min_iter (int, optional) – Minimum number of iterations before checking for convergence for intensity selfcal. Default is 3.

  • polselfcal_min_iter (int, optional) – Minimum number of iterations before checking for convergence for polarisation selfcal. Default is 5.

  • conv_frac (float, optional) – Convergence criterion: fractional change in dynamic range below which iteration stops. Default is 0.1.

  • solint (str, optional) – Solution interval for gain calibration (e.g., “inf”, “10s”, “int”). Default is “60s”.

  • uvrange (str, optional) – UV range to be used for imaging and calibration, in CASA format. Default is “” (all baselines).

  • minuv (float, optional) – Minimum baseline length (in wavelengths) to include. Default is 10.

  • weight (str, optional) – Weighting scheme for imaging (e.g., “natural”, “uniform”, “briggs”). Default is “briggs”.

  • robust (float, optional) – Robustness parameter for Briggs weighting (ignored if not using “briggs”). Default is 0.0.

  • applymode (str, optional) – Apply mode for calibration tables (“calonly”, “calflag”, etc.). Default is “calonly”.

  • min_tol_factor (float, optional) – Minimum factor for tolerance comparison during convergence checks. Default is 1.0.

  • do_apcal (bool, optional) – Whether to apply polarization and bandpass calibration before starting selfcal. Default is True.

  • do_polcal (bool, optional) – Whether perform polarisation self-calibration or not

  • solar_selfcal (bool, optional) – If True, uses solar-specific masking and flux normalization. Default is True.

  • use_solarflagger (bool, optional) – Use solar flagger or not. Default is False.

  • keep_backup (bool, optional) – If True, keeps backup MS before applying selfcal solutions. Default is False.

  • cpu_frac (float, optional) – Fraction of available CPUs to use per job. Default is 0.8.

  • mem_frac (float, optional) – Fraction of available system memory to use per job. Default is 0.8.

  • logfile (str, optional) – Log file name

  • jobid (int, optional) – Identifier for job tracking and logging. Default is 0.

  • verbose (bool, optional) – Verbose logs

  • start_remote_log (bool, optional) – Whether to initiate remote logging via job credentials. Default is False.

  • dask_client (dask.client, optional) – Dask client

Returns:

  • int – Success message

  • int – Intensity selfcal success number

  • int – Intensity selfcal failed number

  • int – Polarisation selfcal success number

  • int – Polarisation selfcal failed nunber

  • float – Average intensity selfcal dynamic range

  • float – Average polarisation selfcal dynamic range

  • float – Maximum intensity selfcal dynamic range

  • float – Maximum polarisation selfcal dynamic range

paircars.pipeline.do_sidereal_cor module

paircars.pipeline.do_sidereal_cor.cli()[source]
paircars.pipeline.do_sidereal_cor.cor_sidereal_motion(mslist, dask_client, workdir, n_threads=1, logger=None)[source]

Perform sidereal motion correction

Parameters:
  • mslist (list) – Measurement set list

  • dask_client (dask.client) – Dask client

  • workdir (str) – Work directory

  • n_threads (int, optional) – Number of CPU threads to use

Returns:

  • int – Success message

  • list – List of sidereal motion corrected measurement sets

  • int – Succeeded ms number

  • int – Failed ms number

paircars.pipeline.do_sidereal_cor.correct_solar_sidereal_motion_wrapper(*args, **kwargs)[source]
paircars.pipeline.do_sidereal_cor.main(mslist, workdir='', cpu_frac=0.8, mem_frac=0.8, logfile=None, jobid=0, start_remote_log=False, verbose=False, dask_client=None)[source]

Run a parallel processing pipeline for solar sidereal motion correction

Parameters:
  • mslist (str) – Comma-separated list of paths to measurement sets to be processed.

  • workdir (str, optional) – Directory for logs, intermediate files, and other outputs. If empty, defaults to the directory of the first MS with /workdir appended. Default is “”.

  • cpu_frac (float, optional) – Fraction of total CPU cores to allocate per task. Default is 0.8.

  • mem_frac (float, optional) – Fraction of total system memory to allocate per task. Default is 0.8.

  • logfile (str or None, optional) – Path to the log file for capturing logs. If None, logging to file is disabled. Default is None.

  • jobid (int, optional) – Unique job identifier used for PID tracking and task differentiation. Default is 0.

  • start_remote_log (bool, optional) – Whether to enable remote logging based on credentials stored in the workdir. Default is False.

  • verbose (bool, optional) – Verbose logs

  • dask_client (dask.client, optional) – Dask client

Returns:

  • int – Success message

  • int – Succeeded ms number

  • int – Failed ms number

paircars.pipeline.do_target_split module

paircars.pipeline.do_target_split.chanlist_to_str(lst)[source]
paircars.pipeline.do_target_split.cli()[source]
paircars.pipeline.do_target_split.main(mslist, metafits, workdir='', datacolumn='data', split_coarse_chans=[], scan=1, time_window=-1, time_interval=-1, quack_timestamps=-1, freqres=-1, timeres=-1, prefix='targets', force_split=False, only_disk=False, cpu_frac=0.8, mem_frac=0.8, logfile=None, jobid=0, start_remote_log=False, verbose=False, dask_client=None)[source]

Split target scans from a measurement set into smaller chunks for parallel processing.

Parameters:
  • mslist (str) – Measurement sets (comma separated).

  • metafits (str) – Metafits file

  • workdir (str, optional) – Working directory for intermediate and output products. If empty, defaults to <msname>/workdir.

  • datacolumn (str, optional) – Column of the MS to use for splitting (e.g., “DATA”, “CORRECTED”). Default is “data”.

  • split_coarse_chans (list, optional) – Split coarse channels

  • scan (int, optional) – Scan numbers to split.

  • time_window (float, optional) – Time window in seconds for a single time chunk. Set -1 to disable. Default is -1.

  • time_interval (float, optional) – Time interval in seconds between two time chunks. Set -1 to disable. Default is -1.

  • quack_timestamps (int, optional) – Number of timestamps to flag at the beginning and end of each scan (“quack”). -1 to disable. Default is -1.

  • freqres (float, optional) – Frequency resolution in MHz for spectral averaging. Set -1 to disable. Default is -1.

  • timeres (float, optional) – Time resolution in seconds for time averaging. Set -1 to disable. Default is -1.

  • prefix (str, optional) – Prefix for the output split MS files. Default is “targets”.

  • force_split (bool, optional) – Force to split

  • only_disk (bool, optional) – Split only disk visible times

  • cpu_frac (float, optional) – Fraction of available CPUs to allocate per task. Default is 0.8.

  • mem_frac (float, optional) – Fraction of available memory to allocate per task. Default is 0.8.

  • logfile (str or None, optional) – Path to log file. If None, logging to file is disabled. Default is None.

  • jobid (int, optional) – Job identifier for tracking and PID storage. Default is 0.

  • start_remote_log (bool, optional) – If True, enables remote logging using credentials stored in workdir. Default is False.

  • verbose (bool, optional) – Verbose logs

  • dask_client (dask.client, optional) – Dask client

Returns:

  • int – Success message

  • int – Expected splited ms

  • int – Succeeded splited ms

paircars.pipeline.do_target_split.single_mstransform_wrapper(**kwargs)[source]
paircars.pipeline.do_target_split.split_target_scans(mslist, metafits, dask_client, workdir, timeres, freqres, datacolumn, split_coarse_chans=[], scan=1, prefix='targets', time_interval=-1, time_window=-1, quack_timestamps=-1, force_split=False, only_disk=False, n_threads=-1, logger=None)[source]

Split target scans

Parameters:
  • mslist (list) – Measurement set list

  • metafits (str) – Metafits file

  • dask_client (dask.client) – Dask client

  • workdir (str) – Work directory

  • timeres (float) – Time resolution in seconds

  • freqres (float) – Frequency resolution in MHz

  • datacolumn (str) – Data column to split

  • split_coarse_chans (list, optional) – Split coarse channels

  • scan (int, optional) – Scan to split

  • prefix (str, optional) – Splited ms prefix

  • time_interval (float) – Time interval in seconds

  • time_window (float) – Time window in seconds

  • quack_timestamps (int, optional) – Number of timestamps ignored at the start and end of each scan

  • force_split (bool, optional) – Force split

  • only_disk (bool, optional) – Split only disk

  • n_threads (int, optional) – Number of threads to use

Returns:

  • int – Success message

  • list – Splited ms list

paircars.pipeline.flagging module

paircars.pipeline.flagging.cli()[source]
paircars.pipeline.flagging.do_flagging(mslist, metafits, dask_client, workdir, outdir, datacolumn='data', flag_bad_ants=True, flag_bad_spw=True, use_tfcrop=True, use_rflag=False, flagdimension='freqtime', flag_autocorr=True, flag_quack=True, flag_backup=True, run_solarflagger=False, normalize=False, threshold=5.0, restore_flag=True, n_threads=1, mem_limit=1, logger=None)[source]

Function to perform initial flagging

Parameters:
  • mslist (list) – List of the ms

  • metafits (str) – MWA metafits

  • dask_client (dask.client) – Dask client

  • workdir (str) – Work directory

  • outdir (str) – Output directory

  • datacolumn (str, optional) – Data column

  • flag_bad_ants (bool, optional) – Flag bad antennas

  • flag_bad_spw (bool, optional) – Flag bad channels

  • use_tfcrop (bool, optional) – Use tfcrop or not

  • use_rflag (bool, optional) – Use rflag or not

  • flagdimension (str, optional) – Flag dimension (only for tfcrop)

  • flag_autocorr (bool,optional) – Flag auto-correlations

  • flag_quack (bool, optional) – Flag quack timestamps

  • flag_backup (bool, optional) – Flag backup

  • run_solarflagger (bool, optional) – Run solar flagger or not

  • normalize (bool, optional) – Use normalization in solar flagger

  • threshold (float, optional) – Flag threshold

  • restore_flag (bool, optional) – Restore previous flags

  • n_threads (int, optional) – CPU threads to use

  • mem_limit (float, optional) – Memory to use in GB

Returns:

  • int – Success message

  • int – Succeeded ms number

  • int – Failed ms number

paircars.pipeline.flagging.main(mslist, metafits, workdir='', outdir='', datacolumn='DATA', flag_bad_ants=True, flag_bad_spw=True, use_tfcrop=False, use_rflag=False, flag_autocorr=True, flag_quack=True, flagbackup=True, flagdimension='freqtime', run_solarflagger=False, normalize=False, threshold=5.0, restore_flag=True, cpu_frac=0.8, mem_frac=0.8, logfile=None, jobid=0, verbose=False, start_remote_log=False, dask_client=None)[source]

Run the flagging pipeline for a measurement set.

Parameters:
  • mslist (str) – Measurement set list (comma separated)

  • metafits (str) – Metafits file

  • workdir (str, optional) – Working directory to store logs and temporary files. If empty, defaults to <msname>/workdir. Default is “”.

  • outdir (str, optional) – Output directory. Default is: workdir

  • datacolumn (str, optional) – Data column to be flagged (e.g., “DATA”, “CORRECTED”). Default is “DATA”.

  • flag_bad_ants (bool, optional) – If True, flags known bad antennas using pre-defined heuristics. Default is True.

  • flag_bad_spw (bool, optional) – If True, flags bad spectral windows based on statistics. Default is True.

  • use_tfcrop (bool, optional) – If True, applies the tfcrop automated flagging algorithm. Default is False.

  • use_rflag (bool, optional) – If True, applies the rflag automated flagging algorithm. Default is False.

  • flag_autocorr (bool, optional) – If True, flags auto-correlations. Default is True.

  • flag_quack (bool, optional) – If True, flag quack timestamps. Default is True.

  • flagbackup (bool, optional) – If True, saves a flag backup before applying new flags. Default is True.

  • flagdimension (str, optional) – Dimension over which to apply automated flagging (e.g., “freqtime”). Default is “freqtime”.

  • run_solarflagger (bool, optional) – Run solar flagger or not

  • normalize (bool, optional) – Use normalization in solar flagger

  • threshold (float, optional) – Flagging threshold

  • restore_flag (bool, optional) – Restore previous flags

  • cpu_frac (float, optional) – Fraction of total CPU resources to use. Default is 0.8.

  • mem_frac (float, optional) – Fraction of total memory resources to use. Default is 0.8.

  • logfile (str or None, optional) – Path to the log file for saving logs. If None, logging to file is skipped.

  • jobid (int, optional) – Numeric job ID used for PID tracking. Default is 0.

  • start_remote_log (bool, optional) – Whether to enable remote logging using credentials in the workdir. Default is False.

  • dask_client (dask.client, optional) – Dask client

Returns:

  • int – Success message

  • int – Succeeded ms number

  • int – Failed ms number

paircars.pipeline.flagging.single_ms_flag(msname='', badspw='', bad_ants_str='', datacolumn='data', use_tfcrop=True, use_rflag=False, flagdimension='freqtime', flag_autocorr=True, flag_quack=True, run_solarflagger=False, normalize=False, threshold=5.0, n_threads=1, mem_limit=1)[source]

Flag on a single ms

Parameters:
  • msname (str) – Measurement set name

  • badspw (str, optional) – Bad spectral window

  • bad_ants_str (str, optional) – Bad antenna string

  • datacolumn (str, optional) – Data column

  • use_tfcrop (str, optional) – Use tfcrop or not

  • use_rflag (str, optional) – Use rflag or not

  • flagdimension (str, optional) – Flag dimension (only applicable for tfcrop)

  • flag_autocorr (bool, optional) – Flag autocorrelations or not

  • flag_quack (bool, optional) – Flag quack timestamps

  • run_solarflagger (bool, optional) – Run solar flagger or not

  • normalize (bool, optional) – Use normalization in solar flagger

  • threshold (float, optional) – Flagging threshold

  • n_threads (int, optional) – Number of OpenMP threads

  • mem_limit (float, optional) – Memory limit in GB

Returns:

Success message

Return type:

int

paircars.pipeline.flagging.single_ms_flag_wrapper(**kwargs)[source]

paircars.pipeline.import_model module

paircars.pipeline.import_model.cli()[source]
paircars.pipeline.import_model.import_hyperdrive_model(msname, metafits, beamfile='', sourcelist='', ncpu=1, verbose=False)[source]

Simulate visibilities and import in the measurement set

Parameters:
  • msname (str) – Name of the measurement set

  • metafits (str) – Name of the metafits file

  • beamfile (str, optional) – Beam file name

  • sourcelist (str, optional) – Source file name

  • ncpu (int, optional) – Number of cpu threads to use

  • verbose (bool, optional) – Verbose output or not

paircars.pipeline.import_model.import_hyperdrive_model_wrapper(*args, **kwargs)[source]
paircars.pipeline.import_model.main(mslist, metafits, workdir, beamfile='', sourcelist='', cpu_frac=0.8, mem_frac=0.8, logfile=None, jobid='0', verbose=False, start_remote_log=False, dask_client=None)[source]

Make dynamic spectra

Parameters:
  • mslist (str) – Measurement set list (comma separated)

  • metafits (str) – Metafits file

  • workdir (str) – Work directory

  • beamfile (str, optional) – MWA beam file

  • sourcelist (str, optional) – MWA global sky model (fits or ascii in wsclean format)

  • cpu_frac (float, optional) – CPU fraction

  • mem_frac (float, optional) – Memory fraction

  • logfile (str, optional) – Log file

  • jobid (str, optional) – Job ID

  • start_remote_log (bool, optional) – Start remote log

  • verbose (bool, optional) – Verbose logs

  • dask_client (dask.client, optional) – Dask client

Returns:

  • int – Success messsage

  • int – Succeeded ms number

  • int – Failed ms number

paircars.pipeline.import_model.run_all_modeling(mslist, dask_client, metafits, beamfile, sourcelist, ncpu, verbose, logger=None)[source]

Run all modeling

Parameters:
  • mslist (list) – Measurement set list

  • dask_client (dask. client) – Dask client

  • metafits (str) – Metafits file

  • beamfile (str) – MWA primary beam file

  • sourcelist (str) – Source list file

  • ncpu (int) – Number of CPU threads

  • verbose (bool) – Verbose output

Returns:

  • int – Success message

  • int – Succeeded ms number

  • int – Failed ms number

paircars.pipeline.init_data module

paircars.pipeline.init_data.cli()[source]
paircars.pipeline.init_data.download_with_parfive(record_id, update=False, output_dir='zenodo_download')[source]
paircars.pipeline.init_data.get_zenodo_file_urls(record_id)[source]
paircars.pipeline.init_data.init_paircars_data(update=False, remote_link=None, remotelink_password=None, emails=None)[source]

Initiate P-AIRCARS data

Parameters:
  • update (bool, optional) – Update data, if already exists

  • remote_link (str, optional) – Remote logger link to save in database

  • remotelink_password (str, optional) – Remote link password

  • emails (str, optional) – Email addresses to send remote logger JobID and password

paircars.pipeline.init_data.main(init=False, port=4260, do_kill_port=True, datadir='', update=False, link=None, password=None, emails=None)[source]

Initiate P-AIRCARS setup

Parameters:
  • init (bool, optional) – Initiate setup

  • port (int, optional) – Prefect port

  • do_kill_port (bool, optional) – Try to kill port job if it is occupied

  • datadir (str, optional) – User provided custom data directory

  • update (bool, optional) – Update existing data (if corrupted by somehow)

  • link (str, optional) – Remote link

  • password (str, optional) – Remote logger password

  • emails (str, optional) – E-mails for notifications

paircars.pipeline.kill_job module

paircars.pipeline.kill_job.kill_paircarsjob()[source]

Gracefully terminate all processes related to a P-AIRCARS job.

paircars.pipeline.make_ms_plot module

paircars.pipeline.make_ms_plot.cli()[source]
paircars.pipeline.make_ms_plot.main(mslist, workdir, outdir, cpu_frac=0.8, mem_frac=0.8, logfile=None, jobid=0, verbose=False, start_remote_log=False, dask_client=None)[source]

Run the measurement set plots

Parameters:
  • mslist (str) – Measurment set list (comma separated)

  • workdir (str) – Working directory

  • outdir (str) – Output directory

  • cpu_frac (float, optional) – Fraction of total CPU resources to use. Default is 0.8.

  • logfile (str or None, optional) – Path to the log file for saving logs. If None, logging to file is skipped.

  • jobid (int, optional) – Numeric job ID used for PID tracking. Default is 0.

  • verbose (bool, optional) – Verbose logs

  • start_remote_log (bool, optional) – Whether to enable remote logging using credentials in the workdir. Default is False.

  • dask_client (dask.client) – Dask client

Returns:

Success message

Return type:

int

paircars.pipeline.make_ms_plot.plot_ms_diagnostics_wrapper(*args, **kwargs)[source]

paircars.pipeline.make_mwa_overlay module

paircars.pipeline.make_mwa_overlay.cli()[source]
paircars.pipeline.make_mwa_overlay.main(imagedir, outdir, workdir='', all_overlay=False, cpu_frac=0.8, mem_frac=0.8, logfile=None, jobid=0, verbose=False, start_remote_log=False, dask_client=None)[source]

Make overlays of all images

Parameters:
  • imagedir (str) – Image directory

  • outdir (str) – Overlay output directory

  • workdir (str, optional) – Work directory

  • all_overlay (bool, optional) – Make overlays of all images in image directory or not

  • cpu_frac (float, optional) – CPU fraction to use

  • mem_frac (float, optional) – Memory fraction to use

  • logfile (str, optional) – Remote log file name

  • jobid (str, optional) – Pipeline Job ID

  • verbose (bool, optional) – Verbose logs

  • start_remote_log (bool, optional) – Start logging to remote logger or not

  • dask_client (dask.client, optional) – Dask client

Returns:

  • int – Success message

  • int – Total successful overlays

  • int – Total failed overlays

paircars.pipeline.master_flow module

paircars.pipeline.move_solarcenter module

paircars.pipeline.move_solarcenter.cli()[source]
paircars.pipeline.move_solarcenter.main(mslist, workdir='', cpu_frac=0.8, mem_frac=0.8, logfile=None, jobid=0, verbose=False, start_remote_log=False, dask_client=None)[source]

Run the flagging pipeline for a measurement set.

Parameters:
  • mslist (str) – List of measurement sets

  • workdir (str, optional) – Working directory

  • cpu_frac (float, optional) – Fraction of total CPU resources to use. Default is 0.8.

  • mem_frac (float, optional) – Fraction of total memory to use. Default is 0.8.

  • logfile (str or None, optional) – Path to the log file for saving logs. If None, logging to file is skipped.

  • jobid (int, optional) – Numeric job ID used for PID tracking. Default is 0.

  • verbose (bool, optional) – Verbose logs

  • start_remote_log (bool, optional) – Whether to enable remote logging using credentials in the workdir. Default is False.

  • dask_client (dask.client, optional) – Dask client

Returns:

  • int – Success message

  • int – Succeeded ms number

  • int – Failed ms number

paircars.pipeline.move_solarcenter.move_to_sun_wrapper(*args, **kwargs)[source]

paircars.pipeline.mwa_make_ds module

paircars.pipeline.mwa_make_ds.calc_dynamic_spectrum_wrapper(*args, **kwargs)[source]
paircars.pipeline.mwa_make_ds.cli()[source]
paircars.pipeline.mwa_make_ds.main(mslist, metafits, workdir, outdir, plot_quantity='TB', extension='png', overwrite=False, cpu_frac=0.8, mem_frac=0.8, logfile=None, jobid='0', verbose=False, start_remote_log=False, dask_client=None)[source]

Make dynamic spectra

Parameters:
  • mslist (str) – Measurement set list (comma seperated)

  • metafits (str) – Metafits file

  • workdir (str) – Work directory

  • outdir (str) – Output directory

  • plot_quantity (str) – Plotting quantity (TB or flux)

  • extension (str, optional) – Plot extension

  • overwrite (bool, optional) – Overwrite existing plot

  • cpu_frac (float, optional) – CPU fraction

  • mem_frac (float, optional) – Memory fraction

  • logfile (str, optional) – Log file

  • jobid (str, optional) – Job ID

  • verbose (bool, optional) – Verbose logs

  • start_remote_log (bool, optional) – Start remote log

  • dask_client (dask.client, optional) – Dask client

Returns:

  • int – Success messsage

  • int – Succeeded ms number

  • int – Failed ms number

paircars.pipeline.mwa_make_ds.make_solar_DS(mslist, dask_client, metafits, workdir, outdir, plot_quantity='TB', extension='png', showgui=False, overwrite=False, n_threads=1, mem_limit=1, njobs=1, logger=None)[source]

Make solar dynamic spectrum and plots

Parameters:
  • mslist (list) – Measurement set list (Provide only same obsid measurement set list)

  • dask_client (dask.client) – Dask client

  • metafits (str) – Metafits file

  • workdir (str) – Work directory

  • outdir (str) – Output directory

  • plot_quantity (str, optional) – Plotting quantity (TB or flux)

  • extension (str, optional) – Image file extension

  • showgui (bool, optional) – Show GUI

  • overwrite (bool, optional) – Overwrite plot

  • n_threads (int, optional) – CPU threads to use

  • mem_limit (float, optional) – Memory to use in GB

  • njobs (int, optional) – Number of parallel jobs

Returns:

  • int – Success message

  • str – Plot file name

  • int – Succeeded ms number

  • int – Failed ms number

paircars.pipeline.mwa_pbcor module

paircars.pipeline.mwa_pbcor.cli()[source]
paircars.pipeline.mwa_pbcor.get_fits_freq(image_file)[source]
paircars.pipeline.mwa_pbcor.get_leakage_file(image, leakage_dir)[source]

Get leakage file for the image

Parameters:
  • image (str) – Imagename

  • leakage_dir (str, optional) – Leakage file directory

Returns:

Leakage file name

Return type:

str

paircars.pipeline.mwa_pbcor.main(imagedir, metafits, workdir='', leakage_dir='', make_TB=True, make_plots=True, restore=False, cpu_frac=0.8, mem_frac=0.8, logfile=None, jobid=0, verbose=False, start_remote_log=False, dask_client=None)[source]

Primary beam correction of MWA for a sets of images in a directory

Parameters:
  • imagedir (str) – Image directory

  • metafits (str) – Metafits file

  • workdir (str, optional) – Work directory

  • leakage_dir (str, optional) – Leakage file directory

  • make_TB (bool, optional) – Make brightness temperature map or not

  • make_plots (bool, optional) – Make png plots

  • restore (bool, optional) – Restore primary beam correction

  • cpu_frac (float,optional) – CPU fraction

  • mem_frac (float) – Memory fraction

  • logfile (str, optional) – Log file

  • jobid (str, optional) – Job ID

  • verbose (bool, optional) – Verbose logs

  • start_remote_log (bool, optional) – Start remote logger

  • dask_client (dask.client, optional) – Dask client

Returns:

  • int – Success message

  • int – Succeeded image number

  • int – Failed image number

paircars.pipeline.mwa_pbcor.pbcor_all_images(imagedir, metafits, dask_client, leakage_dir='', make_TB=True, make_plots=True, restore=False, jobid=0, n_threads=1, mem_limit=1, njobs=1, logger=None, verbose=False)[source]

Correct primary beam of MWA for images in a directory

Parameters:
  • imagedir (str) – Name of the image directory

  • metafits (str) – Metafits file

  • dask_client (dask.client) – Dask client

  • leakage_dir (str, optional) – Leakage file directory

  • make_TB (bool, optional) – Make brightness temperature map

  • make_plots (bool, optional) – Make plots

  • restore (bool, optional) – Restore primary beam correction

  • jobid (int, optional) – Job ID

  • n_threads (int, optional) – CPU threads to use

  • mem_limit (float, optional) – Memory to use in GB

  • njobs (int, optional) – Number of parallel jobs

Returns:

  • int – Success message

  • int – Succeeded image number

  • int – Failed image number

paircars.pipeline.mwa_pbcor.run_pbcor(imagename, metafits, pbdir, pbcor_dir, leakage_file='', restore=False, jobid=0, ncpu=1, verbose=False)[source]

Run single image primary beam correction

Parameters:
  • imagename (str) – Imagename

  • metafits (str) – Metafits file

  • pbdir (str) – Primary beam directory

  • pbcor_dir (str) – Primary beam corrected image directory

  • leakage_file (str, optional) – Leakage information file

  • restore (bool, optional) – Restore primary beam correction

  • jobid (int, optional) – Job ID

  • ncpu (int, optional) – Number of CPU threads to use

  • verbose (bool, optional) – Verbose output

Returns:

Success message

Return type:

int

paircars.pipeline.mwa_pbcor.run_pbcor_wrapper(*args, **kwargs)[source]

paircars.pipeline.prefect_server module

paircars.pipeline.prefect_server.cli()[source]

paircars.pipeline.run_paircars module

paircars.pipeline.run_paircars.cli()[source]

paircars.pipeline.show_msdetails module

paircars.pipeline.show_msdetails.cli()[source]
paircars.pipeline.show_msdetails.show_listobs(msname)[source]

paircars.pipeline.show_status module

paircars.pipeline.show_status.cli()[source]
paircars.pipeline.show_status.is_slurm_job_running(job_id, node_name=None)[source]

Returns True if job_id is RUNNING on node.

Parameters:
  • job_id (int) – Slurm job ID

  • node_name (str, optional) – Node name

paircars.pipeline.show_status.show_local_job_status(clean_old_jobs=False)[source]

Show P-AIRCARS local cluster jobs status

Parameters:

clean_old_jobs (bool, optional) – Clean old informations for stopped jobs

Returns:

Number of jobs running

Return type:

int

paircars.pipeline.show_status.show_slurm_job_status(clean_old_jobs=False, node_name=None, print_status=True)[source]

Show P-AIRCARS slurm cluster jobs status

Parameters:
  • clean_old_jobs (bool, optional) – Clean old informations for stopped jobs

  • node_name (str, optional) – Node name of slurm cluster

  • print_status (bool, optional) – Print status on terminal

Returns:

Number of jobs running

Return type:

int

paircars.pipeline.single_image_mwapbcor module

paircars.pipeline.single_image_mwapbcor.cli()[source]
paircars.pipeline.single_image_mwapbcor.get_pbcor_image(imagename, outfile, metafits, MWA_PB_file='', sweet_spot_file='', leakage_file='', iau_order=False, pb_jones_file='', save_pb=False, interpolated=True, gridpoint=-1, nthreads=1, restore=False)[source]

Correct FITS image for MWA primary beam

Parameters:
  • imagename (str) – Name of the input file

  • outfile (str) – Basename of the outputfile

  • metafits (str) – Metafits file path

  • MWA_PB_file (str, optional) – MWA primary beam file path

  • sweet_spot_file (str, optional) – MWA sweet spot file

  • leakage_file (str, optional) – Leakage information file

  • iau_order (bool) – PB Jones in IAU order or not

  • pb_jones_file (str) – Numpy file with primary beam jones matrices

  • save_pb (bool) – Save primary beam jones matrices for future use

  • interpolated (bool) – Calculate spatially interpolated beams or not

  • gridpoint (int) – MWA gridpoint number (default : -1, provide if you do not have metafits file)

  • nthreads (int) – Number of cpu threads use for parallel computing

  • restore (bool) – Whether correct for MWA primary beam or restore the correction

Returns:

Output image name

Return type:

str

paircars.pipeline.viewer module

class paircars.pipeline.viewer.LogViewer(max_lines=10000)[source]

Bases: QWidget

append_log_line(text)[source]
categorize_log(name)[source]
closeEvent(self, a0: QCloseEvent | None)[source]
load_log(item)[source]
refresh_logs()[source]
setup_ui()[source]
class paircars.pipeline.viewer.SmartDefaultsHelpFormatter(prog, indent_increment=2, max_help_position=24, width=None)[source]

Bases: ArgumentDefaultsHelpFormatter

class paircars.pipeline.viewer.TailWatcher(file_path)[source]

Bases: FileSystemEventHandler, QObject

new_line

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

on_modified(event)[source]

Called when a file or directory is modified.

Parameters:

event (DirModifiedEvent or FileModifiedEvent) – Event representing file/directory modification.

start()[source]
stop()[source]
paircars.pipeline.viewer.classify_log(name)[source]
paircars.pipeline.viewer.cli()[source]
paircars.pipeline.viewer.drop_cache(path, verbose=False)[source]

Drop file cache for a file or all files under a directory.

Parameters:

path (str) – File or directory path

paircars.pipeline.viewer.drop_file_cache(filepath, verbose=False)[source]

Advise the OS to drop the given file from the page cache. Safe, per-file, no sudo required.

paircars.pipeline.viewer.format_log_block(text)[source]

Convert numeric log levels + add spacing + color

paircars.pipeline.viewer.get_cachedir()[source]
paircars.pipeline.viewer.get_logid(logfile)[source]

Get log id for remote logger from logfile name