forked from dcnora/photometrypipeline
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtest.py
94 lines (87 loc) · 2.79 KB
/
test.py
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
from photopipe.reduction.preprocess import choose
from photopipe.reduction.preprocess import master
from photopipe.reduction.auto.autoproc import autoproc
from shutil import move
import os
import glob
from zipfile import ZipFile
# testing git commit and push
print("creating paths")
base_path = os.path.dirname(os.path.abspath(__file__))
print('base_path', base_path)
test_path = os.path.join(base_path, 'test')
print('test_path', test_path)
copy_path = os.path.join(test_path, 'copy')
print('copy_path', copy_path)
selected_path = os.path.join(copy_path, 'selected')
print('selected_path', selected_path)
reduced_path = os.path.join(copy_path, 'reduced')
print('reduced_path', reduced_path)
zip_file = os.path.join(test_path, 'test.zip')
print(zip_file, zip_file)
zf = ZipFile(zip_file, 'r')
print('extracting files')
zf.extractall(copy_path)
print('extraction complete')
print('start bias calibration')
bias_calib = choose.choose_calib(
'lmi',
'bias',
workdir=copy_path+os.path.sep,
cams=[0],
auto=True,
amin=0.0, amax=1.0,
reject_sat=False,
save_select=True,
noplot=True
)
print('start flat calibration')
flat_calib = choose.choose_calib(
'lmi',
'flat',
workdir=copy_path+os.path.sep,
cams=[0],
auto=True,
amin=0.2, amax=0.8,
reject_sat=False,
save_select=True,
noplot=True
)
print('start choose science')
science_dict = choose.choose_science(
'lmi',
workdir=copy_path+os.path.sep,
targetdir=selected_path+os.path.sep,
cams=[0],
auto=True,
save_select=True,
calibrate=False,
noplot=True
)
print('start mkmaster bias')
master.mkmaster('lmi', bias_calib, 'bias')
print('start mkmaster flat')
master.mkmaster('lmi', flat_calib, 'flat')
print('start move files master biases to selected folder')
for f in glob.glob(os.path.join(base_path, 'bias*.fits')):
filename = os.path.basename(f)
print('selected_path', selected_path)
f_base_path = os.path.join(base_path, filename)
print('f_base_path', f_base_path)
f_selected_path = os.path.join(selected_path, filename)
print('f_selected_path', f_selected_path)
print('moving {0} to {1}'.format(f_base_path, f_selected_path))
move(f_base_path, f_selected_path)
print('start move files master flats to selected folder')
for f in glob.glob(os.path.join(base_path, 'flat*.fits')):
filename = os.path.basename(f)
print('selected_path', selected_path)
f_base_path = os.path.join(base_path, filename)
print('f_base_path', f_base_path)
f_selected_path = os.path.join(selected_path, filename)
print('f_selected_path', f_selected_path)
print('moving {0} to {1}'.format(f_base_path, f_selected_path))
move(f_base_path, f_selected_path)
autoproc(datadir=selected_path+os.path.sep,
imdir=reduced_path+os.path.sep,
redo=1, nomastersky=True)