Rcvr monitoring routines

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


List of Routines


Routine Descriptions

AINTRO- USING THE RCVMON ROUTINES:

[Next Routine] [List of Routines]
NAME:
aIntro- Using the rcvmon  routines:
    
    The receivers have a dewar monitoring package that lets us monitor the
dewar temperatures, bias voltages and currents, as well as some of the
power supply voltages. Prior to 20dec02 this data was read manually by
the operators and can be accessed using the dwtemp routines. 

    On 20dec02 we switched to an automated continuous monitoring of the 
receivers. It takes about 2.5 seconds to measure all of the information of
a receiver and 22 seconds to cycle through all of the receivers. This 
processes continues 24 hours a day. The data is written to disc in  a
binary format. A new disc file is created each month using the filenaming
conventions:
    /share/obs4/rcvm/rcvmN     .. the current month
    /share/obs4/rcvm/rcvmN.yymm .. previous months eg rcvmN.0211 for nov02

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

    The routines in the rcvmon 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 fusion01, mango, mofongo,
or pat each of which have 2 gigabytes).

    The main routines used by users are:
    
rminpday() - input one or more days of data.
rmplot()   - plot the temperatur data that was input.
 
rmmon()    - input and plot the data for a day, or continually monitor
             the current values.

The other routines are support routines used by these 3.

The data structure used for each sample is:

IDL> help,d,/st
** Structure RCVMON, 13 tags, length=88:
   KEY             BYTE      Array[4] The string 'rcv'
   RCVNUM          BYTE               The receiver number
   STAT            BYTE               bitfield
                                      B0 - lakeshore disp is on
                                      B1 - hemtLed polA on
                                      B2 - hemtLed polB on
   YEAR            INT                4 digit year
   DAY             DOUBLE             daynumber of year with fraction of day.
   T16K            FLOAT              16K stage temperature in deg K
   T70K            FLOAT              70K stage temperature in deg K
   TOMT            FLOAT              omt temperature in deg K
   PWRP15          FLOAT              dewar +15 volt supply voltage
   PWRN15          FLOAT              dewar -15 volt supply voltage
   POSTAMPP15      FLOAT              postamp +15 volt supply voltage
   DCUR            FLOAT  Array[3, 2] bias current [Amps123 , polAB]
   DVOLTS          FLOAT  Array[3, 2] bias voltage [amps123 , polAB]
 

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

Unless you have specified a particular rcvnum on the call to rminpday(), you
will have all receivers combined in d. You can use the idl where() routine
to make a subset of the input data.

EXAMPLES:
;  start idl
    idl
    @phil
    @rcvmoninit

; input dec20 through 25
 
    nrecs=rminpday(021220,d,lastday=021225) ; this takes about 10 seconds
                                            ; and 15 mbytes.
;  plot the 16 k stage using colors for each and ascii dates
    ver,0,30
    rmplot,d,/adate
;  plot the 70k stage 1 receiver per frame
    ver,0,100
    rmplot,d,temp=1,/adate,/mframe
;
    plot the 70k and omt  stage on same plot.   
    ver,0,120
    rmplot,d,temp=1,/adate
    rmplot,d,temp=2,/adate,/over

; plot the bias currents for the third amp
    rmplot,d,cur=2,/adate

; do the above plot using where() and plot of idl
   ind=where(d.rcvnum eq 11)       ; xband
   plot,d[ind].dcur[2,0]             ; pola 3rd amp
   oplot,d[ind].dcur[2,1],color=2     ; polB 2rd amp,red

(See /pkg/rsi/local/libao/phil/rcvmon/aIntro.pro)


RMCONFIG - RETURN CONFIG INFO FOR RCVR MONITORING

[Previous Routine] [Next Routine] [List of Routines]
NAME:
rmconfig - return config info for rcvr monitoring
SYNTAX: istat=rmconfig(rcvnum,temps=temps,amps=amps,rcvnam=rcvnam)
ARGS:   
   rcvnum:   int    rcvr number to return info. 1 to 12

