-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmmirs_pipeline_nonlin_script.pro
104 lines (94 loc) · 3.14 KB
/
mmirs_pipeline_nonlin_script.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
function tostr, str
type = size(str,/type)
if type eq 4 or type eq 5 then return, strcompress(string(str, f='(f8.3)'),/rem) $
else return, strcompress(str,/rem)
end ; -- End of tostr
PRO mmirs_pipeline_nonlin_script, rawdir, w_dir=w_dir, first=first, $
linear=linear, keepfirst=keepfirst, $
verbose=verbose, debug=debug, $
biasframe=biasframe, badamp=badamp, $
crosstalk=crosstalk, compress=compress, $
tmpdir=tmpdir, clean=clean
;+
; NAME:
; MMIRS_PIPELINE_NONLIN_SCRIPT
;
; PURPOSE:
; Runs mmirs_pipeline's mmfixen_nonlin
;
; CALLING SEQUENCE:
; mmirs_pipeline_nonlin_script, rawdir
;
; INPUTS:
; rawdir - Directory path to raw files. Must end with '/'
;
; OPTIONAL KEYWORD INPUT:
; None.
;
; OUTPUTS:
;
; OPTIONAL OUTPUT KEYWORD:
; None.
;
; PROCEDURES USED:
;
; NOTES:
;
; REVISON HISTORY:
; Created by Chun Ly, 14 February 2018
;
; Modified by Chun Ly, 17 February 2018
; - Get all IDL_input.lis files and run mmfixend_nonlin for
; each set
;
; Modified by Chun Ly, 20 February 2018
; - Bug fix: 'IDL_infiles' to 'IDL_files'
; - Bug fix: READCOL format change (one column)
;
; Modified by Chun Ly, 21 February 2018
; - Check if file exists before running mmfixend_nonlin
;
; Modified by Chun Ly, 23 May 2018
; - Allow outdir keyword input option
;
; Modified by Chun Ly, 24 May 2018
; - Change outdir keyword input to w_dir
;
; Modified by Chun Ly, 26 May 2018
; - Compute time elapsed for each IDL input list and total
;-
t0_start = systime(1)
; Moved up on 17/02/2018
if not keyword_set(w_dir) then begin
outdir = rawdir+'preproc/'
endif else $
outdir = w_dir+'preproc/'
if not file_test(outdir) then $
spawn, 'mkdir '+outdir
suffix='.fix.fits'
; Get all IDL_input*lis files
if not keyword_set(w_dir) then begin
spawn, 'ls '+rawdir+'IDL_input*.lis', IDL_files
endif else $
spawn, 'ls '+w_dir+'IDL_input*.lis', IDL_files
n_IDL_files= n_elements(IDL_files)
for ff=0,n_IDL_files-1 do begin
t1_start = systime(1)
print, '### Reading : '+IDL_files[ff] + ' | '+systime()
READCOL, IDL_files[ff], files0, format='A'
for ii=0L,N_elements(files0)-1 do begin
outfile = outdir + files0[ii] + suffix
if not file_test(outfile + compress) then begin
mmfixen_nonlin, rawdir+files0[ii]+'.fits', outfile, first=first, $
linear=linear, keepfirst=keepfirst, verbose=verbose, $
debug=debug, biasframe=biasframe, badamp=badamp, $
crosstalk=crosstalk, compress=compress, tmpdir=tmpdir, $
clean=clean
endif else print, '## File exists! : ' + outfile + compress + ' | '+systime()
endfor
t1_end = systime(1)
print, 'Time spent for '+IDL_files[ff]+' : '+tostr((t1_end-t1_start)/60.)+' min'
endfor
t0_end = systime(1)
print, 'Total time spent : '+tostr((t0_end-t0_start)/60.)+' min'
END