next up previous
Next: ANALYZ instruction sequences HI Up: Spectral-Line Appendices Previous: Some Useful Resources

Basic Analyz Routines - documentation

For use with data taken AFTER March 6, 2000
correlator library help summary.
this file is located (at AO) in /usr/local/src/Analyz/help/cat/other/corlibv2
expanded help available for SEE ALSO functions below the
expanded documentation is in /usr/local/src/Analyz/help/cat/other
last modified: 19dec00 
FUNCTION    
atoldata        ..attach default  online datafile
coravgp     reg ..average two polarizations.
corazzal    regOut scan numrecs... sto az regout,za regout+1
corclose        ..close monitoring socket.
corcmbab    rega regb .. move pola followed by polb to x-reg
cordisp         .. display spectra in corget current display mode.
corext sbcN {reg}  .. load sbcN into x reg from reg.
corfrq      0,1 .. stofreq array in x. 0-->a,1-->polb. use @frqX arrays
corget      parm..input scan.grp to reg1-4. pola,b to reg 5,6.
corhdr          .. print out cor header from last corget.
corhor      sbcnum.. set horizontal scale for sbc n (0=all)
corinfodef      ..set default values for corinfo
corld       reg pol(0,1) {unp:1}..spectra->x,from reg.
corldf      reg pol(0,1) {unp:1}..spectra->y,freq->x.from reg.
corlist         .. list summary of current correlator file attached as data
corpl       {reg}{sbc:1-4,0=all}..plt  vs frq 2pol
corpl.      {reg}{sbc:1-4,0=all}..plt. vs frq 2pol
corpla      {reg}{sbc:1-4,0=all}..plt  vs frq polA
corpla.     {reg}{sbc:1-4,0=all}..plt. vs frq polA
corplb      {reg}{sbc:1-4,0=all}..plt  vs frq polB
corplb.     {reg}{sbc:1-4,0=all}..plt. vs frq polB
corplit     sbcNum(0=all) pol(=0a,1=b)(flag 0/1 donot reset cipl%).corpl uses.
corpos      scan.rec ..position to scan.rec (rec is 5 digits)
corposnr    scan.rec ..position to scan.rec (rec is 5 digits) no rewind.
corprint             .. print hdr info to stdout
corpw       regstart scan numrecs.. store polA,B,az,za to 8 registers.
corpwr          ..move power info to x . 4 numbers each board
corpwrl     regOut scan numrecs.. sto pwr info,az,za
correw          ..reset pointer to start of current file
corsbci     new
corsec      sbcnum pol(0,1)..sec section for sbc 1-4, 0 all A or B,-1 all A+B
corseek     recnum.. seek to record num..no input
corsmooth         ..called by corget to smooth data in reg 1,2
corsplab    reg1  .. split xpolA->reg1, xpolB->reg1+1
corsrci     return srcinfo pl1=ra,pl2=dec, pl(3 4)=srcname
corsum      scan nrecs.. compute summary rec for scan. sto in 5,6
doit        scan recs ..
domany      regSrc regCal scanSt numSets recSrcOn..doset numSets times
doset       regSrc regCal scanSt recSrcOn .on/off src then on/off cal
dosrc       reg scan npairs rec/scan... load avg 
gzacor         ..compute gain(za) for za in xreg. return in xreg
gzacor1     za .. compute gain(za) for input za. return in pl(1)
medfonoff   regStore scan numrecs.. medianfilter then on/off-1
medfscan    regStore scan numrecs.. median filter recs of scan
ndoit       scan numpairs numrecs ..
ndoitsto    regSt scanSt numPairs numrecs..sto (on-off)/off
npair       numpairs numrecs.. accumulate n pairs
pair        numrecs.. process 1 pair
pairpl      {sbc:1-4,0=all}..load,plt  vs frq last onoff
pairpl.     {sbc:1-4,0=all}..load,plt. vs frq last onoff
pairpla     {sbc:1-4,0=all}..load,plt  vs frq polA last onoff
pairpla.    {sbc:1-4,0=all}..load,plt. vs frq polA last onoff
pairplb     {sbc:1-4,0=all}..load,plt  vs frq polB last onoff
pairplb.    {sbc:1-4,0=all}..load,plt. vs frq polB last onoff
storec      regSt scn nrecs .. sto bandpasses
storecnr    regSt scn nrecs .. sto bandpasses
strippr     reg1 reg2 offset step.. strip plt vs freq.
tzacor         ..compute za Tsys correction. input za in x. return in x
tzacor1     za .. compute Tsys za correction for za ,return in p1
DESCRIPTION
----------------
register usage:
----------------
1  - polA sbc  1-n. flipped,scaled, no smoothing
2  - polB sbc  1-n. flipped,scaled, no smoothing
7  - default freq array for corget,cordisp displays
8  - 
9  - scratch reg for corpwrl,corsum (9,10)

