NAME:
devtprms - compute rms on total power array
SYNTAX: pdevtprms,toAvg,tp,,rmsAr,allen=allen
ARGS:
toAvg[n]: long samples to average before computing rms.
If n, greater than 1 then the rms will be computed
on each dataset.
tp[m,2]:float total power data low band. 2nd index is pola,b
KEYWORDS:
allen: if set then return the allen deviation rather than
the standard deviation.
it is y[i]=sqrt(.5*mean((tp[i]-tp[i+1])^2))
RETURNS:
rmsAr[n,4]:float return rms info for low band
DESCRIPTION:
Compute the rms deviation of a set of total power noise samples. If the
keyword /allen is set then the sqrt of the allen variance is computed rather
than the standard deviation.
toAvg determines the number of adjacent samples to average before
computing the deviation. If toavg is an array then the deviation will
be computed for each set of averages.
The info is returned in rmsAr[n,4] where n is the number of entries in
toavg[n]. The 4 entries for each average contains:
rmsAr[n,0] - rms for tp polA
rmsAr[n,1] - rms for tp polB
rmsAr[n,2] - pnts averaged before rms computed.
rmsAr[n,3] - pnts available for rms after averaging
(See /pkg/rsi/local/libao/phil/pdev/pdevtprms.pro)
NAME:
pdevavg - read and average records
SYNTAX: istat=pdevavg(desc,nrecs,b,rec=rec,verb=verb,tp=tp)
ARGS:
desc: {} returned by pdevopen
nrecs: long recs avg
KEYWORDS:
rec: long record to position to before reading (cnt from 1)
RETURNS:
istat: number of records averaged.
: 0 returned no records
: -1 returned some but not all of the recs
tp[nrecs,npol]: float if supplied then return the total power at each sample
DESCRIPTIION:
Read and average the requested number of records from file.
(See /pkg/rsi/local/libao/phil/pdev/pdevavg.pro)
NAME:
pdevavgdir - Avg all pdev files in an array of dir.
SYNTAX: pdevavgdir,dirAr,skyCfr,lo2Off,savDir,verb=verb
ARGS:
dirAr[]: strarr array of directory names to search. The names should
include the trailing /.
skyCfr : float Mhz. sky center frequency Mhz for all the files.
lo2Off : float Mhz. The lo2 offset for the two bands. Use a single
positive number.
savDir : string Save file directory where the accumualated save files are
written.
RETURNS:
A save file is written for each .pdev file found. It contains:
freq[nchan] frequency array
nrecsTot: number of records averaged
b : {} structure holding averaged data
skycfr : sky center frequency
descSav : the descriptor returned from pdevopen(). This includes
the initial file header.
DESCRIPTION:
avgerage all the .pdev files in the requested directories.
save the averages in the savDir directories.
(See /pkg/rsi/local/libao/phil/pdev/pdevavgdir.pro)
NAME: pdevbitrevind - return index array for fft bitreverse SYNTAX: indAr=pevbitrevind(lengthfft) ARGS: lengthfft: long length of fft for bitreverse RETURNS: indAr[lenth]: long index array for bit reverse. generate a bit reverse index array; DESCRIPTION: The data from the pdev spectrometer is output in bit reversed order. This routine will generate an array of indices that can be used to put the spectrum in proper frequency order: EXAMPLE: ; let spcbr[8192] be the spectra in bit reversed order.. indR=pdevbitrevind(8192) spc=spcbr[indR] ; spc now in proper order
(See /pkg/rsi/local/libao/phil/pdev/pdevbitrevind.pro)
NAME:
pdevclose - close a pdev file for i/o
SYNTAX: pdevclose,desc,all=all
ARGS:
desc: {pdevdescr} - descriptor to close (returned by pdevopen)
KEYWORDS:
all: if set then close all open descriptors.
DESCRIPTION:
Files opened with pdevopen() need to be closed with pdevclose() so that
the resources are freed up.
EXAMPLE:
filename='/share/pdata/pdev/phil/071106//testfits.20071107.b0s0.00000.fits'
istat=pdevopen(filename,desc)
.. process the data in the file
pdevclose,desc .. this closes the file when done with the processing.
(See /pkg/rsi/local/libao/phil/pdev/pdevclose.pro)
NAME:
pdevcmpstats - compute avg, rms for set of files
SYNTAX: istat=pdevcmpstats(fnmIar,bavg,bavgN,bavgF,brms,brmsN,nrecsAr,descAr,$
fractFl=fractFl,maxrecs=maxrecs)
ARGS:
fnmIar[n]: {} hold files to process (returned from pdevfilelist())
KEYWORDS:
fracFl: float fraction of bandpass to use for flattening average spectra.
the default is .1 .
maxrecs long max number of records in file to use. Use this to limit the
records that are read in for large files.
RETURNS:
istat: long number of files processed (n)
bavg[n] : {} averaged data.
bavgN[n]: {} averaged data normalized to median of each bandpass.
bavgF[n]: {} averaged bandpassed flattend by taking fracFl of the
transformed bavg to create a bandpass correction.
brms[n] : {} rms by channel. Value is in average pdev counts.
brmsN[n]: {} rms by channel with each rms normalized by the
channel mean value.
nrecsAr[n]: lonarr number of records input for each file.
descAr[n]: {} descriptor for pdevopen for each file. Use this to
generate the freq arrays.
DESCRIPTION:
Compute the average and statistics for a number of files.
This routine was written to check the statistics as you change
the level count at the digitizer.
NOTES:
The routine tries to read in the entire file so don't use in on
very large files (or use the maxrecs keyword to limit recs to something that
can be read into memory).
The routine returns the info as an array. Each file should have the
same number of channels.
This routine will have trouble with data taken in stokes mode since the
rms over the stokes channels may blowup..
(See /pkg/rsi/local/libao/phil/pdev/pdevcmpstats.pro)
NAME:
pdevfileInfo - get file info
SYNTAX: istat=pdevfileInfo(filename,pdevfI)
ARGS:
filename: string name of pdev file
RETURNS:
pdevfI: {} file info structure;
(See /pkg/rsi/local/libao/phil/pdev/pdevfileinfo.pro)
NAME:
pdevfilelist - get list of pdev files
SYNTAX: nfiles=pdevfilelist(nmAr,fnmIAr,recur=recur)
ARGS:
nmAr[]: strarr An array of names to search. Each name can be
a pdev filename, or a directory name
KEYWORDS:
recur: if set then recurse down through any directories supplied.
RETURNS:
ntot : long number of .pdev files found
fnmIArNtot[]:{} an array of structures holding info on the
pdev files fou nd:w
DESCRIPTION:
The returned structure contains:
nmAr='/share/pdata/pdev/agc110443/x107.20070123.agc110443.b0a.00000.pdev'
istat=pdevfilelist(nmAr,fnmI)
help,fnmI,/st
* Structure PDEVFNMPARS, 8 tags, length=60, data length=60:
DIR STRING '/share/pdata/pdev/agc110443/'
FNAME STRING 'x107.20070123.agc110443.b0a.00000.pdev'
PROJ STRING 'x107'
DATE LONG 20070123
src STRING 'agc110443'
bm INT 0
BAND INT 0
grp INT 0
num INT 0
(See /pkg/rsi/local/libao/phil/pdev/pdevfilelist.pro)
NAME:
pdevfreq - return freq array for a spectra
SYNTAX: freqAr=pdevfreq(desc,skycfr=skycfr,lo2offset=lo2offset,lenfft=lenfft)
ARGS:
desc: {} returned by pdevopen
KEYWORDS:
skycfr: double sky cfr of band
lo2Offset: double offset lo2 from center of band. default: bw/2.
lenfft : long if timedomain data, then specify the len of the fft
RETURNS:
freqAr[]: frequency array in Mhz for the points in the spectra
Description:
After aug11, program uses info from desc.hao ao header to determin
the freq. prior to that it has to guess (or you can enter the
skycfr,lo2offset values).
(See /pkg/rsi/local/libao/phil/pdev/pdevfreq.pro)
NAME:
pdevget - read in a pdev record
SYNTAX: istat=pdevget(desc,d,rec=rec)
ARGS:
desc: {} returned by pdevopen
KEYWORDS:
rec: long record to position to before reading.
RETURNS:
istat: 1 got entire record
: 0 hit eof this file
: -1 some type of i/o error or bad data found.
(See /pkg/rsi/local/libao/phil/pdev/pdevget.pro)
NAME:
pdevgethdr - read a pdev header from file
SYNTAX: istat=pdevgethdr(lun,hdrpdev,hdrsp1,hdrao,pdevver)
ARGS:
lun: int for file to read
RETURNS:
istat: 0 got headers
-1 could not read file
-2 file does not contain a header
-3 not an sp1 file header (maybe an rdev file?)
hdrpdev: {} pdev main header
hdrsp1 : {} sp1 header
hdrao : {} ao hdr
pdevver: int version number 1,2, ...
DESCRIPTION:
Read the pdev header from the pdevfile. The file has already
been open (with lun the logical unit number for the open file).
This routine is normally called only by pdevopen();
(See /pkg/rsi/local/libao/phil/pdev/pdevgethdr.pro)
NAME:
pdevgetm - read multiple pdev recs
SYNTAX: istat=pdevgetm(desc,nrecs,b,rec=rec,avg=avg,tp=tp)
ARGS:
desc: {} returned by pdevopen
nrecs: long recs to read
KEYWORDS:
rec: long record to position to before reading (cnt from 1)
avg: if keyword set then return the averaged data
nobitrev: if set then don't do bit reversal on read
RETURNS:
istat: 1 got all the requested records
: 0 returned no records
: -1 returned some but not all of the recs
b[n]: {} array of structs holding the data
tp[n,2]: float array holding the total power for each spectra/sbc
(See /pkg/rsi/local/libao/phil/pdev/pdevgetm.pro)
NAME:
pdevgettmd - read pdev timedomain data
SYNTAX: istat=pdevgettmd(desc,smpToRead,b,smpPos=smpPos)
ARGS:
desc: {} returned by pdevopen
smpToRead: long samples to read
KEYWORDS:
smpPos: long sample offset from start of file. def: current pos
count from 1. <=0 --> current position
RETURNS:
n: n number of samples recovered
: 0 hit eof this file
: -1 some type of i/o error or bad data found.
b : complex return data here in struct
DESCRIPTION:
Read pdev time domain data. You could also use pdevget to
read the data (but it doesn't have the same parameters).
(See /pkg/rsi/local/libao/phil/pdev/pdevgettmd.pro)
NAME: pdevinplpf - input lowpass filter coef from disk SYNTAX: istat=pdevinplpf(filebase,filter) ARGS: filebase: string : basename for filter. Do not include the .0,.1,.2... RETURNS: istat : int : 0 ok, -1 error filt[] : int filter read in. It will be the symmetric about the center. DESCRIPTION: Read in a hires low pass filter. Pass in the basename for the filter (eg: 'dlpf.0032'). Don't include the .0,.1,.2,.3 . Program will input the filter, symmeterize, and then return it.
(See /pkg/rsi/local/libao/phil/pdev/pdevinplpf.pro)
NAME: pdevinppfb - input polyphase filter bank filter SYNTAX: istat=pdevinplpf(filename,len,filter) ARGS: filename: string : name of file holding filter: pfb.8192.hamming len: int : length of filter. eg 8192. RETURNS: istat : int : 0 ok, -1 error filt[] : int filter read in. It will be the symmetric about the center. DESCRIPTION: Read in a polyphase filter. Pass in the filename (with directory if needed). Also include the length of the pfb (eg. 8192). Program will input and return the filter.
(See /pkg/rsi/local/libao/phil/pdev/pdevinppfb.pro)
NAME:
pdevlevels - compute pdev levels during computation
SYNTAX: istat=pdevlevels(hsp,tp,pdevlevels,b=b)
ARGS:
hsp {hsp}: struct sp1 header (from desc.hsp).
tp[n] : float totPwr. each should come from hsp header.
KEYWORDS:
b : {} struct data struct read via pdevget. Will compute the
power for polA,B in this struct (returning array of 2)
RETURNS:
istat : int 0 ok, -1 error (time domain spectra).
pdevlev[n]:{} : structure holding the levels at various steps.
DESCRIPTION:
Given the total power value of a spectrum, and the sp1 header
(desc.hsp) compute the levels at each step in the pdev computational chain
(see http://www.naic.edu/~phil/hardware/pdev/pdevgain/settingPdevLvls.html).
The use can optionally pass in a single struct holding a spectral record
read via pdevget().
The steps in the computation are:
0. We use the average spectral value so divide by fftlen
1. spcAvg= totalPwr/spcLen
2. acc=spcAvg * ashiftScl
40 bit accum was upshifted by ashift and then the upper pack
bits were output.
3. acc1D=acc/ndumps : get value for 1 accum. uses FCNT
4. acc1=acc1*dshiftScl. correct for DSHIFT. downshifts by 2^(DSHIFT_S0)
5. fftOutpOut= sqrt(acc1/2.)/sqrt(2) : Converts to rms voltage.
Divide pwr by 2 since jeff computes V*V*2.
divide by sqrt(2) since pwr=(vI^2 + vR^2).
or sqrt(pwr)=sqrt(vI^2+VR^2)
if vI same magnitude as vR then we get sqrt 2.
6. fftInp: fftOut/pshiftScl
pshiftscl is log2(sqrt(fftlen)-numshiftPshift)
For unity scaling of noise in fft, need to divde by sqrt(fftlen)
7 pfbInp: fftInp/pfbScl
The fir portion of the pfb decreases noise rms by .75
8. If not hires mode, then the 12 bits of the A/D get put in the
upper 12 bits of the 18 bit pfb reg. So there is a mult by 2^6=64
to get Hi res to work:
- There is no scaling when going dlpfOut to pfbInp ->
upper most 16bits of dlpf -> lower 16 bits of pfbInp
- The lpdf has a dc gain of .627 (i measured .61)
-hr_shift (upshift) in the 26 bit accum should be set for unit
gain for noise. With dec=0 this would be upshift of 10.
if dec not zero then: hr_shift=10-alog2(sqrt(dec)) since the
noise grows as the sqrt of the number of adds.
- the 12 bits of the a/d are put in the upper 12 bits of the
dlpf 16 bit register (scale up by 2^4=16).
9. A/D sigma: answer is sqrt(2) too low..probably in the
conversion from power to voltage.
PdevLev structure:
IDL> help,lev1,/st
* Structure <9ff2c34>, 28 tags, length=116, data length=106, refs=3:
TP FLOAT 4.99311e+09 total power input
_FFTLEN UINT 8192 fftlen
SPCAVG FLOAT 609510. avg spectral value
_PACK_B INT 32 bits from accumulator returned
_ASHIFT UINT 0 upshift used in 40bit accum
ACC FLOAT 1.56035e+08 40 bit accum value
_FCNT LONG 20752 number of spectra added
ACC1D FLOAT 7519.02 avgSpc value 1 spectra
_DSHIFT UINT 0 down shift each spc before sum
ACC1 FLOAT 7519.02 acvSpc value before downshift
FFTOUT FLOAT 43.3561 output fft. rms
_VSHFIT UINT 0 upshift
_PSHIFT STRING '0x1ff5' pshift. butter fly downshifts
_SCLPSHIFT FLOAT 0.0441942 scaling of fft
_SCLPSHIFTMAX FLOAT 0.707107 max scaling fft thru butterflys
_SCLPSHIFTMIN FLOAT 0.0441942 min scaling fft thru butterflys
FFTINP FLOAT 981.03 rms input to fft.12bits in upper 18
_PFBGAIN FLOAT 0.750000 pfb noise gain
PFBINP FLOAT 1308.05 pfb inp
DLPFOUT FLOAT 20.4383 / by 64. 12 bits to upper 18.
_DEC INT 0 decimation dlpf
_LPDFGAIN FLOAT 0.627000 dlpf gain
_HRSHIFT UINT 9 hr_shift in dlpf
_HRSHIFTEXP FLOAT 0.0 expected shift
_LPDFSCALE FLOAT 1.00000 dlpf total scaling
_DLPFINP FLOAT 20.4383 dlpf input
ATODSIGMA FLOAT 20.4383 a/d sigma
ATODSIGMACOR FLOAT 28.9041 a/d sigma correct for sqrt(2)
(See /pkg/rsi/local/libao/phil/pdev/pdevlevels.pro)
NAME:
pdevopen - open pdev file for writing.
SYNTAX: istat=pdevopen(filename,desc,fnmI=fnmI,fnumhdr=fnumhdr)
ARGS:
filename: string filename to open (unless fnmI is specified)
KEYWORDS:
fnmI : {] returned from pdevfilelist. if provided,
then ignore filename and use this as the
file to open.
fnumhdr: string If the file you are openning is not the first file
of a run of multiple files, then fnumhdr specifies
the file number for the first file of the set (which
contains the header). See below for how to use this.
RETURNS:
istat: 0 ok
-1 could not open file.
-2 could not open header file in multi file set
-3 error reading headerfile
-4 header file didn not contain a header
-5 header file didn not contain an sp1 header
-6 unknown status from pdevgethdr()
desc : {} file descriptor to pass to the i/o routines.
DESCRIPTION:
Open a .pdev file. The format for a pdev file is a
1024 byte header followed by data. The data can be spectra or time domain
samples.
If multiple files were written during 1 scan then only the first file
has the 1024 byte header. The first file of a scan always starts with a
number that is a multiple of 100.
When you are done processing a file call pdevclose,desc to close the
file. You can use pdevclose,/all to close all open files. If you
are reading a multifile scan sequentially then the next pdevopen() will
close the previous file for you.
If you have multiple files in a scan, pdevopen() trys to guess which
file has the header. The algorithm it uses is:
1. if you open files sequentially from the first header file,
then pdevopen() stashes info in the desc. structure
2. if you specify fnumhdr= then it uses that number as the file
with the header.
3. if the filenumber is not divisible by 100 then it will take the lowest
number that is a multiple of 100 from the current file num and assume
that is the header.
A problem can arrive in step 3. if there are > 100 files in the scan
and you don't specify fnumhdr=..
eg: - scan starts at 1200
- 150 scans in file
- You want to open file 1305 without using fnumhdr=
- pdevopen() will take int(1305/100)*100=1300 as the header
instead of 1200. In this case you need to specify fnumdhr=1200
Examples:
1. To open the first file of a scan (which contains the header):
file='/share/pdata1/pdev/moon.20080605.b0s1g0.01200.pdev'
istat=pdevopen(file,desc)
.. process the file
2. To open a file in the above scan that was not the first file:
a. If you have already opened the first file:
file='/share/pdata1/pdev/moon.20080605.b0s1g0.01203.pdev'
istat=pdevopen(file,desc)
- In this case don't bother to close the previous file, pdevopen()
will do it for you.
b. If you want to open the 3rd file of the set:
file='/share/pdata1/pdev/moon.20080605.b0s1g0.01203.pdev'
istat=pdevopen(file,desc)
- pdevopen will try to figure out which file had the header.
b. If you want to open the 3rd file of the set, and pdevopen() can't
figure out which file was the header file:
file='/share/pdata1/pdev/moon.20080605.b0s1g0.01203.pdev'
istat=pdevopen(file,desc,fnumhdr=1200)
(See /pkg/rsi/local/libao/phil/pdev/pdevopen.pro)
NAME:
pdevparsfnm - parse a pdev file name
SYNTAX: istat=pdevparsfnm(filename,fnmI)
ARGS:
filename: string pdev filename to parse
RETURNS:
istat: int 1 if valid pdev name, 0 if not a valid pdev name
fnmI : {} structure holding the parsed information.
The format is:
dir/proj.date.obs.brdId.seqnum.pdev
where obs is optional
EXAMPLE:
filename='/share/pdata/pdev/agc110443/x107.20070123.agc110443.b0a.00000.pdev'
istat=pdevparsfnm(filename,fnmI)
IDL> help,fnmI,/st
* Structure PDEVFNMPARS, 8 tags, length=60, data length=60:
DIR STRING '/share/pdata/pdev/agc110443/'
FNAME STRING 'x107.20070123.agc110443.b0a.00000.pdev'
PROJ STRING 'x107'
DATE LONG 20070123
src STRING 'agc110443'
bm INT 0
BAND INT 0
grp INT 0
NUM LONG 0
(See /pkg/rsi/local/libao/phil/pdev/pdevparsfnm.pro)
NAME: pdevplot - plot pdev spectra SYNTAX: pdevplot,b,freq=freq ,over=over,brdlist=brdlist,norm=normRange
(See /pkg/rsi/local/libao/phil/pdev/pdevplot.pro)
NAME:
pdevpwr - read,compute total power
SYNTAX: istat=pdevpwr(desc,nrecs,tp,rec=rec,ind=ind,bpc=bpc,hI=hI)
ARGS:
desc: {} returned by pdevopen
nrecs: long number of records to process
KEYWORDS:
rec: long record to position to before reading (cnt from 1)
ind[n]: long if supplied then compute total power over the indices in
this array (should b 0.. nchan-1)
bpc[nchn,nsbc]: long if supplied then divided each spectra by this bandpass
before computing total power.
nsbc should be 1 or 2. if stokes u,v are present they
should be ignored.
RETURNS:
istat: number of records averaged.
: 0 returned no records
: -1 returned some but not all of the recs
tp[nrecs,nsbc]: float if supplied then return the total power at each sample
nsbc will be 1 or 2. If stokes u,v present, they are ignored.
hI[nrecs]: {} record header from each record. Contains sequence number (mod
64k, calon,off and overflow info.
DESCRIPTIION:
Read the requeseted number of records and compute the total power for each
sample. If the file has stokes info, the last two spectra (u,v) are ignored.
If the bpc keyword is supplied, then divide each spectra by the
band pass (1 bandpass for each pol) before computing the total power.
If the ind= keyword is supplied then compute the total power over the indices
provided in the ind array. The same indices are used for both pols. The indices
are over the returned channels (not the fftlen).
The total power is returned in the array tp[nchan,sbc]. If the keyword
hi= is provided then the record header from each record is also returned.
the structure contains:
IDL> help,hI,/st
** Structure PDEV_HDRDUMP, 10 tags, length=20, data length=20:
SEQNUM UINT 0
FFTACCUM UINT 191
CALON INT 0
ADCOVERFLOW INT 0
PFBOVERFLOW INT 0
SATCNTVSHIFT INT 0
SATCNTACCS2S3 INT 0
SATCNTACCS0S1 INT 0
SATCNTASHFTS2S3 INT 0
SATCNTASHFTS0S1 INT 0
(See /pkg/rsi/local/libao/phil/pdev/pdevpwr.pro)
NAME:
pdevrms - compute rms by channel
SYNTAX: brms=pdevrms(b,nodiv=nodiv,median=median)
ARGS:
b[n]: {} data from pdevget()
KEYWORDS:
median: if set then don't normalize each channel to mean/median value
nodiv: if set then don't normalize each channel to mean/median value
nocross: if set then don't bother to process cross spectra
RETURNS:
brms: {] pdev data structure with rms instead of spectra
DESCRIPTIION:
Compute standard deviation/mean by channel.
(See /pkg/rsi/local/libao/phil/pdev/pdevrms.pro)
NAME:
pdevsim - simulate pdev compuations.
SYNTAX: pdevsim,lenfft,toavg,noiseRms,sineAmp,spcAvg,pshift=pshift,$
doplot=doplot,dohist=dohist,nopfb=nopfb
ARGS:
lenfft: long length of fft to use. needs to be a power of 2.
toavg: long number of spectra to average.
noiseRms: float rms in A/D counts for noise
sineAmp: float amplitude of sine wave in a/d counts
KEYWORDS:
pshift: long bit map telling when to do downshifts in butterfly.
nopfb : if set then no polyphase filtering
RETURNS:
spcAvg[lenfft] the averaged spectrum with dc in the center (shift(spcavg,lenfft/2))
DESCRIPTION:
simulate the pdev spectrometer polyphase filter bank, fft, and power stages.
This routine differs from pdev in that it computes spectrum of PolA, not 2*spectrum of PolA
Spc
(See /pkg/rsi/local/libao/phil/pdev/pdevsim.pro)
NAME:
pdevtdspc - compute spectra for time domain data
SYNTAX: n=pdevtdspc(desc,nspc,spc,rec=rec,toavg=toavg,nchan=nchan)
ARGS:
desc:{} from pdevopen()
nspc: long number of averaged spectra to return
KEYWORDS:
rec: long record to position to before starting. 0--> no positioning.
toavg: long number of spectra toaverage. def=1
nchan: long lenght of spectra. Default is points in record.
RETURNS:
n: long number of averaged spectra
spc[nchan,n]: float averaged spectra
nspc - number of spectra to return
spc - return spectra here
DESCRIPTION:
Compute spectra from time domain data. It will compute the spectral
denisty function for nspc spectra. It will read the required number of
records to do this. The file will be left position after the last record
read. Any samples in the last record not used for the spectral computation
will be ignored.
(See /pkg/rsi/local/libao/phil/pdev/pdevtdspc.pro)
NAME:
pdevtpfile - compute total power for file.
SYNTAX: istat=pdevtpfile(fname,tp,hdr=hdr,hI=hI,fnmI=fnmI,ind=ind,bavg=bavg)
ARGS:
fname: string name of file to process (unless fnmI keyword is supplied)
KEYWORDS:
fnmI:{} if supplied, then take filename from here. This structure is
returned by bpdevfilelist().
ind[]: long if supplied, then these are the indices in the data
array to be used for the total power computation. The
indices are relative to the channels stored in the
file (not the fftlen in case these two are different).
RETURNS:
istat: long number of total power points returned (n)
0--> no points
-1 trouble opening file.
tp[n,2]: float total power. n = number of points. 2=pola,polb
hdr : {] primary header. reg and sp.
hdr.h1 (general hdr0< hdr.h2 (sp header)
hI[n] : {} record header for each record. contains sequence
number, calon/off and overflow info
bavg : {pdevget} if this keyword is supplied then the program will
first compute the spectral average of the entire
file and then use this average to bandpass correct
every spectra before computing the total power.
the average spectra is then returned here.
(See /pkg/rsi/local/libao/phil/pdev/pdevtpfile.pro)