Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.mrao.cam.ac.uk/~bn204/alma/sweng/casacreategaintable.html
Дата изменения: Mon Apr 4 13:47:51 2016
Дата индексирования: Sun Apr 10 10:23:59 2016
Кодировка: ISO8859-5
How to create a gain (or other calibration) table for CASA — Bojan Nikolic web pages (r. 329)

How to create a gain (or other calibration) table for CASAТЖ

Here is a minimal C++ program that can write out a new gain table for later use in CASA. This program uses and requires an installation of the full CASA libraries. There is more full and complex example of how to this contained within the code/synthesis/implement/MeasurementComponents/SolvableVisCal.cc file of the CASA source distribution.

// Bojan Nikolic <b.nikolic@mrao.cam.ac.uk>, <bojan@bnikolic.co.uk>
// A simple illustration of how to create and write out a gain table
// for CASA using C++

#include <calibration/CalTables/CalTable.h>
#include <calibration/CalTables/SolvableVJTable.h>
#include <calibration/CalTables/CalSet.h>


void createRndmGainTbl(const char *fnameout)
{
  using namespace casa;

  const size_t spw=0;
  const size_t nAnt=3;

  const double deltat=1.0;
  const double tstart=0.0;
  const double tend=1000.0;

  const size_t ntimes=(tend-tstart)/deltat;

  Vector<Int> nChan(1, 1);
  Vector<Int> nTime(1, ntimes);
  CalSet<Complex> cs(1, 1, nChan,
                     nAnt,
                     nTime);
  cs.initCalTableDesc("T Jones",
                      VisCalEnum::COMPLEX);
    

  for(size_t i=0; i<ntimes; ++i)
  {
    const size_t slot=i;

    cs.fieldId(spw)(slot)=0;
    cs.time(spw)(slot)=tstart+deltat*i;

    cs.startTime(spw)(slot)=tstart+deltat*(i-0.5);
    cs.stopTime(spw)(slot) =tstart+deltat*(i+0.5);
    
    cs.iFit(spw).column(slot)=1.0;
    cs.iFitwt(spw).column(slot)=1.0;
    cs.fit(spw)(slot)=1.0;
    cs.fitwt(spw)(slot)=1.0;

    // These IPositions define the range to fill with data in this
    // iteration
    IPosition blc4(4,
                   0,
                   0,
                   0,        
                   slot);
      
    IPosition trc4(4,
                   // Number of parameters -1 
                   0,
                   // Number of channels -1
                   0,
                   // Number of elements (antennas) -1 
                   2,
                   slot);
      
    cs.par(spw)(blc4,trc4).nonDegenerate(3) = 0.99;
      
    cs.parOK(spw)(blc4,trc4).nonDegenerate(3)= True;
    cs.parErr(spw)(blc4,trc4).nonDegenerate(3)= 0;
    cs.parSNR(spw)(blc4,trc4).nonDegenerate(3)= 3;
      
    cs.solutionOK(spw)(slot) = True;
      
  }
    
  cs.store(fnameout,
           "T Jones",
           False);
}

We will be using such code to write out gain calibration tables based on the ALMA WVR.

Previous topic

Introduction to SCons

Next topic

Some notes on Python relevant to ALMA and ALMA data reduction