RETURNS:
   istat   : int    1 if this is a valid receiver with some monitoring info.
                    0 invalid rcvr num or no monitoring package available
KEYWORDS:
   temps[3]: int    0..2 is T16k,T70K,Tomt. A 1 is returned if this stage
                    exists for this receiver, a Zero is returned if this
                    monitoring stage does not exist.
   amps[3] : int    0..2 is stage 1,2,3 amps in dewar. A 1 is returned if
                    this stage exists in the receiver, a 0 is returned if it
                    does not exist.
   rcvnam  : string return the name of this receiver.
   

DESCRIPTION:
   Return info on the receiver monitoring configuration. The user enters
the receiver number (1..12). The info is returned in the keywords.
The temps array has a 1 if this temperature monitoring stage exists for 
this receiver. The amps array has a 1 for each amplifier stage in the
reciever (max of 3). 

EXAMPLES:
   get info on rcv number 2 (430) 
   istat=rmconfig(2,temps=temps,amps=amps,rcvnam=rcvnam)
   print,istat     
   1
   print,temps
   1 1 0               ; only 16K and 70K monitoring, no omt.
   print,amps 
   1 1 0               ; only 2 amps to monitor
   print,rcvnam
   430

(See /pkg/rsi/local/libao/phil/rcvmon/rmconfig.pro)


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

