forked from NuSTAR/nuskybgd
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfloor_bkgsub.pro
More file actions
47 lines (27 loc) · 1.01 KB
/
floor_bkgsub.pro
File metadata and controls
47 lines (27 loc) · 1.01 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
pro floor_bkgsub
cd, '/Users/bwgref/science/casA/image_analysis/split_files/bgd_sub'
f = file_search('nu*bsub.fits')
expdir = '/Users/bwgref/science/casA/image_analysis/expo_maps/'
for i = 0, n_elements(f) -1 do begin
print, f[i]
image_file = f[i]
prefix = (strsplit(f[i], '_', /extract))[0]
exp_file = expdir+prefix+'_ex_5.img'
cts_image = mrdfits(image_file, 0, header)
exp_image = mrdfits(exp_file, 0)
not_finite = where(~finite(cts_image / exp_image))
cts_image[NOT_FINITE] = 0
; plot, cts_image / exp_image
; cgimage, cts_image / exp_image, /scale, /keep_aspect
; stop
low_exposure = where(exp_image lt 0.2 * mean(exp_image[where(exp_image ne 0)]))
; plot, exp_image
; oplot, low_exposure * [0, n_elements(exp_image)]
cts_image[low_exposure] = 0.
filename = file_basename(image_file, '.fits')+'_floor.fits'
fi = file_info(filename)
; if fi.exists then continue
print, filename
mwrfits, cts_image, filename, header, /create
endfor
end