Alfa Rcvr monitoring routines

Last modified: Thu Mar 16 13:07:05 2023.


List of Routines


Routine Descriptions

AM0INTRO - USING THE ALFAMON ROUTINES:

[Next Routine] [List of Routines]
NAME:
am0intro - Using the alfamon  routines:
    
    Alfa has a dewar monitoring package that lets us monitor the
dewar temperatures, bias voltages and currents, as well as some of the
power supply voltages. 

	The data is sampled once every 300 seconds.  This processes continues 
24 hours a day. The data is written to disc in  ascii format. The current
file is /share/cima/Logs/ALFA_logs/alfa_logger.log. At the end of 
each month the data is moved to alfa_logger_yyyy_mm.log.

Each of the files contains about 10Mbytes of data. The data is stored
sequentially in time as it is sampled.

    The routines in the alfamon package let you access and plot this data. You
need to be a bit careful what you ask for (because you might get it..). 
Run idl on a computer with lots of memory (say alocn)

    The main routines used by users are:
    
aminpday() - input one or more days of data.
amplot()   - plot the temperature,voltages, or currents that were input.
 
ammon()    - input and plot the data for a day, or continually monitor
             the current values. (not yet implemented..)

The other routines are support routines used by these 3.

The data structure used for each sample is:

DL> help,d,/st
** Structure ALFAMON, 21 tags, length=664, data length=662:
   TMA       STRING '20090202000417' yyyymmddhhmmss in ascii
   JD        DOUBLE 2454864.7
   BIAS_CTL  INT    0              0 local, 1 remote
   BIAS_STAT INT    Array[2, 7]    [pol,beam] 0 off, 1 amps on ; 
   VD        FLOAT  Array[2, 7, 3] [pol,beam,stage1,2,3] drain Voltage
   ID        FLOAT  Array[2, 7, 3] [pol,beam,stage1,2,3] drain Current
   VG        FLOAT  Array[2, 7, 3] [pol,beam,stage1,2,3] gate Voltage
   T20       FLOAT  Array[4]       20K temp K1..K4
   T70       FLOAT  Array[4]       70K temp K1..K4
   V32P      FLOAT  31.9630        Plus 32Volt power supply
   V20P      FLOAT  19.9060        Plus 20 Volt power supply
   V20N      FLOAT  -20.1310       negative 20 Volt power supply
   V9P       FLOAT  8.77000        Plus 9 Volt power supply
   V15P      FLOAT  Array[6]       Plus 15 Volt power supply R1..R6
   V15N      FLOAT  Array[4]       Neg  15 Volt power supply R1..R4
   V5P       FLOAT  Array[2]       Plus 5 Volt power supply R1..R2
   CALCTL    INT    3
   NSELEV    INT    1
   NSEDIODET INT    0
   VACSTAT   INT   96
   VACLEV    FLOAT  0.00000

aminpday will input an array of these structures d[n]. You can use amplot
to plot the data, or you can use the normal idl plot routines for plotting.


EXAMPLES:
;  start idl
    idl
    @phil
    @alfamoninit

; input 01feb09 thru 10feb09
 
    nrecs=aminpday(20090201,d,lastday=20090210) ; 
;  plot the 16/70  k stage using colors for each and ascii dates
    ver,0,30
    amplot,d,/adate,/temp
;
; plot the bias Drain currents for the third stage amps
    amplot,d,Id=3,/adate

(See /pkg/rsi/local/libao/phil/alfamon/am0intro.pro)


AMGETFILE - FIND THE FILES FOR THE SPECIFIED DATE(S)

[Previous Routine] [Next Routine] [List of Routines]
NAME:
amgetfile - find the files for the specified date(s)
SYNTAX: nfiles=amgetfile(yymmdd1,yymmdd2,filelist,ndays=ndays)
ARGS:
   yymmdd1: long  date for first day to read 
   yymmdd2: long  date for last day of interest
KEYWORDS:
   ndays: long find files for ndays starting at yymmdd1. In this case
               ignore yymmdd2.
