Skip to content

3_Procedures

SimonaRighini edited this page Feb 11, 2018 · 10 revisions

Procedures: full description

Here follow the detailed descriptions and instructions in order to use the different procedures.

separate.pro

This procedure reorganizes the dataset. It separates the acquisitions into sub-folders, depending on the frequency band and the calibrator/skydip/target nature of the scan. Launch the procedure and select the PARENT FOLDER, the one containing the YYYYMMDD subfolder(s) composing the dataset you want to reduce.

The usable RF bands are hard-coded. The original version of this procedure considers the following bands and frequency boundaries (MHz):

pbounds=[300,1000]
lbounds=[1000,2000]
sbounds=[2000,4000]
cbounds=[4000,8000]
xbounds=[8000,10000]
kbounds=[18000,26500]

If observing with more than one sub-band in the K-band RF range, specify /multiK as in:

IDL> separa, /multiK    (in this case, kbounds=[18000,20000,23000,26500])

Default flux density calibrators are considered to be 3C48, 3C123, 3C286, 3C295, NGC7027. When wanting to specify a custom list of calibrators, provide an external text file containing as columns the source names and the flux densities already computed for the observed frequency (the same list must be used when running "runcalib"), and then use:

IDL> separa, /extlist

opacity.pro

The program estimates Tau0 values from skydips (DISCOS FITS format).

At startup a dialog box appears: select the folder holding either the skydip FITS files or the subfolders containing them.

The fitting procedure exploits the following algorithm: CURVEFIT, exponential fitting, with partial derivatives, 2 free parameters. Using a fixed Tatm, it estimates T0 and Tau0.

The employed function is:

Tsys - T0 = Tatm*(1- exp(-Tau0*x))

where x = airmass = 1/sin(El)

By default, the program uses initial guess values for T0:

Tric = T0 = 9 K @ 4.5-7.7 GHz
Tric = T0 = 24 K @ 8.0-10.0 GHz
Tric = T0 = 30 K @ 18.0-26.5 GHz

(the observed freq is read insite the FITS file itself) Users can indicate a custom value for T0, by passing the argument t0=ddd.d in the command line.

Tatm is derived from the weather parameters recorded in the FITS content:

Tamb = average of the measurements stored in the file, converted to K
Tatm = 0.683*Tamb + 78 (this value is kept fixed within the fitting procedure)

If users want to use a different relation, they might do so by providing their own parameters (m and q) so that Tatm will be computed as:

Tatm = m*Tamb +q

As concerns the zenithal opacity Tau0, the pre-fitting guess values are estimated by means of a simplified relation, deriving the opacity through the Tsys values measured near 30° and 90° of Elevation:

init_tau=alog(2/(1+sqrt(1-4*(Tsys30-Tsys90)/Tatm)))

Such Tsys values are extracted from the Tant datastream inside the skydip, by selecting the nearest available samples.

By default, a skydip is considered to span between 20° and 87° of elevation. The elmin ed elmax optional parameters can be used when needing to specify custom ranges.

OUTPUT FILES

The program generates a Tau.txt file containing the Tau0 estimates, plus a skydip_fit.ps file showing various plots in multi-plot pages. Measurements resulting from a fitting procedure having a chi-squared value > 1 are highlighted inside the output file and rejected during the next analysis phases. If wanting to include these measurements, too, edit the Tau.txt file and remove the chi-squared indications.

Using the /allplots option, each FITS will produce an on-screen plot, automatically saved into a separate .jpg file.

EXAMPLES:

IDL> opacity, elmin=25, elmax=85      exploits the skydip data in the 25°-85° elevation range only
IDL> opacity, elmin=28                exploits the skydip data in the 28°-87° elevation range
IDL> opacity, t0=40                   imposes that T0 is 40 K
IDL> opacity, /allplots               produces individual plots (on screen and in JPG files)
IDL> opacity, m=0.5, q=100            computes Tatm as Tatm = 0.5*Tamb + 100

dataflagging.pro

Program to visual inspect and flag continuum FITS acquisitions.

USAGE:

1) Compile and run dataflagging.pro;
2) (optional) select the user code from the upper drop-down menu;
3) click on BROWSE button and select the parent folder containing the FITS-full folders;
4) click on GO!;
5) if a checkfile (i.e. the list of flagged files) already exists for a FITS folder,
   a dialog box will appear. By answering "YES", users indicate they want to keep those
   flags and go on appending new ones for the so-far-unflagged data (if any).
   By answering "NO", they decide to start over, thus rewriting the checkfile;
