How to: Jackknife Measurement Sets

This tutorial explains how to jackknife measurement sets (ms-files), particularly for ALMA data, to create observation-specific noise realizations. We will use the jackknify package to handle ms-files, split them, and image the visibilities.

Step 1: Download Example Data

First, download an example measurement set from this link. After downloading, unzip the file and note the directory where you store it for future reference.

Step 2: Initializing

To start using the jackknify package, we need to initialize the measurement set so that jackknify can interface with CASA.

[1]:
import jackknify
[2]:
#initilaize
tool = jackknify.Jack(fname   = '../../data/Glass-z13.ms', # The file name of the visibilities,
                      outdir  = '../../output/', #the directory to save the outputs in
                      fields  = ['3'], # Each visibility can have multiple fields,
                      spws    = [['0']], # and each field can have multiple spws,
                      band    = 'Band7', # Band of the observation,
                      array   = 'C7', # which configuration the observation are taken in,
                      )

Step 3: Create a Jackknifed Measurement Set

To create a jackknifed measurement set, simply run the following code. This will generate the jackknifed measurement set, which you can then use for further analysis or imaging.

[3]:
tool.run(seed = 42)
  0%|          | 0/1 [00:00<?, ?it/s]
.. Loading in MS
.. Jack Knife it
.. Saving to MS
.. Image
100%|██████████| 1/1 [08:52<00:00, 532.64s/it]

Want another one? Just run it again, but with another seed:

[4]:
tool.run(seed = 142)
  0%|          | 0/1 [00:00<?, ?it/s]
.. Loading in MS
.. Jack Knife it
.. Saving to MS
.. Image
100%|██████████| 1/1 [11:58<00:00, 718.84s/it]

Step 4: Multiple runs

If you want multiple simulatiously, just run the following. This automatically increments the seeding.

[5]:
tool.run(samples = 3, seed = 242)
 67%|██████▋   | 2/3 [22:19<11:04, 664.68s/it]
.. Loading in MS
.. Jack Knife it
.. Saving to MS
.. Image
100%|██████████| 3/3 [31:29<00:00, 629.82s/it]

Now you are all done! You have five new noise realizations of your observation, all stored in the output directory.

[ ]: