; pro bckgnd_read common stuff, ntrigs,trigs,trgrec,ndisc,stbins,toters,nintvs,bckpair,ndegs,qfit ; ; get trig#s, background intervals and fits, and burst containment intervals ; ; the 1st record for each burst, "trgrec", records values for 10 descriptors: ; ; trig# sequential BATSE trigger number ; lenla length of discla_ibdb file in blocks ; lenpb length of preb_ibdb file in blocks ; lensc length of discsc_ibdb file in blocks ; nlasc # of 64-ms bins created from 1.024-s discla, prior to trigger ; 1preb 1st 64-ms preb bin, after last whole 1.024-s discla bin ; ndisc total # of 64-ms samples, per channel, in time profile ; trigtime start time for preb data ; ndeg degree of polynomial fit ; nintvs # of background intervals used in fit ; filespec = 'txxbats:' + 'bat_files.revamp_join' openr, luin, filespec, /get_lun ; ntrigs = 0 & nulrec = '' readf, luin, f="(9X,I4)", ntrigs ;read # of triggers to process for irec = 0,3 do readf, luin, nulrec ;read descriptor header records ; trigs = intarr(ntrigs) ;BATSE trigger number trgrec = strarr(ntrigs) ;string of descriptors ndisc = intarr(ntrigs) ;total # of 64-ms bins in time profile stbins = intarr(ntrigs) ;start bin, burst containment interval toters = intarr(ntrigs) ;total bins, burst containment interval ; intvmax = 5 ;max # of background intervals nintvs = intarr(ntrigs) ;# of background intervals bckpair = intarr(ntrigs,2,intvmax) ;background intervals ; ndegs = intarr(ntrigs) ;degree of polynomial fit ndegmax = 5 ;max degree, poly fit qfit = fltarr(ntrigs,4,ndegmax+1) ;4-channel background fit array qchans = fltarr(4) ;temporary array ; tmprec = '' ; for itrig = 0,ntrigs-1 do begin readf, luin, tmprec trgrec(itrig) = tmprec trigs(itrig) = fix(strmid(tmprec,3,4)) nintvs(itrig) = fix(strmid(tmprec,67,1)) tmpintvs = intarr(nintvs(itrig)*2+2) readf, luin, f="(1X,12I6)", tmpintvs bckpair(itrig,*,0:nintvs(itrig)-1) = tmpintvs(0:nintvs(itrig)*2-1) ; ndisc(itrig) = fix(strmid(tmprec,44,5)) stbin = tmpintvs(2*nintvs(itrig)) endbin = tmpintvs(2*nintvs(itrig)+1) stbins(itrig) = stbin toters(itrig) = endbin - stbin + 1 ; ndegs(itrig) = fix(strmid(tmprec,63,1)) for ideg = 0,ndegs(itrig) do begin readf, luin, f="(1X,4E13.6)", qchans qfit(itrig,*,ideg) = qchans endfor endfor ; ; render qfit coeffs into per (64-ms bin)^ideg, from per (1.024-s bin)^ideg: ; for ideg = 0,5 do qfit(*,*,ideg) = qfit(*,*,ideg) / 16.^(ideg+1) ; close, luin & free_lun, luin ; return & end ; ; begin Main Program ; common stuff, ntrigs,trigs,trgrec,ndisc,stbins,toters,nintvs,bckpair,ndegs,qfit ; ; read background fits for concated 64-ms data ; bckgnd_read ; end