10-27 scratch for tsyscon 
      addon,addof for a single pair
20 - addon A  
21 - addon B
22 - addoff A
23 - addoff B
24 - (on-off)/off A
25 - (on-off)/off B

--------------------
basic functions
--------------------
atoldata     .. attach online datafile default datafile

corinfo      .. display current state  

corget     scan.rrrrr
            .. read in scan.rrrrrr (default next rec) and load data:
               reg 1    pol A  sbc 1-n.scaled, flipped (no smoothing)
               reg 1    pol B  sbc 1-n.scaled, flipped (no smoothing)
               If fcidisp is not zero, corpl will be called to display 
                      the data by freq or velocity.
            ex: corget            .. get next record
                corget    .00032  .. get record 32 of current scan
                corget 123.       .. get 1st rec scan 123
                corget 123.00003  .. get record 3 of scan 123
          note: use correw if you have positioned beyond the requested scan.
                scannumber 815600012 can be abbreviated 12 until you
                hit a day change (8157xxxxxx).

corsum     scan.rrrrr
            .. input and compute the summary record for the scan.
               Store the summary record in registers 1 and 2.
               The azimuth and zenith angle for each record is stored in
               the scratch arrays @az, @za.
               Use cordisp or corpl to disp the data.
            ex: corsum        .. compute summary at current position
            ex: corsum  123   .. compute summary for scan 123
          note: you need to do a correw if you are positioned beyond the
                requested scan.
storec   reg scan nrecs
            .. input nrec records starting at scan. store each record 
               (bandpasses) starting at register reg. PolA and PolB are
               concatenated into a single register. This will happily
               cross scan boundaries. Use corpl1 reg to display the data.


