Usage for modifyPPR

Return to directory of Todd's CASA extensions

Return to pipeline instructions

This function reads an existing pipeline processing request xml file (PPR) and writes a new version with modifications. (Typically you generate the initial PPR by running pipelineMakeRequest once you know the ObsUnitSet name (OUS), either with getOUS or from the Project Tracker.) In general, for each hif function that it touches, you must specify all of the modifications that you need, even if they already exist in the input file from an earlier execution of modifyPPR(). In other words, if a parameter requires a modification to a parameter for hif_wvrgcal, it wipes the slate clean of any existing hif_wvrgcal options. See also analyzemscal and getOUS.


import analyzemscal as amc
amc.modifyPPR(ppr, refant='', newpprname='', wvrflag='',
              phaseupbw='', tie=True, wvrqa2intent='', wvrgcalflag='',
              asdm='', resolvedcals='', bpsolint='', toffset=None,
              fluxdensity=None, vis=[], tsysflag_shape_fhi_limit='',
              stopaftertsysflag=False, debug=False, overwrite=False,
              usems=False, stopafterimport=False, skipwvr=False,
              skipflagdata=False, stopafterwvr=False, flagdata=False,
              tiesources='',field=None, flag_edges=False, flag_sharps='',
              sharps2_limit=default_sharps2_limit, metric='antenna_median',
              startbeforetsysflagchans=False, tsysflag_intentgroups='',
              sharps2b_limit='', atmflag_nmedian=False,
              atmflag_intent='', stopaftertsyscal=False,
              tsysflagchans_intentgroups='',bpflagchans=False, fitorder=None,
              fitfunc=None,edge=None,tsysChanTol=None, asdmDiskName='',asis='',
              maxdistm=None, minnumants=None, bdfflags=None, imageSources=[],
              dbservice=None, tsysNormalize=None, nbins='', clearcals=True,
              moveBpBefore='', skipcontsub=False):
General parameters:
  • ppr : the filename of the existing PPR file
  • newpprname : the name of the new PPR file (default: appends selected options to the current filename) Set to False in order to modify the existing file (but it will first copy the original PPR to .original).
  • asdm: if a PPR contains multiple ASDMs, use this parameter to only include the one specified ASDM (the last four letters is enough) or a list of ASDMs: e.g. 'Xcde,Xeff'
  • asdmDiskName: if not blank, use this string as the name of the ASDM
  • usems: If True, then change the existing AsdmDiskName entries to *.ms
  • vis: use this parameter to pass the name of an ms to hif_importdata, instead of the ASDM
  • stopafterimport : Only copy commands until the first hif_flagdata
  • stopaftertsyscal : Only copy commands until the first hif_tsysflag
  • stopaftertsysflag : Only copy commands until the first hif_setjy or hif_antpos
  • stopafterwvr : Only copy commands until the first hif_tsyscal
  • startbeforetsysflagchans : Only copy the importdata, tsyscal & tsysflagchans stages
  • stopAfterCalibration : True will strip out the imaging portion if present
  • overwrite: set the overwrite parameter in hif_importdata
  • clearcals: if False, then set clearcals=False in importdata
  • moveBpBefore: if specified as a hif(a) task, then move the breakpoint to before the first execution of this task, e.g. 'hifa_flagtargets'.