6) A new window will appear, where the content of each FITS file will be displayed.
   The two plots show:
     on the left --> Section 0
     on the right --> Section 1
   Users are asked to express their opinion on the sections to be KEPT (i.e. sent
   to the following phases of the data reduction) by clicking on NONE, LEFT, RIGHT, BOTH.
   The button "BOTH (V. good)" can be ignored, or used to pinpoint the particularly
   good acquisitions (for future uses, such as the implementation of AI tools);
7) the "Skip" button skips the FITS presently displayed, leaving it unflagged (beware: CAP will by defaut consider it good!);
8) using the "Back" button, the previous FITS is re-displayed and re-flagged (the old flag is overwritten).
   It is not possible to invoke "Back" after a "Skip" (for this reason the button is disabled);
9) to interrupt the procedure, yet saving all the previously-performed flagging, click on "STOP and EXIT".

OUTPUT FILE

In each scan-based folder, a Chekfile_*.txt file (named after the folder itself) is created. It must be left inside the folder, where the pipeline is going to look for it.

runcalib.pro

This procedure is devoted to the reduction of cross scans acquired on flux calibrators and achieve the conversion factors cnt->Jy. It plots and analyses the data obtained by stacking all the subscans contained in any scan (i.e. subfolder) stored in the working folder. If users want to graphically choose the calibration data folder, they must use:

IDL> runcalib, /pickpath    in order to select the path to the data parent folder (otherwise the chosen path is ./CALIBRATORS)
IDL> runcalib, /skypath     in order to select the path to the folder containing the Tau.txt file (otherwise the chosen path is ./SKYDIPS)

If no Tau.txt is found, all the analysis will be carried out without applying the atmospheric opacity compensation.

Measurements for all the single subscans can be obtained by explicitly choosing this option:

IDL> runcalib, /sub

The gaussian fitting performed on the (sub)scans can be run using three different baseline-fitting options, in particular:

IDL> runcalib, /linear    performs, and outputs, only the linear fitting of baselines
IDL> runcalib, /cubic     performs, and outputs, only the cubic fitting of baselines
IDL> runcalib, /both      performs, and outputs, both the cubic and linear fitting of baselines

By default, the choice is 'both'.

At present, graphic output is exceedingly slow, in particular for single subscans (if the /sub option is selected). So it is disabled by default. To enable it, explicitly set the option:

IDL> runcalib, /plot

If non-standard calibrators are to be considered, users must specify the /extlist option, which allows them to pick a proper external list, where source names and nominal flux densities (Jy) are provided in the simple format (A,D).

The option:

IDL> runcalib, /skipgc

overrides the use of the standard gain curves; it poses Gain=1 for all the elevations, thus practically avoiding the elevation-dependant gain compensation.

COMPATIBILITY WITH CONVERTED FILES

The program automatically handles the TP-like files resulting from the conversion of SARDARA acquisitions, which have raw counts levels in the orders of magnitude of 10E+06..10E+07, producing properly-formatted output tables. FITS files achieved with older versions of DISCOS (dating back to years 2008-2015) need to be converted into the proper FITS format (ask for a procedure named updatefits.pro).

OUTPUT FILES

The main output files are:

cal_stack_cub_sep.txt     (if the cubic baseline fitting was active)
cal_stack_cub_final.txt   (“)
cal_stack_lin_sep.txt     (if the linear baseline fitting was active)
cal_stack_lin_final.txt   (“)

Such files contain the desired measurements, in particular the columns with the counts-to-Jy factors. The “final” versions are the scan-based ones (used for the further phases), while the “sep” ones show the results separately achieved on the stacked subscans, differentiated by scanning direction (RA and Dec).

Additional files:

gain.txt
cal_prints.txt

gain.txt is useful to those employing CAP to reduce TP data acquired during spectroscopy sessions. The gain values inside this file should not b exploited for direct calibration. Important info is written inside the file itself.

cal_prints.txt contains lots of printouts about the single operations performed by the code.

If the /plot option was chosen, PDFs will appear:

scan-based PDFs inside the main folder (if the /sub option was *not* chosen)
subscan-based PDFs inside the scan folders (if the /sub option was chosen)

c2jtimeline.pro

This procedure performs an averaging or a linear fitting of the previously-produced cnt2Jy values, considering the output tables by runcalib.pro and grouping data according to a time range defined by the user (expressed in hours). By default, this gap is set to 24 hours.

