|
| 1 | +* Foreword |
| 2 | + |
| 3 | +This guide assumes that astrohack was installed in a virtual |
| 4 | +environment (venv) with the convenience functions as described [[./Installing-astrohack-in-a-virtual-environment][here]] |
| 5 | +and that the data has been downloaded as an ASDM. |
| 6 | + |
| 7 | +* Downloading reduction scripts |
| 8 | + |
| 9 | +The first step in the data reduction is to download the scripts to be |
| 10 | +used in the data reduction process, this can be done by using one of the |
| 11 | +convenience functions created by the installation script: |
| 12 | +```bash |
| 13 | +$ get_locit_scripts |
| 14 | +``` |
| 15 | +This will download 3 scripts to the current working directory:' |
| 16 | +- pre_locit_script.py : this is the CASA script for data calibration. |
| 17 | +- exec-locit.py : This is the script that runs locit and produces the |
| 18 | + relevant plots. |
| 19 | +- export_to_parminator.py : This is the script that exports locit |
| 20 | + results to a parminator compliant file. |
| 21 | + |
| 22 | +It is expected that this scripts will change due to new requests made |
| 23 | +by VLA's Data analysts and/or due to bugs found by them. Hence it is |
| 24 | +good practice to redownload them each time a reduction is to be done |
| 25 | +to garantee that the user has the latest version of the script. |
| 26 | + |
| 27 | +* Running pre_locit_script.py in CASA |
| 28 | + |
| 29 | +This script contains a basic command line interface to control its |
| 30 | +parameters, because of this it must be run in CASA in the command line |
| 31 | +mode, i.e.: |
| 32 | + |
| 33 | +```bash |
| 34 | +$ casa -c pre_locit_script.py -h |
| 35 | +``` |
| 36 | + |
| 37 | +The output of the pre_locit_script.py script called with the *-h* flag |
| 38 | +is the help which should look like this: |
| 39 | + |
| 40 | +``` |
| 41 | +$ casa -c pre-locit-script.py baseline.ms teste1 -h |
| 42 | + |
| 43 | +optional configuration file config.py not found, continuing CASA startup without it |
| 44 | + |
| 45 | +Using matplotlib backend: TkAgg |
| 46 | +Telemetry initialized. Telemetry will send anonymized usage statistics to NRAO. |
| 47 | +You can disable telemetry by adding the following line to the config.py file in your rcdir (e.g. ~/.casa/config.py): |
| 48 | +telemetry_enabled = False |
| 49 | +--> CrashReporter initialized. |
| 50 | +CASA 6.5.5.21 -- Common Astronomy Software Applications [6.5.5.21] |
| 51 | + |
| 52 | +-------------------------------------------------------------------------------- |
| 53 | + |
| 54 | +usage: pre-locit-script.py [-h] [-m] [-f FRINGE_FIT_SOURCE] [-r REFERENCE_ANTENNA] [-s SCANS_TO_FLAG] input_dataset output_name |
| 55 | + |
| 56 | +CASA pre-locit script |
| 57 | +Execute fringe fit, averaging and phase cal to produce the cal table to ingested by astrohack's locit |
| 58 | + |
| 59 | +positional arguments: |
| 60 | + input_dataset Input dataset usually an ASDM |
| 61 | + output_name Base name for output name produced by this script |
| 62 | + |
| 63 | +optional arguments: |
| 64 | + -h, --help show this help message and exit |
| 65 | + -m, --is_ms Input file is a MS rather than an ASDM |
| 66 | + -f FRINGE_FIT_SOURCE, --fringe_fit_source FRINGE_FIT_SOURCE |
| 67 | + Fringe fit source, default is 0319+415 |
| 68 | + -r REFERENCE_ANTENNA, --reference_antenna REFERENCE_ANTENNA |
| 69 | + Choose reference antenna for fringe fit and phase cal, default is ea23 |
| 70 | + -s SCANS_TO_FLAG, --scans_to_flag SCANS_TO_FLAG |
| 71 | + Comma separated list of scans to flag, default is no scan to flag |
| 72 | +``` |
| 73 | + |
| 74 | +The user can then run the script by specifying the ASDM name (or a MS |
| 75 | +name if importasdm has already been run in advance by using flag *-m*) |
| 76 | +and an *output_name*. This *output_name* will be the basename for the |
| 77 | +products created by this script. The script uses *0319+415* as the |
| 78 | +default fringe fit source, and antenna *ea23* as the default reference |
| 79 | +antenna, if either of those are not present on the dataset the script |
| 80 | +will throw an error before executing any CASA step. |
| 81 | + |
| 82 | +A typical execution call will look like this: |
| 83 | + |
| 84 | +```bash |
| 85 | +$ casa -c pre_locit_script.py my_dl_asdm baseline-241125 |
| 86 | +``` |
| 87 | + |
| 88 | +Where *my_dl_asdm* is the name of the downloaded ASDM and |
| 89 | +*baseline-241125* is the basename for the output files created by the |
| 90 | +script. |
| 91 | + |
| 92 | +Execution can be quite long as fringe fit may take close to 1 hour to |
| 93 | +execute depending on the size of the pointing dataset. |
| 94 | + |
| 95 | +* Running exec_locit.py |
| 96 | + |
| 97 | +For running *exec_locit.py* we need to first activate the astrohack |
| 98 | +venv: |
| 99 | + |
| 100 | +```bash |
| 101 | +$ activate_astrohack |
| 102 | +``` |
| 103 | + |
| 104 | +With the venv activated we can then call *exec_locit.py* with the *-h* |
| 105 | +flag to have a look at its help: |
| 106 | + |
| 107 | +``` |
| 108 | +$ python exec_locit.py -h |
| 109 | +usage: exec_locit.py [-h] [-d] [-a ANTENNAS] [-c COMBINATION] [-p POLARIZATION] [-k] [-e ELEVATION_LIMIT] [-f FIT_ENGINE] caltable |
| 110 | + |
| 111 | +Execute locit with a phase cal table produced by CASA |
| 112 | + |
| 113 | +This script executes a subset of locit's features, for a more detailed tutorial see: |
| 114 | +https://astrohack.readthedocs.io/en/stable/locit_tutorial.html |
| 115 | + |
| 116 | +positional arguments: |
| 117 | + caltable Phase cal table |
| 118 | + |
| 119 | +options: |
| 120 | + -h, --help show this help message and exit |
| 121 | + -d, --display_plots Display plots during script execution |
| 122 | + -a ANTENNAS, --antennas ANTENNAS |
| 123 | + Comma separated list of antennas to be processed, default is all antennas |
| 124 | + -c COMBINATION, --combination COMBINATION |
| 125 | + How to combine different spws to for locit processing, valid values are: no, simple or difference, default is simple |
| 126 | + -p POLARIZATION, --polarization POLARIZATION |
| 127 | + Which polarization hands to be used for locit processing, for the VLA options are: both, L or R, default is both |
| 128 | + -k, --fit_kterm Fit antennas K term (i.e. Offset between azimuth and elevation axes) |
| 129 | + -e ELEVATION_LIMIT, --elevation_limit ELEVATION_LIMIT |
| 130 | + Lowest elevation of data for consideration in degrees, default is 10 |
| 131 | + -f FIT_ENGINE, --fit_engine FIT_ENGINE |
| 132 | + Choose the fitting engine, default is "scipy" other available engine is "linear algebra" |
| 133 | +``` |
| 134 | + |
| 135 | +Several options are available, but usually only *--antennas* and |
| 136 | +*--combination* will be used as they control the antennas for which we |
| 137 | +want position correction solutions and how to combine the different |
| 138 | +spectral windows to obtain a solution. The flag *-d* can be used to |
| 139 | +display the plots as the script is executing. |
| 140 | + |
| 141 | +Below is an example call to *exec_locit.py* where we specify only a |
| 142 | +few antennas for which we want antenna position corrections and that |
| 143 | +we want to combine the spectral windows using the phase difference |
| 144 | +between them. |
| 145 | + |
| 146 | +```bash |
| 147 | +$ python exec_locit.py baseline-241125-pha.cal -a 'ea06,ea13,ea27' -c difference |
| 148 | +``` |
| 149 | + |
| 150 | +* Exporting results to parminator |
| 151 | +After the user is satisfied with the results they can export the results |
| 152 | +to a parminator file by calling the *export_to_parminator.py* script. |
| 153 | +Like the other scripts it has a help that can be accessed with the |
| 154 | +*-h* flag: |
| 155 | + |
| 156 | +``` |
| 157 | +$ python export_to_parminator.py -h |
| 158 | +usage: export_to_parminator.py [-h] [-t CORRECTION_THRESHOLD] [-a ANTENNAS] position_file parminator_file |
| 159 | + |
| 160 | +Export position corrections to parminator |
| 161 | + |
| 162 | +This script executes a subset of locit's features, for a more detailed tutorial see: |
| 163 | +https://astrohack.readthedocs.io/en/stable/locit_tutorial.html |
| 164 | + |
| 165 | +positional arguments: |
| 166 | + position_file position.zarr file produced by locit |
| 167 | + parminator_file Name for the output parminator file |
| 168 | + |
| 169 | +options: |
| 170 | + -h, --help show this help message and exit |
| 171 | + -t CORRECTION_THRESHOLD, --correction_threshold CORRECTION_THRESHOLD |
| 172 | + Threshold for including corrections in meters, default is 0.01 |
| 173 | + -a ANTENNAS, --antennas ANTENNAS |
| 174 | + Comma separated list of antennas to be processed, default is all antennas |
| 175 | +``` |
| 176 | + |
| 177 | +A typical call to *export_to_parminator.py* shall look like this: |
| 178 | + |
| 179 | +```bash |
| 180 | +$ python export_to_parminator.py baseline-241125.position.zarr 241125-baseline.par -t 0.05 -a 'ea13,ea27' |
| 181 | +``` |
| 182 | + |
| 183 | +In this call we have chosen a threshold for corrections of 5 cm and to |
| 184 | +only export corrections for antennas ea13 and ea27 which will be |
| 185 | +exported to a file called 241125-baseline.par. |
0 commit comments