[Previous Routine] [Next Routine] [List of Routines]
NAME:
rmgetfile - find the files for the specified date(s)
SYNTAX: nfiles=rmgetfile(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. 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=rmgetfile(021001,021230,filelist)
   print,nfiles
   3
   print,filelist
   /share/obs4/rcvm/rcvmN.0210 
   /share/obs4/rcvm/rcvmN.0211 
   /share/obs4/rcvm/rcvmN

(See /pkg/rsi/local/libao/phil/rcvmon/rmgetfile.pro)


RMINPDAY - INPUT 1 OR MORE DAYS OF RCVMON INFO

[Previous Routine] [Next Routine] [List of Routines]
NAME:
rminpday - input 1 or more days of rcvmon info
SYNTAX: nrecs=rminpday(yymmdd1,d,lastday=yymmdd2,ndays=ndays,rcvnum=rcvnum,$
                       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 22 seconds.
   curfile:     if set, use current file, (used for maintenance purposes)
				 not normally needed even to access current data.
   dayno  :long if supplied, then set yymmdd1 to dayno,year

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

DESCRIPTION:
   Input the receiver 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. If the rcvnum keyword is supplied then only data for this
receiver will be returned.
   
   The entire dataset of all receivers is typically sampled once every
22 seconds. The data is returned as an array of structures d[nrecs]. Each 
entry contains:

IDL> help,a,/st 
** Structure RCVMON, 13 tags, length=88:
   KEY             BYTE      Array[4] The string 'rcv'
   RCVNUM          BYTE               The receiver number
   STAT            BYTE               bitfield
                                      B0 - lakeshore disp is on
                                      B1 - hemtLed polA on
                                      B2 - hemtLed polB on
   YEAR            INT                4 digit year
   DAY             DOUBLE             daynumber of year with fraction of day.
   T16K            FLOAT              16K stage temperature in deg K
   T70K            FLOAT              70K stage temperature in deg K
   TOMT            FLOAT              omt temperature in deg K
   PWRP15          FLOAT              dewar +15 volt supply voltage
   PWRN15          FLOAT              dewar -15 volt supply voltage
   POSTAMPP15      FLOAT              postamp +15 volt supply voltage
   DCUR            FLOAT  Array[3, 2] bias current [Amps123 , polAB]
   DVOLTS          FLOAT  Array[3, 2] bias voltage [amps123 , polAB]

(See /pkg/rsi/local/libao/phil/rcvmon/rminpday.pro)


RMINPRECS - INPUT RCVMONITOR RECORDS

[Previous Routine] [Next Routine] [List of Routines]
NAME:
rminprecs - input rcvmonitor records 
SYNTAX: nrecs=rminprecs(lun,nrecsReq,d,rcvnum=rcvnum,smo=smo)
ARGS:
   lun :       int file containing data to read
   nrecsReq:  long requested number of records to read
KEYWORDS:
   rcvnum: int only return data for this receiver.. 1..12
      smo: int smooth and decimate by this amount.  should be an odd number
               >= 3. The data will be smoothed and decimated by this amount.
RETURNS:
   nrecs : long    number of records input.
   d[nrecs]:{rcvmon} data input from file
DESCRIPTION:
   This routine is normally called via rminpday or rmmoninp.

   rminprecs will try to read the requested number of records from the 
receiver 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.

EXAMPLE:
   openr,lun,'/share/obs4/rcvmon/rcvmN',/get_lun
   nrecs=rminprecs(lun,9999,d)

(See /pkg/rsi/local/libao/phil/rcvmon/rminprecs.pro)


RMMON - MONITOR THE RECEIVER TEMPERATURES.

[Previous Routine] [Next Routine] [List of Routines]
NAME:
rmmon - monitor the receiver temperatures.
SYNTAX: rmmon,yymmdd,temp=temp,disp=disp,win=win,tlab=tlab,ver=ver,$
               min=min,delay=delay,hshift=hshift,smo=smo,debug=debug,log=log
ARGS:
   yymmdd: long    date to display. -1 --> current day
 
KEYWORDS:
     temp :    int  temp to monitor 0:16K,1:70K,2:omt
    ver[2]:    float vertical scale to use (min,max). If 1 number then
                     go 0 to ver.
     disp :    int  1 ->upper magnified display only
                    2 ->lower daily display only
                    default both
       win:    long window number to display in. This allows the user to
                    setup the window dimensions and position before
                    calling this routine. The default is 0. Window 4
                    is used for the pixwin, so do not use it as the 
                    display window number.
  tlab[4]:   float  specify temp label text position
                    [0] - start line 0..31   def 3
                    [1] - line step          def 1
                    [2] - xpos left (0..1)   def  .02
                    [4] - charsize           def 1.3
   log   :          if set the make vertical display logarithmic.
 -->keywords for HI RESOLUTION upper display
      min :    long number of minutes for upper hi res display. default:
                    60.
     delay:    long The seconds to wait between each display of the magnified
                    display. The default is 20 seconds.
    hshift:    long The number of minutes to leave blank on the right 
                    side of the magnified display. The default is 1 minute
 -->keywords for DAILY lower display
       smo:    long the number of points to smooth,decimate the daily display.
                    The default is 5 or 100  seconds. This is also the update
                    rate for the daily display.
     debug:    If set then output some debugging info about the the number
               of points we read at each i/o.
DESCRIPTION:
   rmmon will monitor the receiver temperatures. The monitor data is 
being written to disc once every 3 seconds for each receiver.

   rmmon can be used to display an entire days worth of data by setting
the parameter yymmdd to the data of interest. If yymmdd is set to -1 then
the monitoring will display the current day and then continue updating 
every DELAY seconds. The default delay is about 20 seconds (one complete
cycle reading all of the receivers).

   There are two displays each showing temperature versus hour of
day: a high resolution plot and a plot of the entire day. The DISP keyword
can be used to limit the output to just one of these plots (the default
is both plots are output). By default the 16K stage of the amplifiers are
displayed. The temp keyword lets you select the 70K or the OMT stage.

   The top plot is a high resolution display showing the last MIN minutes
of data. The dislay will be updated every DELAY seconds. The *'s at the 
right of the plot are the last data points. The value on the left are the
temperatures for the last reading.
   
   The lower plot is the temperature versus hour of day for the entire day.
The data has been smoothed and decimated by SMO seconds. This plot will 
be updated every SMO sample points.

EXAMPLES:
   - Plot the temp  data for 24dec02
   rmmon,022402
   - monitor the current day.
   rmmon,-1
   - monitor the current day, smoothing the magnified plot to 1 minute (3 
     samples) and displaying 3 hours of data. 
   rmmon,-1,smo=3,min=180

NOTE:
   If you call rmmon,-1... you will need to ctrl-c to get out of it.
After this you should do a retall to get back to the main idl procedure.

(See /pkg/rsi/local/libao/phil/rcvmon/rmmon.pro)


RMMONINP - INPUT THE MONITOR DATA.

[Previous Routine] [Next Routine] [List of Routines]
NAME:
rmmoninp - input the monitor data.

SYNTAX: newrecs=rmmoninp(yymmdd,b,curpos=curpos,daynum=daynum,year=year,$
                        append=append,inprecsize=inprecsize)
DESCRIPTION:
   This routine is called by rmmon to input the next set of monitor
data.

(See /pkg/rsi/local/libao/phil/rcvmon/rmmoninp.pro)


RMOPENFILE - OPEN THE REQUESTED FILE

[Previous Routine] [Next Routine] [List of Routines]
NAME:
rmopenfile - open the requested file
SYNTAX: lun=rmopenfile(filename,dirlist=dirlist)
ARGS:
filename: string   file (with or without  directory) to open
KEYWORDS:
dirlist[]: strarr  list of directories to search. If not 
                   present then use the default directories
                   (/share/obs4/rcvm, /share/phildat/rcvm

RETURNS:
   lun : int       open lun. -1 --> couldn't open
DESCRIPTION:
   Open the requested file. The routine will try openning 
filename. If not present, then it will search in the
default directory list: (/share/obs4/rcvm, /share/phildat/rcvm)
It will open regular or compressed files (compressed files
end in .gz).

EXAMPLE:
   openr,lun,'/share/obs4/rcvmon/rcvmN',/get_lun
   nrecs=rmopenfile(lun,9999,d)

(See /pkg/rsi/local/libao/phil/rcvmon/rmopenfile.pro)


RMPLOT - PLOT DEWAR TEMPERATURES.

[Previous Routine] [Next Routine] [List of Routines]
NAME:
rmplot - plot dewar temperatures.
SYNTAX: rmplot,d,temp=temp,cur=cur,volt=volt,rcv=rcv,over=over,sym=sym,
               color=col,ln=ln,adate=adate,drange=drange,$
               mframe=mframe,cs=cs,log=log,labadate=labadate,$
               nolab=nolab,xtitle=xtitle,title=title,pol=pol,abpolcol=abpolcol,$
				font=font
ARGS:   
   d[]:{rcvmon} array of data input via rminpday.
KEYWORDS:
   temp    : int    temperature to plot:
                    0 16  deg stage (default)
                    1 70  deg stage
                    2 omt deg stage
   cur     : int    amplifier bias current to plot 0,1,2
   volt    : int    amplifier bias voltage to plot 0,1,2
   rcv[]   : string or strarray.. rcvnames to plot. If supplied, then only
                    plot these receivers..
                    the default is to plot all of the receivers.
                    rcvr names are:
                   '430','lbw','lbn','sbw','sbn','sbh','cb','xb' 
   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
  labadate : string if supplied, then this is the output format
                   for label_date call:
                   %M-monName,%N-monNun,%D-dayNo,%Z-yy,%H-hr,%I-min
  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)
  mframe   : int   if set then plot multiple frames on a page with 1 frame
                   per receiver.
  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..)
  nolab    :       if set then don't print receiver names at the 
                   bottom.. handy if you supply title=
 xtitle    : string Use this for the xtitle. Handy if you want to specify
                    the dd:hh for labadate
 title     : string Use this for the reciever name
	 				(but not oplot)
 pol       :  1,2   if present then just plot pola(1) or polB 2
 abpolcol  :        if set  and single frame, then plot always plot polb in red.
	 				 normally used for 1 rcv/page pola=black,polb=red
 font      : int   1-truetype, 0 regular

DESCRIPTION:
   Plot the receiver dewar info data versus day of year. The data 
must be first input with rminpday. By default it will plot the 16 degree 
temperature stage. You can use the keywords to select the following data to
plot:
 temp: 0,1,2  : T16K,T70K, or Tomt temperatures
 cur : 0,1,2  : 1st,2nd, or 3rd amplifier bias currents.
 volt: 0,1,2  : 1st,2nd, or 3rd amplifier bias voltages

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 receiver is plotted in a different color on one plot.
The /mframe keyword will plot each receiver in a separate frame (all on one
page. The rcv keyword lets you specify a subset of the receivers to plot.

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

   When plotting the voltage or currents, both polarizations will
be plotted. If /mframe is set then polA is white and polB is red. If 
not , then then they are overplotted in the same color. Keyword colpol 
will override this.

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

   If you used the /mframe keyword, then you don't need color postscript,
but you will probably want to use the entire page for plotting:
   ps,'filename.ps',/full
   rmplot,d,/mframe
   hardcopy
   x

EXAMPLES:
   To start idl:
   idl
   @phil
   @rcvmoninit
   To exit idl:
   exit
   ... 
nrecs=rminpday,021224,d,ndays=6         .. input dec 20 to 25
hor
ver,0,50                          .. vertical scale 0 to 50 K
rmplot,d                          .. plot all receivers 16 deg stage
rmplot,d,/mframe                  .. plot all receivers 1 per frame
rmplot,d,rcv='lbw'             .. plot lbw 16 deg stage
rmplot,d,rcv=['lbw','lbn'],/adate .. plot lbw,lbn use, ascii dates
rmplot,d,temp=1                   .. plot all rcvrs,  70 deg stage

; plot the voltage from amp 1
ver,0,5
rmplot,d,volt=0

; overplot omt and 70K stages
  ver,0,120
  rmplot,d,temp=1
  rmplot,d,temp=2,/over

NOTE:
    The datasets contain 70 Mbytes per month. You should run this on 
a computer with lots of memory (pat,fusion01,mango,mofongo).

(See /pkg/rsi/local/libao/phil/rcvmon/rmplot.pro)


RMPOSDAY - POSITION TO START OF DAY

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

EXAMPLE:
   openr,lun,'/share/obs4/rcvm/rcvmN',/get_lun
   yymmdd=021105
   istat=rmposday(lun,yymmdd)

(See /pkg/rsi/local/libao/phil/rcvmon/rmposday.pro)


RMSMODAT - SMOOTH THE DATA IN RCVMON STRUCT

[Previous Routine] [Next Routine] [List of Routines]
NAME:
rmsmodat - smooth the data in rcvmon struct
SYNTAX: nrecs=rmsmodat(dinp,tosmo,dsmo)
ARGS:
   dinp[n] : {rcvmon} data to smooth
   tosmo   : long  number of points to smooth
               >= 3. The data will be smoothed and decimated by this amount.
RETURNS:
   nrecs      : long    number of smoothed records returned
   dsmo[nrecs]:{rcvmon} smoothed data
DESCRIPTION:
   This routine is normally called via rminpday or rmplot

   Smooth the data fields in dinp by tosmo points using a boxcar smoothing.
Each point is normally sampled every 22 seconds. Fields that are not numeric:
.stat use the first element of the pnts to smooth.

EXAMPLE:

(See /pkg/rsi/local/libao/phil/rcvmon/rmsmodat.pro)


RMSMOHR - SMOOTH TO ONE HOUR RESOLUTION

[Previous Routine] [List of Routines]
NAME:
rmsmohr - smooth to one hour resolution
SYNTAX: nrecs=rmsmohr(dinp,dsmo)
ARGS:
   dinp[n] : {rcvmon} data to smooth to hour resolution (unless lastday
					   keyword is used).
RETURNS:
   nrecs      : long    number of smoothed records returned
   dsmo[nrecs]:{rcvmon} smoothed data
DESCRIPTION:
   Smooth the data fields in dinp to one hour resolution.
Each point is normally sampled every 22 seconds. Fields that are not numeric:
.stat use the first element of the pnts to smooth.

EXAMPLE:

(See /pkg/rsi/local/libao/phil/rcvmon/rmsmohr.pro)