-
Notifications
You must be signed in to change notification settings - Fork 2
/
time_hist.pro
33 lines (31 loc) · 961 Bytes
/
time_hist.pro
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
spawn,"wc -l fuv_cts.txt",str
noff = long(getwrd(str))
data = dblarr(3, noff)
openr,1,"fuv_cts.txt" & readf,1,data & close,1
times=reform(data[0,*], noff)
objcts = reform(data[1,*],noff)
bkdcts = reform(data[2,*], noff)
bin_t = 100.
ngridt = (max(times) - min(times))/bin_t
gridt=min(times) + dindgen(ngridt)*bin_t
objhist = fltarr(ngridt)
errhist = fltarr(ngridt)
bkghist = fltarr(ngridt)
numb = intarr(ngridt)
for i = 0l, ngridt-2 do begin
q = where((times ge gridt[i]) and (times lt gridt[i+1]), nq)
if (nq gt 0)then begin
objhist[i] = total(objcts[q])/nq
errhist[i] = sqrt(total(objcts[q]))/nq
bkghist[i] = total(bkdcts[q])/nq
numb[i]=nq
; if (objhist[i] lt .02)then stop
endif
endfor
openw,1,"fuv_time_hist.txt"
printf,1, "time Source CTS Source ERR BKG CTS"
for i=0l,ngridt - 1 do begin
if (numb[i] gt 1000) then printf,1,gridt[i],objhist[i],errhist[i],bkghist[i],format="(d15.5,1x,f7.4,1x,f7.4,1x,f7.4)"
endfor
close,1
end