Skip to content

Apply to all targets

jradcliffe5 edited this page Jul 5, 2022 · 7 revisions

Apply to all targets (apply_to_all)

The apply_to_all step is designed for multi-phase centre VLBI observations only and is to cast the calibration from the previous steps to all of the other phase centres. This step will also apply a nominal primary beam correction to these data. There are multiple options available

Parameters

    "apply_to_all":{  
        "target_path"       : "/Users/jackradcliffe/Documents/BD228L/target_files", #path to the fitsidi files of the phase centres
        "target_outpath"    : "/Users/jackradcliffe/Documents/BD228L/calibrated", #path to where the calibrated data should be stored
        "tar_output"        : true, #if true, tar the calibrated products (uses gzip compression)
        "tar_ms_only"       : true, #if true and "tar_output=true" only tar the measurement set (useful for inspecting images quickly)
        "mppc_parallel"     : false, #if true (+ and mpi enabled + job manager = bash) process multiple phase centres at ones
        "pbcor":{
            "run"           : true, #run primary beam correction
            "implementation": "uvcorr", #type of primary beam correction (see below for options)
            "vex_file"      : "", #vex file name+path (will override pointing_centre)
            "pointing_centre"  : ["10h01m22.8650000s","+2d19m28.333s"], #pointing centre of observations in CASA format
            "backup_caltables"  : true #add pbcor tables to the tar bundle of calibration tables
        },
        "image_target":{
            "run"           : true, #if true, image targets
            "imsize"        : [1024,1024] #image size
        },
        "hpc_options":{ 
            "partition"     :  "default",
            "walltime"      :  "default",
            "nodes"         :    -1,
            "cpus"          :    -1,
            "mpiprocs"      :    -1,
            "nodetype"      :  "default",
            "max_jobs"      : 24 #important for PBS/slurm runs. Determines how many concurrent jobs can run at once.
        } 

Applying to all data sets

Parallelisation

Parallelisation is essential if you are to calibrate the many datasets that are produced with multiple phase centre correlations. The parallelisation is through two different methods depending on the job manager selected.

For the slurm and pbs (PBS Pro) job managers, each dataset is calibrated using an array job where the total number of jobs is the number of phase centres and the maximum jobs at once determined by the max_jobs parameter in the params file. It is generally recommended to calibrate with one core per dataset as monolithic CASA jobs are executed (and will be a waste of cores).

For the bash job manager, parallelisation is conducted through the casampi module. The mppc_parallel parameter determines how the parallelisation is conducted. If it is false, each measurement set is processed in turn, but a multi-measurement set is produced which speeds up the applying of calibration tables. This is generally better for a small number of phase centres or large individual datasets.

If it is true, casampi will calibrate multiple phase centres at once (depending on the number of cores available to mpi, e.g., mpirun -q -n 5 will calibrate 4 at once -- Nb: the other is reserved to control the CASA instance). This is generally better for large number of phase centres. Note that both parallelisation methods cannot be used together as problems with resource allocation has been found to occur.

Important should you decide to set mppc_parallel: true, you have to conduct the steps on the following page to make this work properly on your machine (otherwise the job will hang forever):

Enabling casampi using bash job manager

Primary beam correction

The primary beam corrections are a fairly complex bit of code, and the next two sections will help you decide which of the four different implementations to use or which of the two different ways of setting the pointing centres to use. The final sub-section shows you how to add a new primary beam model for telescopes that are not supported.

Implementations

The four different implementations are listed below in detail but the uvcorr method is most applicable to the majority of cases.

  1. Image plane correction ("implementation": "imcorr")

    The image plane correction

  2. uv plane correction ("implementation": "uvcorr")

    The uv plane correction calculates a single amplitude primary beam corrections per antenna, per spectral windown, at the pointing centre only as a CASA gain table (ending in .pbcor). This sort of correction is computationally inexpensive but the fluxes are only correct at the pointing centre. The errors away from the pointing centre scale with distance and the derivative of the primary beam model (e.g., higher at the HPBW where the PB attenuation changes over a smaller angular distance).

    When to use: For any sort of array, and the images you create are a very small fraction of the primary beam area (so the beam doesn't change significantly over the image)

  3. Differential primary beam correction ("implementation":"diffuvcorr")

    The differential $uv$ correction is a mixture of 1. and 2.. A gain table, the same as described in 1., is produced and then a resultant image is made. This image then rescaled by the model divided my the singular uv correction at the phase centre. This ensures that the fluxes are correct across the image.

  4. a-term correction ("implementation":"aterm")

    The a-term correction is the most compuationally complex but the most accurate by far. This generates a direction-dependent diagonal gain calibration which is used to correct for the primary beam through a convolution while gridding the image. Errors via this method are from the resampling of the convolution and the accuracy of the primary beam model but are significantly less than the other methods.

    The issue with this method is that it requires the wsclean package to be installed (see https://wsclean.readthedocs.io) and the Image Domain Gridding libraries to be installed also (see https://wsclean.readthedocs.io/en/latest/image_domain_gridding.html).

    When to use: If you are generating a large image relative to the primary beam size and you have a heterogeneous array. This ensures that amplitude errors are reduced dramatically across the whole image.