RETURNS:
   nfiles: number of files found.
   filelist[nfiles]: list of files.
   yymmdd2: will return the actual last day used (in case you have
            requested something in the future.
DESCRIPTION:
   Return the list of filenames that contain the data for yymmdd1 through
yymmdd2 (astdates). If keyword ndays is provided then return the list of
filenames for the ndays of data starting at yymmdd1 and return yymmdd2.
   The data is stored by month.

EXAMPLE:
   Get the files for oct02 through dec02
   nfiles=amgetfile(021001,021230,filelist)
   print,nfiles
   3
   print,filelist

(See /pkg/rsi/local/libao/phil/alfamon/amgetfile.pro)


AMINPDAY - INPUT 1 OR MORE DAYS OF ALFAMON INFO

[Previous Routine] [Next Routine] [List of Routines]
NAME:
aminpday - input 1 or more days of alfamon info
SYNTAX: nrecs=aminpday(yymmdd1,d,lastday=yymmdd2,ndays=ndays,$
                       smo=smo,curfile=curfile,dayno=dayno,year=year)
ARGS:
   long :   yymmdd1 day to input (unless dayno specified)
KEYWORDS:
   lastday:long return data from days yymmdd1 through yymmdd2
				 (unless keyword set dayno)
   ndays  :long return ndays starting at yymmdd1
   smo    :long smooth and decimate the data by this many sample points.
                the datapoints are normally spaces by 300 seconds.
   curfile:     if set, use current file, (used for maintenance purposes)
   dayno  :long if supplied, then set yymmdd1 to dayno,year

RETURNS:
   nrecs: number of entries in d
   d[nrecs]: {alfamon} the alfamon data. 1 entry per measurement.

DESCRIPTION:
   Input the alfar monitor data for the date yymmdd1. If the
keyword lastday is provided then input data from yymmdd1 through yymmdd2.
If the keyword ndays is provided then input ndays of data starting at
yymmdd1 (ndays overrides lastday). If no keywords are provided just input
the one day. 
   
The  data is sampled once every 300 seconds. The data is returned as an array
of structures d[nrecs]. Each ;entry contains:

IDL> help,a,/st
** Structure ALFAMON, 21 tags, length=664, data length=662:
   TMA       STRING ''                  yyyymmddhhmmss in ascii
   JD        DOUBLE 0.0000000
   BIAS_CTL  INT    0				0 local, 1 remote
   BIAS_STAT INT    Array[2, 7]    [pol,beam] 0 off, 1 amps on ; 
   VD        FLOAT  Array[2, 7, 3] [pol,beam,stage1,2,3] drain Voltage
   ID        FLOAT  Array[2, 7, 3] [pol,beam,stage1,2,3] drain Current
   VG        FLOAT  Array[2, 7, 3] [pol,beam,stage1,2,3] gate Voltage
   T20       FLOAT  Array[4]       20K temp K1..K4
   T70       FLOAT  Array[4]		70K temp K1..K4
   V32P      FLOAT  0.00000        Plus 32Volt power supply
   V20P      FLOAT  0.00000        Plus 20 Volt power supply
   V20N      FLOAT  0.00000        negative 20 Volt power supply
   V9P       FLOAT  0.00000        Plus 9 Volt power supply
   V15P      FLOAT  Array[6]       Plus 15 Volt power supply R1..R6
   V15N      FLOAT  Array[4]       Neg  15 Volt power supply R1..R4
   V5P       FLOAT  Array[2]       Plus 5 Volt power supply R1..R2
   CALCTL    INT    0
   NSELEV    INT    0
   NSEDIODET INT    0
   VACSTAT   INT    0
   VACLEV    FLOAT  0.00000

(See /pkg/rsi/local/libao/phil/alfamon/aminpday.pro)


AMINPRECS - INPUT ALFAMON RECORDS

[Previous Routine] [Next Routine] [List of Routines]
NAME:
aminprecs - input alfamon records 
SYNTAX: nrecs=aminprecs(lun,nrecsReq,d,smo=smo,yyyymmdd1=yyyymmdd1,$
                        yyyymmdd2=yyyymmdd2)
ARGS:
   lun :       int file containing data to read
   nrecsReq:  long requested number of records to read
KEYWORDS:
      smo: int smooth and decimate by this amount.  should be an odd number
               >= 3. The data will be smoothed and decimated by this amount.
yyyymmdd1: long      if supplied then start inputting nrecsReq when you hit
                     this date.
yyyymmdd2: long      if supplied then stop inputting recs when you go beyond
                     this date.

RETURNS:
   nrecs : long    number of records input.
   d[nrecs]:{alfamon} data input from file
DESCRIPTION:
   This routine is normally called via aminpday or ammoninp.

   aminprecs will try to read the requested number of records from the 
alfa log monitoring file that lun points to (you need to open the file
before calling this routine). The number of records actually read is
returned in nrecs. The routine will preallocate an array of nrecsReq
before reading.
Note: the dates are ast

EXAMPLE:
   openr,lun,'/share/cima/Logs/alfa_loggerlog',/get_lun
   nrecs=aminprecs(lun,9999,d)

(See /pkg/rsi/local/libao/phil/alfamon/aminprecs.pro)


AMPLOT - PLOT ALFA DEWAR MONITORING

[Previous Routine] [Next Routine] [List of Routines]
NAME:
amplot - plot alfa dewar monitoring
SYNTAX: amplot,d,temp=temp,Id=Id,Vd=vd,Vg=vg,over=over,sym=sym,
               color=col,ln=ln,adate=adate,drange=drange,$
               cs=cs,log=log,v1=v1,v2=v2,cont=cont,vmed=vmed,labbm=labbm,
               xpinc=xpinc,tosmo=tosmo,useoff=useoff,fl=fl,ldate=ldate,$
				mytitle=mytitle
ARGS:   
   d[]:{alfamon} array of data input via aminpday.
KEYWORDS:
   temp    : int    if set then plot 16 and 70 K temps
   Id      : int    amplifier bias drain curreint. plot stage= 1,2,3
   Vd      : int    amplifier bias drain voltage.  plot stage  1,2,3
   Vg      : int    amplifier bias gain  voltage.  plot stage  1,2,3
   vac     :        if set the plot vacuum.. 
   over    : int   if set then overplot rather than start a new plot
   sym     : int   1,2,3 .. plot a symbol at each measured position.
                   1 +, 2 *, 3 . , Negative number -1,-2,-3 will plot 
                   the symbol and the connecting lines.
  color    : int   if provided then plot the current data set in this color.
                   colors are: (1-white, 2-red, 3-green,4-blue,5-yellow...
  ln       : int   line number for rcvr name labels. values 3..33
  adate    : int   if set then plot using alphanumeric dates: ddMMMyy
  drange[3]: float Date range to plot. Use with /adate to limit the
                   dates plotted.  format:[year,daynum,Numdays]
                   keep numdays about year,daynum. (numdays can be positive
                   or negative). These are AST dates
  cs       : float character size scaling if single plot. default=1
  log      :       if true then use log for vertical scale.. 
                   (warning.. don't set lower vertical scale to 0..)
 v1[2]     : float min,max value for top plot. default is auto scale
 v2[2]     : float min,max value for bottom. default is auto scale
                   Note: v2 only works with Temps. For Id,Vd,Vg v1[]
                        will set top and bottom veritcal scales the same.
 vmed      : float fractional value about median to display
 cont      :       if true then continue adding plots to this page.
                   need to set !p.multi=[0,n,m] before calling the first
 					time
labbm[2]   : float  [line number,xp] for where to label the beams
xpinc      : float  fraction to space between beam labels. def: .05
tosmo      : int    number of points to smooth/decimate
 useoff    :        if set then used data with amps off.
 fl[]      :        flag these locations in plots (jd)
ldate      : string if present and adate set then use this for
                    label_date() format. Default:"%D%M"
mytitle    : string if present add to end of title

RETURNS:
 gotdata:           1 if data found, 0 if no data found

DESCRIPTION:
   Plot the alfa dewar info data versus day of year. The data 
must be first input with aminpday. By default it will plot the 16 degree 
temperature stage. You can use the keywords to select the following data to
plot:
 temp: 1    : plots 16 and the 70 K temps
   Vd: 1,2,3  : stage 1st,2nd, or 3rd amplifier bias drain voltages
   Id: 1,2,3  : 1st,2nd, or 3rd amplifier bias currents.

The data can be plotted versus daynumber of the year (default) or
versus an ascii date ddMonyy (using /adate). 

   The axis can be scaled using hor,min,max and ver,min,max (these are two
idl functions). Entering hor or ver without any arguements will autoscale to
the min,max.

   The adate keyword plots the x axis in a more human readable form
ddMonyy. To plot a subrange of the data with this format, hor,min,max
will not work (since the x data gets converted to julian date). Use the
drange[day1st,daylast] keyword to limit the day range in this case.

   By default each pol  is plotted in a different color on one plot.

   When using the adate keyword, the tickmark end up being spaced by
some reasonable number of days (5,10,20..etc).

   Making hardcopy requires that you set the destination of the output to
a postscript file before you call the routine.
   pscol,'filename.ps'
   amplot,d
   hardcopy
   x
The data will then be in the postscript file filename.ps.

EXAMPLES:
   To start idl:
   idl
   @phil
   @alfamoninit
   ... 
nrecs=aminpday,021224,d,ndays=6         .. input dec 20 to 25
hor
ver,0,50                          .. vertical scale 0 to 50 K
amplot,d                          .. plot all 16 deg stage
amplot,d,vd=1,/adate              .. plot drain voltage, ascii dates


NOTE:

(See /pkg/rsi/local/libao/phil/alfamon/amplot.pro)


AMPOSDAY - POSITION TO START OF DAY IN FILE

[Previous Routine] [List of Routines]
NAME:
amposday - position to start of day in file
SYNTAX: istat=amposday(lun,yymmdd)
ARGS:
   lun :       int file containing data to read
 yymmdd:  long day to position to
RETURNS:
   istat : int  0 - positioned at start (yymmdd <= first rec)
                1 - positioned in file
                2 - positioned at end (yymmdd > last rec of file)
DESCRIPTION:
   amposday will position to the start of a day within the file.
This routine is normally called from aminpday().

EXAMPLE:
   openr,lun,'logfile',/get_lun
   yymmdd=021105
   istat=amposday(lun,yymmdd)

(See /pkg/rsi/local/libao/phil/alfamon/amposday.pro)