rfi idl routines

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


List of Routines


Routine Descriptions

FINDRDRIPP - THE THE IPPS OF A RADAR FROM TOTAL POWER DATA

[Next Routine] [List of Routines]
NAME:
findrdripp - the the ipps of a radar from total power data
SYNTAX:nipps=findrdripp(d,minipp,maxipp,maxNumipp,onval,ipps,offset,
                   ipplen=ipplen,ipppos=ipppos
ARGS:
   d[npts]: total power time series for radar.
   minipp : float minium ipp to allow. units = sample rate
   maxipp : float maximum ipp to allow. units = sample rate
maxNumipp : int   max number of distinct ipps to allow
     onval: float The value of d that --> radar is on.
 KEYWORDS:
   nippcor: long number of ipps to use for correlation to find offset.
                 default is 40

RETURNS:
 nipps    : long  number of ipps found.
  ipps[m] : float The ipps that were found.
offset    : long  the offset to start of first ipp.
KEYWORDS:
   ipplen[]: int  the length of each ipp found for all the data
   ipppos[]: long  index into d for each ipp found

DESCRIPTION:
   Given a total power times series for a radar try and find the 
ipps that the radar uses. The user specifies a threhold above which the
radar is determined on (this does not have to be 100% accurate). The 
routine then finds the indices for all points above this value. It then
looks for all indices that have at least minipp samples before it less than
this threshould values. These indices are then marked as ipp starts. 
The difference between ipp starts are then computed and all ipplens greater
than the maximum ipp are discarded (since we may have missed some of the
ipps). The ipplen is then sorted and the transitions are marked. The 
median value between transistions is then taken as the ipps. 

The total ipp (length before ipp repeats) is computed. Each ipp that is
then crosscorrelated with 40 ipptot worth of data looking for where this
ipp starts. The order of the ipps is set to reflect the data order and the
offset in the dataset for the first ipp is also returnd.

NOTES:
   1. You need at least 40 complete cycles of the data.
   2. you may need to play with minipp,maxipp and maxnumipp a little.
   3. if you supply the key ipplen you can see the ipps that the
      routine is catching ipp per ipp.
   4. This returns the ipptot to within 1 sample. You then need to 
      look far down the dataset using ipptot and find the fractional
      value:
EXAMPLES:
   1. To check that it worked.
      eg.  
      ippcum=total(ipps,/cum)  
      hor,0,ipptot*1.5
      plot,d[0:ipptot*1.5]
      flag,ippcum+offset,color=2
   2. to figure out what eps should be.
      eps=0.
      l=offset+nipptot*(ipptot+eps) 
   plot,t[l:l+ipptot*1.5]
   flag,ippcum+offset;
   loop adjusting eps till the flags overlap the data.

(See /pkg/rsi/local/libao/phil/rfi/findrdripp.pro)


MKAEROSTATROT - MAKE COMPLETE AEROSTAT MODEL (1 ROTATION)

[Previous Routine] [Next Routine] [List of Routines]
NAME:
mkaerostatrot - make complete aerostat model (1 rotation)
SYNTAX: buf=mkaerostatrot(nosdlb=nosdlb,noblank=noblank,rotFudge=rotFudge,$
                          nogauss=nogauss,ippsused=ippsused)
ARGS:
   NONE
KEYWORDS:
  noblank: if set then don't include the 42 degrees of blanking about
              the observatory azimuth position.
  nogauss: if set then don't include the gaussian beam as it sweeps
               by the observatory. This leaves the amplitude constant. The
               default is to have main beam and sidelobes by gaussians
               with amplitudes 50db/38db above the noise floor. If nogauss
               is set, then nosdlb is assumed.
   nosdlb: if set then do not include the two sidelobes at +/- 110 degrees.
               nogauss implies nosdlb.
 rotFudge: float change the default rotational width of the beam as it
               passed in front of the observatory. By default the
               fwhm of the gaussian is set so that the edge of the 
               blanking region (.7 secs from bore sight) is 12 db down from
               the peak. rotFudge multiples the fwhm of the beam.
               If nogauss then rotFudge is ignored.
RETURNS:
   buf[1200000]: float  buffer holding 1 12 second rotation of the
                        aerostat at 1 usec sampling (in the time domain). 
DESCRIPTION:
   create a model of the aerostat radar output for 1 12 second rotation
at 1 usecond resolution. The default parameters are:
1. pulsewidth 320 usecs
2. 7 ipps: [3771.,3504.,3076,2809.,2903.5,3289.,3676] inusecs
3. rotation period 12 seconds.
4. Start with gaussian noise with a 1 sigma level of 5 counts
5. For each radar pulse increase the level by 10 counts.
6. place a gaussian at the center of the buf of amplitude 1e6 for when
   the radar points at ao.
7. Add two sidelobe gaussian of the same width at -108 degrees and 115
   degrees from ao boresight. This should be 12db down from the boresight
   amplitude.
8. blank the boresight signal for +/- 21 degrees from ao boresight.
9. arrange the width of the gaussian so that the edge of the blanking
   is 12 db down from the peak (so it is equal to the sidelobes).
   This turns out to be 12db down at the edge of the blanking region.

   On return there will 12000000 samples with a 1 sigme level of 5 counts.
added to this is the aerostat values that increase the noise by 10 counts
on each pulse. The blanking region will be included. On gaussian (with 
fwhm of .7 secs and amplitude 1e6) is centered at the middle of the buffer
(boresight to ao) and two sidelobes (12db down) are positioned at 
azimuths -108 and +115 degrees from boresight.
   The keywords allow you to remove some of these options.
Note:
   when matching the results to pulsar data it lookes like rotFudge
needs to be set to about 1.8.  This implies that the rotation width
needs to be wider. This may be because the amplitude of the main peak
is selected incorrectly (since it is never measured).

(See /pkg/rsi/local/libao/phil/rfi/mkaerostatrot.pro)


MKCARSRROT - MAKE COMPLETE CARSR RADAR MODEL (1 ROTATION)

[Previous Routine] [Next Routine] [List of Routines]
NAME:
mkcarsrrot - make complete carsr radar model (1 rotation)
SYNTAX: buf=mkcarsrrot(freqtoret=freqtoret,rotFudge=rotFudge,$
               nogauss=nogauss,ippsused=ippsused,eps=eps)
ARGS:
   NONE
KEYWORDS:
 freqToret: int  1 for f1,f1n, 1 for f2,f2n (see pulse structure below).
  nogauss: if set then don't include the gaussian beam as it sweeps
               by the observatory. This leaves the amplitude constant. The
               default is to increase the amplitude of the radar
               by 30 db as it sweeps by ao. The width of and sidelobes by gaussians
               with amplitudes 50db/38db above the noise floor. If nogauss
               is set, then nosdlb is assumed.
 rotFudge: float change the default rotational width of the beam as it
               passed in front of the observatory. By default the
               fwhm of the gaussian is set so that the edge of the 
               blanking region (.7 secs from bore sight) is 12 db down from
               the peak. rotFudge multiples the fwhm of the beam.
               If nogauss then rotFudge is ignored.
pkamp   : float change the peak amplitude for the gaussian beam when it
               points at ao. The default is 1000.*50. 
noisesig: float if supplied then add random noise to the entire data set.
               the amplitude of the noise is noiseSig. (the default
               amplitude for the radar when it is not pointed at ao is
               50 counts
eps     : dbl  change last ipp by eps usecs
RETURNS:
   buf[1200000]: float  buffer holding 1 12 second rotation of the
                        faa at 1 usec sampling (in the time domain). 
DESCRIPTION:
   create a model of the carsr radar (faa and punta borinquen) output for 1 12 second rotation
at 1 usecond resolution. 

    The carsr radar broadcasts at 4  frequencies: 
 pulseStructure:
    all 4 freq are included in 1 pulse. let the 4 freq be:
 f1,f1n, f2,f2n  (where n stands for narrow duration) then:

 f1:117 usecs, 2usecOff,f2:117usecs,2 off, f2n:19usecs, 2 off, f1n:19usecs
 fx and fxn are separated by about 5 Mhz
 f1 and f2 are separated by about 96 mhz.

 The model will return the pulses from f1,f1n  or f2,f2n (using freqtoret=keyword)
The default parameters are:
1. pulsewidth: see structure above
2. ipps used: 15... 5*2755.4 usec, 5*3150.7 usecs, 5*3627.5 usecs
3. rotation period 12 seconds. this is not a integral multiple of the
   the 15 ipps.
4. place a gaussian at the center of the buf of amplitude 1e5 for when
   the radar points at ao.
5. set the gaussian fwhm width to be 50 milliseconds.

   On return there will 12000000 samples with a 1 sigme level of 5 counts.
added to this is the faa values that increase the noise by 10 counts
on each pulse. The blanking region will be included. On gaussian (with 
fwhm of .7 secs and amplitude 1e6) is centered at the middle of the buffer
(boresight to ao) and two sidelobes (12db down) are positioned at 
azimuths -108 and +115 degrees from boresight.
   The keywords allow you to remove some of these options.
Note:
   when matching the results to pulsar data it lookes like rotFudge
needs to be set to about 1.8.  This implies that the rotation width
needs to be wider. This may be because the amplitude of the main peak
is selected incorrectly (since it is never measured).

(See /pkg/rsi/local/libao/phil/rfi/mkcarsrrot.pro)


MKFAAROT - MAKE COMPLETE FAA MODEL (1 ROTATION)

[Previous Routine] [Next Routine] [List of Routines]
NAME:
mkfaarot - make complete faa model (1 rotation)
SYNTAX: buf=mkfaarot(rotFudge=rotFudge,$
                     nogauss=nogauss,ippsused=ippsused)
ARGS:
   NONE
KEYWORDS:
  nogauss: if set then don't include the gaussian beam as it sweeps
               by the observatory. This leaves the amplitude constant. The
               default is to have main beam and sidelobes by gaussians
               with amplitudes 50db/38db above the noise floor. If nogauss
               is set, then nosdlb is assumed.
 rotFudge: float change the default rotational width of the beam as it
               passed in front of the observatory. By default the
               fwhm of the gaussian is set so that the edge of the 
               blanking region (.7 secs from bore sight) is 12 db down from
               the peak. rotFudge multiples the fwhm of the beam.
               If nogauss then rotFudge is ignored.
RETURNS:
   buf[1200000]: float  buffer holding 1 12 second rotation of the
                        faa at 1 usec sampling (in the time domain). 
DESCRIPTION:
   create a model of the faa radar output for 1 12 second rotation
at 1 usecond resolution. The default parameters are:
1. pulsewidth 5 usecs
2. 5 ipps: [2633.,2821.,2746.,2595.,3310.]
3. rotation period 12 seconds.
4. Start with gaussian noise with a 1 sigma level of 5 counts
5. For each radar pulse increase the level by 10 counts.
6. place a gaussian at the center of the buf of amplitude 1e5 for when
   the radar points at ao.
7. set the gaussian fwhm width to be 50 milliseconds.

   On return there will 12000000 samples with a 1 sigme level of 5 counts.
added to this is the faa values that increase the noise by 10 counts
on each pulse. The blanking region will be included. On gaussian (with 
fwhm of .7 secs and amplitude 1e6) is centered at the middle of the buffer
(boresight to ao) and two sidelobes (12db down) are positioned at 
azimuths -108 and +115 degrees from boresight.
   The keywords allow you to remove some of these options.
Note:
   when matching the results to pulsar data it lookes like rotFudge
needs to be set to about 1.8.  This implies that the rotation width
needs to be wider. This may be because the amplitude of the main peak
is selected incorrectly (since it is never measured).

(See /pkg/rsi/local/libao/phil/rfi/mkfaarot.pro)


RDRIMG - MAKE AN IMAGE FROM A RADAR TIME SERIES.

[Previous Routine] [Next Routine] [List of Routines]
NAME:
rdrimg - make an image from a radar time series.
SYNTAX: img=rdrimg,d,smptosue,ipps,ipptot,first=first
ARGS:
    d[npts]: float  radar total power time series
   smptouse: long   number samples in each ipp to plot starting from first
ipps[nipps]: long   ipp length in ipps for each ipp.
     ipptot: double the sum of ipps[] with any measured fractional values.
KEYWORDS:
 
      first: long    index first sample to plot (def 0)
DESCRIPTION:
   Make a image of a radar dataset. The left side of the image will
be at the same phase of the radar ipp. Take a subset of the points
(smptouse) for each row. Use ipptot to move from one set of ipps to the
next. With a set use the individual ipps to move from 1 ipp to the next.
When specifying first be careful the first ipp found is the first one in
ipps[].

EXAMPLE:
   findrdripp,d,minipp,maxipp,10,radonminval,ipps,offset
; compute eps fractional offset by looking farther down in the dataset.
   ipptot=total(ipps)
   ipptouse=ipptot + eps 
   smptouse=800
   img=rdrimg(d,smptouse,ipps,ipptotuse,first=30)
   imgdisp,img,zy=-5

(See /pkg/rsi/local/libao/phil/rfi/rdrimg.pro)


RFIPUNTASALINASFREQ - RETURN PUNTA SALINAS RADAR FREQ

[Previous Routine] [Next Routine] [List of Routines]
NAME:
rfipuntasalinasfreq - return punta salinas radar freq
SYNTAX:rfipuntasalinasfreq,rinfo,old=old
ARGS: none
KEYWORDS:
 old :      if set then return the info prior to apr15


RETURNS:
 rinfo[n]: struct array holding n channels
                   each channel has 4/2  freq (!old/old)

DESCRIPTION:
   Return frequency info for the punta salinas radar
rinfo[n] is an array with n channels. A channel is the set of 
frequencies that can be transmitted in 1 ipp 

 rfinfo[0].channum  = channel number 1...n
 rfinfo[0].name     = " " or  'modeA', 'modeB','modeC' 
                      "notx" if not allowed to xmit here
 rfinfo[0].cfr      =  freq center  xmit +/- 7.5 from here
 rfinfo[0].freq[m]  =  two xmit freq
 rfinfo[0].bwlist   = [.625,1.25] long,shortrange bandwidths

 	prior to apr15 there were 20 2 freq chan
   apr15 -> 100 2 freq channels.. mode A, b ,c changed

Example
1. flag the puntasalins freq in an corrlator plot:
   @corinit  (or @wasinit)
   @rfininit
   .. input correlator data
   rfipuntasalinasfreq,rdrinfo
   fl=reform(rdrinfo.freq,2*20)
   corplot,b,fl=fl,lnsfl=1
2. flag each radar chan in a different color:
   x=....
   y=...
   plot,x,y
	nchan=20
   for i=0,nchan-1 do flag,rdrinfo[i].freq,col=colph[(i mod 11) + 1],linest=2
   

(See /pkg/rsi/local/libao/phil/rfi/rfipuntasalinasfreq.pro)


RFIRDRINFO - RETURN INFO ON REQUESTED RADARS

[Previous Routine] [List of Routines]
NAME:
rfirdrinfo - return info on requested radars
SYNTAX:rfirdrinfo,rdrI,faa=faa,pb=pb,aero=aero
ARGS:
KEYWORDS:
faa:   if true return faa info (def).
pb :   if ture return punta borinquen nifo
aero:  if true return aerostat info


RETURNS:
 rdrI: struct  holding info for this  radar

DESCRIPTION:
   Return info for the requested radar. If no keyword is supplied then faa is returned.

The rdrI structure holds:
IDL> help,rdrI,/st
** Structure <1ebda58>, 11 tags, length=116, data length=114, refs=1:
   NAME            STRING         "faa"  ;  name of radar
   NFREQ           INT              4     ;  number of frequencies. they may not all be in 1 ipp
   FREQAR          FLOAT     Array[4]     ; Mhz. frequencies used
   PULSEDUR        INT       Array[4]     ; Usecs. how long each freqPulse is.
   PULSEDURTOT     FLOAT           279.000; total pulse length in ipp. may contain blanking between freqs.
   NFREQINPULSE    INT              4     ;  how many freq are in an ipp
   FREQSEQ         INT       Array[4]     ;  order of freq in ipp . eg [0,2,1,3].. 
                                             indices (count from 0) into freqAr
                                             if multi dimensional, then 1 ipp has the 1st dimension
   NIPPS           INT             15     ; number of ipps  before repeating.
   IPPAR           FLOAT     Array[15]    ; ipps in usecs.
   ROTPER          FLOAT           12.0000; rotation period in secs (approx).
   BMWIDDEG        FLOAT           1.40000; beam width in degrees (approx)
   BANDWIDTH       FLOAT           1.00000; bandwidth used at each freq.
   notes           string     "           ; some notes on the radar
 }

	Some radars output all freq each ipp (faa,pb). For faa the values are:


 For the punta salinas radar use:e
rfipuntasalinasfreq,rinfo   for freq of the punta salinas 
 rdrI.freqar  : 1257.59      1252.41      1349.59      1344.41
 rdrI.pulseDur:  117           19          117           19
 rdrI.freqSeq:   0       2       1       3                    indices info freqAr
 For the aerostat, there are 4 freq, but only two are output on an ipp 
 the next ipp will output the same  2 freq (dual freq mode) or the 2nd set of 2 freq (quad freq mode)
 rdrI.freqSeq:    0       1     1 ipp
                  2       3     next ipp if 4 freq

(See /pkg/rsi/local/libao/phil/rfi/rfirdrinfo.pro)