forked from dcnora/photometrypipeline
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtest_2.py
131 lines (127 loc) · 4.16 KB
/
test_2.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
from photopipe.reduction.preprocess import choose
from photopipe.reduction.preprocess import master
from photopipe.reduction.auto.autoproc import autoproc
from shutil import move
import numpy as np
import os
import glob
import time
from zipfile import ZipFile
# Is test.py but uses new preprocessing structure
key = 'ratir'
# 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, 'Data')
print('test_path', test_path)
copy_path = os.path.join(test_path, 'May_04_New')
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(
# key,
# '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
# )
#
# if key == 'ratir':
# print('start dark calibration')
# dark_calib = choose.choose_calib(
# key,
# 'dark',
# 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(
# key,
# '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(
# key,
# 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(key, bias_calib, 'bias')
# if key == 'ratir':
# print('start mkmaster dark')
# master.mkmaster('ratir', dark_calib, 'dark')
# print('start mkmaster flat')
# master.mkmaster('ratir', 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 darks to selected folder')
# for f in glob.glob(os.path.join(base_path, 'dark*.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, start='makesky', nomastersky=False)
autoproc(datadir=selected_path+os.path.sep,
imdir=reduced_path+os.path.sep,
redo=1, start='stack', debug=True, nocrclean=False, mastersky=True, skyflattarg=True)