Cal Library for On-the-fly Calibration

1. Introduction

An overview of the motivation for and use of the calibration library file can be found in the attached document, prepared for CASA Release 4.4:

2. Cal Library Parser

The CalLibrary parser code has been added in code/synthesis/CalLibrary. The parser uses Bison and Flex so these packages are now required to build the code tree.
  • CalLibraryGram.ll - Flex file
  • CalLibraryGram.yy - Bison file
  •, .h - methods called by Bison to build output Record
  •, .h - callibSetParams and CalLibrary parse commands

To invoke the parser:
#include <synthesis/CalLibrary/CalLibraryTools.h>
String calLibrary;
Record callibRec = callibSetParams(calLibrary);

The calLibrary String argument can be a filename (fully qualified path) or calibration instructions separated by a comma for each caltable. The parser's input is always a string. A casa Record is returned.

  • CalLibraryParse block diagram:
  • callibSetParams argument is a filename:
    • The file is opened and lines (terminated with "\n") are concatenated into a single string.
  • callibSetParams argument is a string of one or more calibration instruction sets, corresponding to the contents of a cal library file:
    • Examples:
      • "caltable='ngc5921.bcal' calwt=True tinterp='nearest'"
      • "caltable='ngc5921.bcal' calwt=True tinterp='nearest', caltable='ngc5921.fluxscale' calwt=True tinterp='nearest' fldmap='nearest'" (list of strings joined with a comma separator into a single string)

2.1 Future plans

  1. A new class will be developed by George Moellenbrock to hold the calibration instructions. This class will have a constructor or method to accept a Record and store the specified instructions, along with providing consistency checks. There will also be a way to validate the cal library without having to run a tool such as applycal or plotms.
    • Cal Library parser v2a:
  2. FInally, the parser will be modified to parse the cal library file/string into the new class, without the interim step of creating a Record.
    • Cal Library parser v3:

2.2 Parser use in plotms

  1. Initially in release 4.5 development, the plotms 'callib' argument is a string or list of strings:
    • The filename string can be set as the plotms callib argument or using the GUI file browser on the Calibration tab
    • The callib argument string can contain calibration instructions
    • The list of instruction strings is converted in python to a comma-separated single string and passed to plotms_cmpt
    • The callib String is stored in the PlotMSCalibration class. When the accessor PlotMSCalibration::callibRec() is called, the callibSetParams function is called to use the parser as described above, and the resulting Record returned. Plotms inserts this Record into the MSTransformIteratorFactory configuration Record as in 4.4.
  2. Later in 4.5 development, the callib string will be passed to the iterator factory in the configuration Record. Parsing the string into a Record will happen when the Calibrater class needs to process the instructions, so plotms will no longer invoke the parser. In fact, all future clients of the cal library will not need to know about the parser but will pass an appropriate string down to the Calibrater.
    • MSTransformManager, LayeredVI2Factory, CalibratingVi2FactoryI, and possibly other code, will need to be modified to accept a String rather than a Record to set up a calibrating VI2.

2.3 Testing the parser

  • A test program tCalLibraryParse has been developed in synthesis/CalLibrary/test.
    • To compile this test, in code/build type "make tCalLibraryParse". The executable will be in code/build/synthesis/tCalLibraryParse.
    • To run the regression test with saved calibration instructions (a string, multiple strings, and a file), just run tCalLibraryParse. The resulting Records will be checked for number of fields and various parameter values.
    • To test a string filename or calibration instructions, run the test with an optional filename or string:
      • tCalLibraryParse /tmp/callib.txt
      • tCalLibraryParse "caltable='ngc5921.bcal' calwt=False tinterp='nearest'"
      • For these user-input tests, the resulting Record will be printed to standard output.

-- PamFord - 2015-06-18
Topic attachments
I Attachment Action Size DateSorted ascending Who Comment
callibQR_v3.txttxt callibQR_v3.txt manage 12 K 2015-06-18 - 18:58 PamFord Cal Library Quick Reference, v3 - G. Moellenbrock
cal_lib_parser.jpgjpg cal_lib_parser.jpg manage 5 K 2015-06-19 - 12:24 PamFord Cal Library parser block diagram
callibparser2.jpgjpg callibparser2.jpg manage 7 K 2015-06-19 - 17:03 PamFord Cal Library parser v2
callibparser2a.jpgjpg callibparser2a.jpg manage 9 K 2015-06-19 - 18:47 PamFord Cal Library parser v2a
callibparser3.jpgjpg callibparser3.jpg manage 7 K 2015-06-19 - 18:48 PamFord Cal Library parser v3
Topic revision: r6 - 2015-06-30, PamFord
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