hsdn_restoredata

hsdn_restoredata(vis: list[str] = None, caltable: vdp.VisDependentProperty = None, reffile: vdp.VisDependentProperty = None, products_dir: str = None, copytoraw: vdp.VisDependentProperty = None, rawdata_dir: str = None, hm_rasterscan: str | None = None) Results[source]

Restore flagged and calibration single dish data from a pipeline run.

The hsdn_restoredata task restores flagged and calibrated data from archived MeasurementSets (MSes) and pipeline flagging and calibration data products.

hsdn_restoredata assumes that the MSes to be restored are present in the directory specified by the rawdata_dir (default: '../rawdata').

By default (copytoraw = True), hsdn_restoredata assumes that for each MS in the input list, the corresponding pipeline flagging and calibration data products (in the format produced by the hsdn_exportdata task) are present in the directory specified by products_dir (default: '../products'). At the start of the task, these products are copied from the products_dir to the rawdata_dir.

If copytoraw = False, hsdn_restoredata assumes that these products are to be found in rawdata_dir along with the MSes.

The expected flagging and calibration products (for each MS) include:

  • a compressed tar file of the final flagversions file, e.g. uid___A002_X30a93d_X43e.ms.flagversions.tar.gz

  • a text file containing the applycal instructions, e.g. uid___A002_X30a93d_X43e.ms.calapply.txt

  • a compressed tar file containing the caltables for the parent session, e.g. uid___A001_X74_X29.session_3.caltables.tar.gz

hsdn_restoredata performs the following operations:

  • imports the MS(s)

  • removes the default MS.flagversions directory created by the filler

  • restores the final MS.flagversions directory stored by the pipeline

  • restores the final set of pipeline flags to the MS

  • restores the final calibration state of the MS

  • restores the final calibration tables for each MS

  • applies the calibration tables to each MS

When importing the MS, if the output MS already exists in the output directory, the existing MS will be imported instead.

Parameters:
  • vis --

    list of raw visibility data files to be restored. Assumed to be in the directory specified by rawdata_dir.

    Example: vis=['mg2.ms']

  • caltable --

    Name of output gain calibration tables.

    Example: caltable='ngc5921.gcal'

  • reffile --

    Path to a file containing scaling factors between beams. The format is equals to jyperk.csv with five fields:

    • MS name

    • beam name (instead of antenna name)

    • spectral window id

    • polarization string

    • the scaling factor

    Example for the file is as follows:

    #MS,Beam,Spwid,Polarization,Factor
    mg2-20181016165248-181017.ms,NRO-BEAM0,0,I,1.000000000
    mg2-20181016165248-181017.ms,NRO-BEAM0,1,I,1.000000000
    mg2-20181016165248-181017.ms,NRO-BEAM0,2,I,1.000000000
    mg2-20181016165248-181017.ms,NRO-BEAM0,3,I,1.000000000
    mg2-20181016165248-181017.ms,NRO-BEAM1,0,I,3.000000000
    mg2-20181016165248-181017.ms,NRO-BEAM1,1,I,3.000000000
    mg2-20181016165248-181017.ms,NRO-BEAM1,2,I,3.000000000
    mg2-20181016165248-181017.ms,NRO-BEAM1,3,I,3.000000000
    mg2-20181016165248-181017.ms,NRO-BEAM2,0,I,0.500000000
    mg2-20181016165248-181017.ms,NRO-BEAM2,1,I,0.500000000
    mg2-20181016165248-181017.ms,NRO-BEAM2,2,I,0.500000000
    mg2-20181016165248-181017.ms,NRO-BEAM2,3,I,0.500000000
    mg2-20181016165248-181017.ms,NRO-BEAM3,0,I,2.000000000
    mg2-20181016165248-181017.ms,NRO-BEAM3,1,I,2.000000000
    mg2-20181016165248-181017.ms,NRO-BEAM3,2,I,2.000000000
    mg2-20181016165248-181017.ms,NRO-BEAM3,3,I,2.000000000
    

    If no file name is specified or specified file doesn't exist, all the factors are set to 1.0.

    Example: reffile='', reffile='nroscalefile.csv'

  • products_dir --

    Name of the data products directory.

    Example: products_dir='myproductspath'

    Default: None (equivalent to '../products')

  • copytoraw --

    Copy calibration and flagging tables to raw data directory.

    Example: copytoraw=False

    Default: None (equivalent to True)

  • rawdata_dir --

    Name of the raw data directory.

    Example: rawdata_dir='myrawdatapath'

    Default: None (equivalent to '../rawdata')

  • hm_rasterscan --

    Heuristics method for raster scan analysis. Two analysis modes, time-domain analysis ('time') and direction analysis ('direction'), are available.

    Default: None (equivalent to 'time')

Returns:

The results object for the pipeline task is returned.

Examples

  1. Restore the pipeline results for a single MS in a single session

>>> hsdn_restoredata (vis=['mg2-20181016165248-190320.ms'], reffile='nroscalefactor.csv')