PRO get2hrs,infile ; Get a signal array (beam-formed) from a single 2-hour block of PSM data. ; Write the array in a file. ; r0124506.27m -> r0124506.27b (beam-formed signal) ; Then mix and roll off at the rafos frequency and write to a file: ; -> r0124506.27b ; RWB, November 3, 2001. str1=''; buffer day0=double(0); starting day for file (double-precision floating) IF n_params() eq 0 THEN BEGIN; if no file on command line, get one infile='/usr/data/bland/pioneer/2001/r0124506.27m'; name of a PSM 2-hr data file ;***** Ask for file name ***** read,'input file: '+strmid(infile,strlen(infile)-12,12)+' : ',str1 IF strlen(str1) gt 0 THEN strput,infile,str1,strlen(infile)-12 ENDIF print,'infile: ',infile outfileb=infile; Beam-formed-signal file name strput,outfileb,'b',strlen(outfileb)-1 print,'outfileb: ',outfileb outfilew=infile; Webb-filtered-signal file name strput,outfilew,'w',strlen(outfilew)-1 print,'outfilew: ',outfilew nblk=long(1801); This is the number of blocks on standard PSM files. lblk=long(4096); samples per block nsamp=nblk*lblk; number of samples per 2-hr file (=7,376,896) idat=intarr(nsamp) idat1blk=intarr(lblk) openr, lun1, infile, /get_lun FOR iblk=0,nblk-1 DO BEGIN IF iblk eq 0 THEN BEGIN blk=assoc( lun1, bytarr(32786) ) b=blk[iblk] day0=dofyear(b(0:17)) print,string(b(0:16)),' day of year = ',day0,format='(2a,f14.9)' ENDIF get1blk,lun1,iblk,idat1blk,dayofyr; Read in one block, form beam. idat(iblk*lblk:(iblk+1)*lblk-1)=idat1blk; Store in array. ENDFOR close,lun1 free_lun,lun1 openw,lunout,outfileb,/get_lun writeu,lunout,day0,idat close,lunout free_lun,lunout ;***** Mix and filter for Webb sources. sinwav=sin(260.*2.*!pi*indgen(nsamp)/1000.); carrier sinwav=sinwav*idat; Mix data with carrier. lblk=long(128); averaging block, about 1/8 second nblk=nsamp/lblk; number of blocks websig=fltarr(nblk) FOR iblk=long(0),nblk-1 DO BEGIN websig(iblk)=total(sinwav(iblk*lblk:(iblk+1)*lblk-1)) ENDFOR openw,lunout,outfilew,/get_lun writeu,lunout,day0,lblk,nblk,websig close,lunout free_lun,lunout ; save END PRO get1blk,lun1,iblk,vlabeam,dayofyr blk=assoc( lun1, bytarr(32786) ) b=blk[iblk] data = fix(b, 18, 4, 4096 ) data = transpose( temporary(data)) byteorder, data, /sswap vlabeam=fix((long(data(*,0))+long(data(*,1))+long(data(*,2))+ $ long(data(*,3)))/4) END FUNCTION dofyear,b ; Calculate a double-precision day of the year, from a byte array b ; containing a string of the form ; ddd:hh:mm:ss.sssS[LF] ; This is the time string from Pioneer Seamount data files. ; RWB, September 29, 2001 return, double(string(b(0:2)))+ $ 1./24.*(double(string(b(4:5))) + $ 1./60.*(double(string(b(7:8))) + $ 1./60.* double(string(b(10:15))) ) ) END