-----------------
general plotting
-----------------
 The spectra can be plotted with corpl (or one of it's derivatives).
 The x-axis can be frequency or velocity. The function corinfo will
 display the current setting:

>corinfo 
 disp     =   2.000     (0-no,1-vs frq,2-vel)     f:fcidisp
 offset   =   0.000     (offset   for disp=1)     f:fcioff
 print    =   1.000     (!=0-->print hdrinfo)     f:fciprint
 cals:      0.0000       0.0000
 set default values via func: corinfodef

 You can choose between frequency and velocity with the function fcidisp:
>fcidisp 1      ... will plot versus frequency
>fcidisp 2      ... will plot versus velocity

 If no register is given to corpl, it will default to reg 1,2 (the last 
 spectra read in). corpl assumes that the data is stored differently 
 for registers 1-29 and 30 -> maxreg:
 reg 1-29   polA in reg, polB in reg+1
 reg 30->   polA and polB are stored in the same reg (polA on the left)


corpl  {reg} {sbcnum}
corpla {reg  {sbcnum}optional reg}        
corplb {reg} {sbcnum
              display the spectra vs frequency (fcidisp 1) or  by velocity
              (fcidisp 2). If sbcnum is given, then just plot that sub 
              correlator. If A/B is used then just plot polA. 
              reg can be:
                none - default to 1,2 .. registers loaded by corget.
                < 30 - use reg and reg+1 for pola,polB
                >=30.. register has polA,polB packed in 1 register
                       (see storec, doset,domany, etc..)

            examples:
             fcidisp 2
             corpl    .. plots 1  (polA), 2  (polB) vs vel
             fcidisp 1
             corpl 24 .. plots 24 (polA), 25 (polB) vs freq 
SEE ALSO help corpl
corpl. {optional reg}        
              same as corpl but uses plotxy. for plotting. 
              multiple calls within a function will overplot.
            ex: corpl.    .. plots 1  (polA), 2  (polB) vs freq or velocity
            ex: corpl. 24 .. plots 24 (polA), 25 (polB) vs freq or velocity

corpos     scan    
            .. position to start of scan. A rewind is automatically done
               before the positioning.
            ex: corpos 123   .. position to scan 123.

corposnr   scan    
            .. position to start of scan with no rewind. Scan must be
                 after current position in file (if not use corpos). For
                 large files doing sequential positioning, this routine much
                 faster than corpos.
            ex: corposnr 123   .. position to scan 123.

corseek  recnum  
             .. seek to record recnum of current scan. The record is not input.
correw       .. rewind to start of file
corlist      .. list current file attached as data
corprint     .. print out hdr info of last record input
corhdr       .. print standard and correlator header of last record input

corpwr       .. extract power info from header for current record. 16 numbers
               in sbc order are stored in x reg:
               sbc1pcA sbc1pcB sbc1lag0A sbc1lag0B ..
               sbc2pcA sbc2pcB sbc2lag0A sbc2lag0B .. etc

corpwrl  reg1 scan numRecs
            .. read numRecs records starting at scan. extract the
               power information,az,za and store in registers.
               The nth entry in a register is from the nth record input.
               register 9 is used as a scratch register.
            reg1   : lag0A sbc1
            reg1+ 1: lag0A sbc2
            reg1+ 2: lag0A sbc3
            reg1+ 3: lag0A sbc4
            reg1+ 4: lag0B sbc1
            reg1+ 5: lag0B sbc2
            reg1+ 6: lag0B sbc3
            reg1+ 7: lag0B sbc4
            reg1+ 8: pwrCA sbc1
            reg1+ 9: pwrCA sbc2
            reg1+10: pwrCA sbc3
            reg1+11: pwrCA sbc4
            reg1+12: pwrCB sbc1
            reg1+13: pwrCB sbc2
            reg1+14: pwrCB sbc3
            reg1+15: pwrCB sbc4
            reg1+16: az position 
            reg1+17: za position dome
              where reg(n) is the nth record from the start.
----------------------------------
utility routines
----------------------------------
coravgp  regnum  SEE ALSO help coravgp
            average polA,B. If regnum <30 then pola is in regnum and 
            polB is in regnum+1. If regnum >= 30 then polA,polB are packed
            in regnum. The averaged spectra are left in the x-reg.

corfrq  {0,1}
            load the x register with the frequency valuse for polA or polB.
            (0== polA, 1==polB). Used by corpl,pairpl, etc..
            ex. corfrq 0  .. loads x-reg with polA freq.

corext sbcN {reg}
            extract sbc N (N=1..4) from reg 1,2 (no reg)  or reg,reg+1
            x=polA,y=polB,z=freqA.
  
corhor {1..4}    SEE ALSO help corhor
            set horizontal freqendy scale for sbc n =1 to 4.

corld   {reg} {polA,B 0,1} {unpacked:1/0}   SEE ALSO help corld
              load spectra into x-reg. used mainly by other functions.

corsbci sbcnum 0/1
          return indices in reg 1,2 for sbcnum. 0==polA, 1==polB. return
          info in pl array.
          ex. corsbci 2 0
              pl(1 2) index start,end in reg
              pl(3 4) frequency start/end
              pl(5)   length this sbc.
              pl(6)   freqMhz to use when computing velocity array.
corsec  {sbc} {pola,b: 0,1}    SEE ALSO help corsec
            set section size to display sbc.

corcmbab reg1 reg2 
           assume reg1,reg2 hold pola,polB. combine these in the x-reg
           so you have polA followed by polB.
corsmooth 
           smoothing function to appply to each sbc. This is done when
           corget loads registers 1,2

corsplab reg1      
           assume x-reg has polA followed by polb. Put polA in reg1
           and polB in reg1+1.
corsrci
          return in pl(1-4) src info from the  last call to corget. 
          pl(1):ra[hours],pl(2):dec[deg],pl(3 4) srcname ascii.
          note: use .. alpha 8.. to get all 8 chars/word in pl(3 4)

medfscan regStore scan numrecs
          median filter by channel the records in scan. There are
          numrecs records in scan. Leave the median filter spectra in 
          x-reg. Use regStore to regStore+numrecs-1 as scratch.
          medfscan 101 123 50 ..

medfonoff  regStore scan numrecs
          median filter by channel scan and scan+1 and then compute
          on/off. Leave data in regs:
          reg 20 - median filtered on position.  polA followed by polB
          reg 21 - median filtered on position.  polB
          reg 22 - median filtered off position.  polA followed by polB
          reg 23 - median filtered off position.  polB
          reg 24 - on/off-1 .
medfonoff2  regStore scan numrecs
          compute on/off-1 by rec and then median filter.
            used regStore to regStore +2*numrecs-1 as scratch 
          Leave data in regs:
          reg 23 - median filtered off position.  polB
          reg 24 - on/off-1 .

-----------------------------------
on/off position switching routines
-----------------------------------

general routines:

doit  scan recs 
            .. position, do a single pair, then plot the results:
               corpos scan; pair recs; pairpl
            ex: doit 123 2  .. do a on/off pair starting at scan 123 with
                               2 recs in on and 2 in off.
               data is left in registers 24 polA, 25 polB

pairpl  {reg}
            .. plot on/off-1 for the data in registers reg (polA) and
               reg+1 (polB). offset polB by value from fcioff. Default
               register is 24,25. This routine is the same as corpl (
               except that the default register is different).
            ex: pairpl    .. plot on/off-1 from register 24,25 vs 8
                pairpl 28 .. plot on/off-1 from register 28,29 vs 8

dosrc    regSt scan numpairs recs/scan
            .. process numpairs on/off pairs starting at scan. Store the
               individual on/off-1 starting at regSt (polA followed by polB
               in one register). Compute the average for all the on/off-1
               and store in register regSt+numpairs. Set the variables 
               regS:start reg, regE:endReg regA:average reg. 
            ex: dosrc 31 123 10 4 .. do 10 pairs starting at scan 123.
                store each on/off-1 starting at reg 31. There are 4 recs
                in an on or off. The average will be stored in 
                reg 31+10=41. Plot the average with  corpl1 41.
                This assumes there are no cal records between the on/offs.
domany   regSrc regCal scan numsets recsSrcon
            .. call doset to process an on/off src starting at scan, then
               process a cal on/off pair. repeat this for numSets times.
               This routine should be used to process data taken with the
               onoff datataking routine when cal scans are included.
               register usage:
                 regSrc,regSrc+numSets-1.. the on/off-1 for the src scans
                 regSrc+numSets         .. the avg for the src on/off-1
                 regCal,regCal+numSets-1.. the on/off-1 for the cal scans
                 regCal+numSets         .. the avg for the Cal on/off-1
              This routine assumes:
              1. that there are recsSrcOn records for the source on or 
                 off in each scan.
              2. that the cal on /off each contain a single record.
              3. that the scan numbers are contiguous.
              4. the src average will be meaningfull if it was the 
                 same src.
             ex: domany 101 151 123 10 5
                 Process 10 sets of on/off, cal pairs. 
                 The scan for the first on is 123
                 Store the src data in reg 101-110, avg in 111 
                 Store the cal data in reg 151-160, avg in 161 
                 there are 5 records in each src scan.
                 corpl1 111 will look at the src average.
              

routines used by the above:

clear          
            .. clear on/off accum registers (20-23)
addon  numrecs
            .. add numrecs (default 1) to the  on registers (20,21)

addoff numrecs
            .. add numrecs (default 1) to the off registers (20,21)

pair   numrecs
            .. Do an on/off pair from the current disc position: 
               clear;addon numrecs;addoff numrecs; compute on/off -1 
               20,21 have the sum of ons, 22,23 have the sum of offs
               24,25 have on/off-1 (polA,polB)
            ex: pair 4 .. do on/off pairs with 4 records per scan

npair numpairs numrecs
           .. accumulate numpairs pairs startin at the current position,
              then compute on/off-1. The results  are stored in reg 20-25
           ex: npair 4 4  .. process 4 pairs. each pair has 4 recs in on,off.


ndoit scan numpairs numrecs 
            .. position to scan, accumulate numpairs pairs, then plot
               the results. The data is stored in reg 20-25.The code is:
                 corpos;npair numpairs numrecs;pairpl
            ex: ndoit 123 5 2 ... position to scan 123 then accumulate 5 pairs
                each with 2 recs per on, off.

ndoitsto reg scan numpairs numrecs 
            .. process numpairs pairs. Store the on/off-1 starting at
               register reg (polA followed by polB in 1 reg). 
               each on/off pair should have numrecs records in an on or off.
            ex: ndoitsot 31 123 10 3 .. process 10 pairs starting at scan
                123. Each pair has 3 recs in the on or off. Store the 
                individual on/off-1 starting at reg 31. 

online:
corclose      . close socket for monitoring

-----------------------------------
misc functions
-----------------------------------
gzacor1 za  ..compute the telescope gain at zenith angle=za. Return value
              in pl(1). Units are Tsys(za=3deg).

gzacor      ..compute the telescope gain fo zenth angles
              passed in via the x-register. Return the gain the in x-reg.
              Units are Tsys(za=3deg).

tzacor1 za  ..compute the system temperature correction for za. 
              return value in pl(1). Normalized so Tsys(za=3) is unity.

tzacor      ..compute the system temperature correction for zenth angles
              passed in the x-register. Return the corrections in x-reg.
              Normalized so Tsys(za=3) is unity.

-----------------------------------
examples:
-----------------------------------
..  attach datafile
attach '/share/olcor/corfile.24mar00.a1354.1 data 

..  set to display vs velocity, offset polB by .1
fcidisp 2
fcioff  .1

..  check that the changes were made:
corinfo
> corinfo
disp     =      2.0000 (0-no,1-vs frq,2-vel)     f:fcidisp
offset   =      0.1000 (offset   for disp=1)     f:fcioff
print    =      1.0000 (!=0-->print hdrinfo)     f:fciprint

..  input and display 1st record of scan 1234
corget 1234 
..  input and display next record (auto advance)
corget
..  just display 2st sbc of last input record 
corpl 1 2

.. input position switch data followed by cal on/off. Assume there are
   50 records in the on (6 second dumps, 5 minutes). Also assume that there
   are 3 sets of on/off calon/off for this source starting at scan
   511. store the on/off starting at reg 101 and the cals at 201
domany 101 201 511  3 5
..  display the average data in reg 106
corpl 106
.. sum the polarizations and store in reg 110, then display it.
coravgp 106;sto 110
corpla 110

********************************************************************************


koneil@naic.edu