-
Notifications
You must be signed in to change notification settings - Fork 0
/
WORKFLOW_EXTR.txt
52 lines (36 loc) · 2.05 KB
/
WORKFLOW_EXTR.txt
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
46
47
48
49
0) Prepare stacked, bias- and dark-subtracted lampflats suitable for analysis.
stacked_tung01="images/med_nres01_tung01_20180414_07d_06b_00a.fits.fz"
stacked_thar01="images/med_nres01_thar01_20180414_07d_06b_00a.fits.fz"
#stacked_tung12="images/med_nres01_tung12_20180414_07d_06b_00a.fits.fz"
#stacked_thar12="images/med_nres01_thar12_20180414_07d_06b_00a.fits.fz"
1) Initial guess at traces using Y-profile for simplicity.
./mayhem-find-spec-trace.py -B vtx-baffle-lsc.fits.fz $stacked_tung01 \
-Y handy/spec_yprofile_med.fits.fz -o initial_trace.fits
Optionally inspect results:
./mayhem-overplot-traces.py -T initial_trace.fits $stacked_tung01 -o tung01_tr1.fits
2) High-quality background measurement with traces masked out.
./mayhem-estimate-background.py -B vtx-baffle-lsc.fits.fz $stacked_tung01 \
-T initial_trace.fits -Y handy/spec_yprofile_med.fits.fz -o really_nice_background.fits
3) Subtract background from stacked lampflat.
fitsarith -qHi $stacked_tung01 \
-S really_nice_background.fits -o squeaky_clean_lampflat.fits
4) Re-identify traces from cleaned lampflat.
./mayhem-find-spec-trace.py -B vtx-baffle-lsc.fits.fz \
-Y handy/spec_yprofile_med.fits.fz -o improved_trace.fits \
squeaky_clean_lampflat.fits
Optionally inspect results:
./mayhem-overplot-traces.py -T improved_trace.fits squeaky_clean_lampflat.fits -o tung01_tr2.fits
# -----------------------------------------------------------------------
# DOUBLEs:
--> background tends to be low, let's just use the trace as-is (simpler anyway)
./mayhem-dumb-extract.py -S $stacked_thar01 -L squeaky_clean_lampflat.fits \
-T initial_trace.fits -o test_spec_thar01.fits
IPYTHON:
%run ./mayhem-dumb-extract.py -S images/med_nres01_thar01_20180414_07d_06b_00a.fits.fz -o test_spec_thar01.fits -L squeaky_clean_lampflat.fits -T initial_trace.fits
fibnum = 7
analyze(fibnum, show_flat=True)
xpix, ypix, sflux, wflux, lflux = spec_chunks[fibnum]
kde_mode = calc_kde_mode(sflux / wflux, **kde_opts)
wei_flux = wflux * kde_mode
lamp_relcounts = lflux / lflux.mean()
specflux = wei_flux / lamp_relcounts