By default, the procedure performs an averaging of the cnt2Jy values inside the provided time range. Users must specify if they want to extract linearly fitted cnt2Jy values (linfit value inside each gap), by setting the /linf option:

IDL> c2jtimeline, /linf

By default, runcalib's output files are searched for inside the ./CALIBRATORS folder. Users might graphically select a different folder by using the /pickpath option:

IDL> c2jtimeline, /pickpath

c2jtimeline'2 detailed results are plotted into .ps files, one devoted to the linear results, one to the cubic results. On screen, by default only the whole dataset/timeline is shown. To also display on screen the detailed plots, each showing the cnt2Jy trends inside a single time interval, use:

IDL> c2jtimeline, /detplot

Notice: the program automatically handles the measurements achieved on TP-like files resulting from the conversion of SARDARA acquisitions, which have raw counts levels in the orders of magnitude of 10E+06, 10E+07, producing properly-formatted output tables.

OUTPUT FILES

According to the previously-seleted options, up to 4 main files will be produced:

cnt2Jy_excub.txt
cnt2Jy_cub.ps
cnt2Jy_exlin.txt
cnt2Jy_lin.ps

Inside the .txt files, the timelines are reported. An MJD validity range is associated to every averaged cnt2Jy value (or to every linearly-fitted timeline). JPGs with more plots will appear if the /detplot option was chosen.

runtarget.pro

This procedure is devoted to the reduction of cross scans acquired on the observed target sources and apply the previously-measured conversion factors (cnt->Jy). It plots and analyses the data obtained by stacking all the subscans contained in any scan (i.e. subfolder) present inside the working folder. If users want to graphically choose the data folder, they must use:

IDL> runtarget, /pickpath    in order to select the path to the data parent folders (otherwise the chosen paths are ./CALIBRATORS and ./TARGETS)
IDL> runtarget, /skypath     in order to select the path to the folder containing skydips (otherwise the chosen path is ./SKYDIPS)

Measurements for all the single subscans can be obtained by explicitly choosing this option:

IDL> runtarget, /sub

The gaussian fitting performed on the (sub)scans can be run using three different baseline-fitting options, in particular:

IDL> runtarget, /linear    performs, and outputs, only the linear fitting of baselines
IDL> runtarget, /cubic     performs, and outputs, only the cubic fitting of baselines
IDL> runtarget, /both      performs, and outputs, both the cubic and linear fitting of baselines

By default, the choice is 'both'.

At present, graphic output is exceedingly slow, in particular for single subscans (if the /sub option is selected). So it is disabled by default. To enable it, explicitly set the option:

IDL> runtarget, /plot

The option:

IDL> runcalib, /skipgc

overrides the use of the standard gain curves; it poses Gain=1 for all the elevations, thus practically avoiding the elevation-dependent gain compensation.

COMPATIBILITY WITH CONVERTED FILES

The program automatically handles the TP-like files resulting from the conversion of SARDARA acquisitions, which have raw counts levels in the orders of magnitude of 10E+06..10E+07, producing properly-formatted output tables. FITS files achieved with older versions of DISCOS (dating back to years 2008-2015) need to be converted into the proper FITS format (ask for a procedure named updatefits.pro).

OUTPUT FILES

The main output files are:

tar_stack_cub_sep.txt     (if the cubic baseline fitting was active)
tar_stack_cub_final.txt   (“)
tar_stack_lin_sep.txt     (if the linear baseline fitting was active)
tar_stack_lin_final.txt   (“)

Such files contain the desired measurements, in particular the columns with the measured flux densities. The “final” versions are the scan-based ones, while the “sep” ones show the results separately achieved on the stacked subscans, differentiated by scanning direction (RA and Dec).

Additional files:

tar_prints.txt

tar_prints.txt contains lots of printouts about the single operations performed by the code.

If the /plot option was chosen, PDFs will appear:

scan-based PDFs inside the main folder (if the /sub option was *not* chosen)
subscan-based PDFs inside the scan folders (if the /sub option was chosen)

srcaver.pro

Program to average the LCP and RCP measurements produced by CAP, performing a source-based weighted mean. Just select runtarget's output file from the graphic interface appearing after launching:

IDL> srcaver

OUTPUT FILE

Results are written in a file named:

Combined_measurements.txt

In case of multiple runs, the generated files are automatically numbered with a sequential suffix. The produced file includes the full path to the original file given in input.