Calibration parameters:
  • asis: set the asis parameter in hif_importdata
  • atmflag_nmedian: if set to a value, then insert atmflag(flag_nmedian=True,fnm_limit=value)
  • atmflag_intent: which intents to flag (default: '' = calibrators only)
  • bdfflags: sets the bdfflags option of hifa_importdata (True or False)
  • bpflagchans: if True, then insert this stage before hif_gfluxscale
  • bpsolint: set to 'inf,20ch' to emulate manual script for FDM data set to 'inf,7.8125MHz' to get 16 channel smoothing on widest F\DM
  • dbservice: sets the dbservice option of hifa_importdata (True or False)
  • edge_limit: floating point, set this parameter in a new hif_tsysflagchans stage
  • field: the field (name or ID) to use for the fluxdensity values
  • flag_edges: Boolean, set this parameter in a new hif_tsysflagchans stage
  • flag_sharps: Boolean, set this parameter in a new hif_tsysflagchans stage
  • flag_sharps2: Boolean, set this parameter in a new hif_tsysflagchans stage
  • flag_sharps2b: Boolean, set this parameter in a 2nd new hif_tsysflagchans stage
  • fluxcal_linesfile: a list of additional lines to flag in the flux calibrator
  • flagdata: True: insert the template=True option into hif_flagdata string filename: same as True, but also insert the filetemplate parameter=filename
  • fluxdensity: the value (or list) to give to hif_setjy for the I Stokes parameter, e.g. [7.8,7.8,7.4,7.4]
  • maxdistm: for wvrgcal (default = 500.0m)
  • metric: metric to use in a new hif_tsysflagchans stage (default='antenna_median')
  • metricb: metric to use in a 2nd new hif_tsysflagchans stage (default='median')
  • minnumants: for wvrgcal (default = 2)
  • phaseupbw : the central spw bandwidth to use in the pre-bandpass gaincal
  • refant : the antenna name to use as reference (e.g. 'DV04')
  • resolvedcals : set to 'manual' to use all antennas
  • sharps_limit: floating point, set this parameter in a new hif_tsysflagchans stage
  • sharps2_limit: floating point, set this parameter in a new hif_tsysflagchans stage
  • sharps2b_limit: Boolean, set this parameter in a 2nd new hif_tsysflagchans stage
  • skipflagdata: do not run hif_flagdata
  • skipwvr: do not run hif_wvrgcal
  • spw: a list of spws, used with the fluxdensity parameter to specify the order of spw flux densities (e.g. [17,19,21,23])
  • tie: default=True: automatic, False: sets hm_tie to 'manual' and tie=tiesources
  • tiesources: if tie==False, sets the value of tie (e.g. '' or '3c273,3c279')
  • toffset: The value in seconds to pass to wvrgcal or wvrgcalflag
  • tsysChanTol: integer value for tsysspwmap, pipeline defaults to 1
  • tsysflag_shape_fhi_limit: Set the fhi_limit parameter of tsysflag shape
  • tsysflag_intentgroups: Set intentgroups in tsysflag stages
  • tsysflagchan_intentgroups: Set intentgroups tsysflagchans stages
  • tsysNormalize: sets the normalize_tsys option of hifa_tsysflag (not compatible with specifying other tsysflag options)
  • wvr_fhi_limit: a floating point value (default: '' = 5.0)
  • wvrflag : a comma-delimited string list of antennas to flag
  • wvrgcalflag : if True, replaces hif_wvrgcal with hif_wvrgcalflag
  • wvrgcalflag_intent : default='*BANDPASS*', but can be '*PHASE*,*BANDPASS*'
  • wvrqa2intent: the qa2_intent to pass to hif_wvrgcal (e.g. '*BANDPASS*')
  • wvrsmooth: '' (default), 'automatic', or an integer # of samples

Single-dish calibration parameters:
  • fitorder: set the fit order in hsd_baseline
  • fitfunc: set the fitting function in hsd_baseline (poly or spline)
  • edge: set the edge parameter in hsd_baseline (must be a list of length 2)

Imaging parameters:
  • imageSources: a list or comma-delimited string of source names to image, if this is an imaging PPR. Also inserts into the calls to hif_uvcontfit and hif_uvcontsub.
  • nbins: inserts the specified nbins parameter into the second and fourth calls to makeimlist: e.g. ':2' or '17:2,19:2' etc.
  • skipcontsub: if True, removes findcont, uvcontfit, uvcontsub, and cube imaging


Example 1: This example will set the reference antenna to DV04, and select only the ASDM ending in 'X91' for processing (from a multi-ASDM OUS).
CASA <3>: amc.modifyPPR('PPR.xml', refant='DV04', asdm='X91')
New ppr left in:  PPR__refant_DV04__X91.xml
CASA <4>: 

Example 2: The following is an example of a text file that will flag FDM edge channels, and some birdies in a dataset. You can either create manually by following the help for flagdata, or if you have the ms loaded, you can run flagdata(savepars=True,action='calculate',outfile='your_uid_flagtemplate.txt') along with the other data selection parameters that you need.

antenna='CM02' spw='20:3040~3150,18:3080~3140'
antenna='CM06' spw='20:3040~3150,18:3119~3126'
antenna='CM07' spw='20:3210~3260,18:3220~3280'

Note that if your flux calibrator does not have the CALIBRATE_FLUX or CALIBRATE_AMPLI intent, you will need to run au.editIntents before running the pipeline. -- ToddHunter - 2013-01-03
Topic revision: r46 - 2016-10-20, ToddHunter
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding NRAO Public Wiki? Send feedback