pulsar related idl routines

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


List of Routines


Routine Descriptions

SP_DEDISP1 - DEDISPERSE A BUFFER OF WAPP DATA.

[Next Routine] [List of Routines]
NAME:
sp_dedisp1 - dedisperse a buffer of wapp data.
SYNTAX: sp_dedisp1,spc,f1,df,dm,timeSmp,smpOff,dedisp,refRf=refRf
ARGS:
 spc[nchn,nspcSmp,nsmp]:float Spectra to dedisperse. If 2 dimensions then
                 assume just 1 spectra per sample
   f1  :double   center frequency of first channel (Mhz).
   df  :double   Channel width (Mhz). The sign tells whether spc[*,]
                 is increasing frequency (unflipped) or decreasing
                 frequency (flipped).
    dm : double  dispersion measure
   tmSmp:double  time between samples (secs)
 smpOff :long    The sample number that spc starts at. This is for use when
                 the routine is called multiple times

KEYWORDS:
   refRf:double   reference frequency to use for dedispersion. The default
                  is the first bin of each band.

RETURNS:
   shiftAr[nchans]:long    shift values for each channel.
   dedispA[n,nspcSmp]:float   the deddisped time series by spectra persample
 The dedisp  should be allocated to hold the max number of samples +
                 the maxium sample delay across the band

DESCRIPTION:
   Dedisperse one input buffer of spectra (usually from pdev). f1,df,dm,
timeSmp and optionally  refRf determine how to dedisperse spc. f1 is the frequency of 
the first channel of the spectra. df should be set to the channel spacing (negative
if the frequency decreases across the band).
	You can use refRf to dedisperse relative to refRf (rather than f1).

   The dedispersed data is returned in dedisp[nsmp,Nspc]. You should
dimension dedisp large enough to hold all of the dedispered data
for however many calls you will make to sp_dedisp1. smpOff points
to the offset in dedisp where the first time sample of spc goes. The
code checks the indices so that all dedispersed power before smpOff=0
is thrown into smpOff=0. You need to dimension dedisp to hold any
extra data at the end of the last time sample (from freq channels 
below  the reference frequency). 
	to keep the timing straight, f1 or refRf should be the highest
frequency. Then the first sample returned will have the first sample of
refRf.

   This routine is normally calledl by sp_dedisp(). for pdev it is called
by itself.

NOTES:
	spc[ii]+=spc[jj]  where len(i) = len(jj)
     it's ok if some of ii or jj repeat.


SEE ALSO:
   sp_dedsip,sp_dmdelay,sp_dmshift

NOTES: this code was borrowed from duncan lorimer's sigproc routines.
HISTORY:
26MAY06:- changed arguments dedispA,dedispB to deDisp[nsmp,Nspc] to allow
         for alfa data when you have multiple beams coming back from
         1 board (1,2, or 4).

(See /pkg/rsi/local/libao/phil/pulsar/sp_dedisp1.pro)


SP_DMDELAY - DELAY IN SECS BETWEEN TWO SKY FREQ

[Previous Routine] [Next Routine] [List of Routines]
NAME:
sp_dmdelay -  delay in secs between two sky freq
SYNTAX: delay=sp_dmdelay(f1,f2,dm)
ARGS:
   f1: double   frequency 1 Mhz
   f2: double   frequency 2 Mhz
   DM: double   dispersion measure 
RETURNS:
   delay:double in seconds

DESCRIPTION:
   Compute the delay f2-f1 for dispersion measure dm. 
Positive numbers means that f1 arrives after f2 (f1 is the lower freq)

NOTES:
 I stole this from dunc's sigproc routine

(See /pkg/rsi/local/libao/phil/pulsar/sp_dmdelay.pro)


SP_DMSHIFT - COMPUTE THE SHIFT VALUES FOR DEDISPERSION.

[Previous Routine] [Next Routine] [List of Routines]
NAME:
sp_dmshift - compute the shift values for dedispersion.    
SYNTAX: shiftAr=sp_dmshift(f1,df,nchans,dm,tmSample,refRf=refRf,
                           nbands=nbands)
ARGS:
   f1  :double   center frequency of first channel (Mhz).
   df  :double   Channel width (Mhz)   
 nchans:int      total number of channels
    dm : double  dispersion measure
tmSample: double time samples (secs)

KEYWORDS:
   refRf:double   reference frequency to use for dedispersion. The default
                  is the first bin of each band.
  nbands:long     number of dedispersed bands to return. default=1
                  nbands must divided evenly into nchans

RETURNS:
   shiftAr[nchans]:long    shift values for each channel.

DESCRIPTION:
   Compute the shift values for each frequency channel to use when
dedispersing a time series.

NOTES:
   Stole from dunc's sigproc routine.

(See /pkg/rsi/local/libao/phil/pulsar/sp_dmshift.pro)


TEMPOGET - READ A POLYCO FILE

[Previous Routine] [Next Routine] [List of Routines]
NAME:
tempoget - read a polyco file
SYNTAX: n=tempo_getdata(polycoName,polyI)
ARGS:
 polycoName: string  polyco.dat file to read (created by tempo)
RETURNS:
n:	int  >=0 number of entries found in file
        -1 can't open file

polyI[n]: struct   holding info read from file

(See /pkg/rsi/local/libao/phil/pulsar/tempo_getdata.pro)


TEMPO_COMP - COMPUTE PULSE PHASE AND FREQ FROM POLYCO.DAT

[Previous Routine] [List of Routines]
NAME:
tempo_comp - compute pulse phase and freq from polyco.dat
SYNTAX: istat=tempocomp(mjd,polyI,retI)
ARGS:
 Mjd: double   time of interest
 polyI: {}     polyco.dat info from tempoget
RETURNS:
istat:	 int   status of computation
              0 ok
              < 0  error
              -1 requested tmmjd comes before polyI times
              -2 requested tmmjd comes after end of polyI times
retI: {}      strucuture holding return info

(See /pkg/rsi/local/libao/phil/pulsar/tempo_comp.pro)