Changed storage of results
parent
773a81631a
commit
134c0e702f
|
@ -298,7 +298,8 @@ if __name__ == '__main__':
|
|||
tnow = Time.now()
|
||||
|
||||
# Get obsid
|
||||
obsid = time.strftime("%Y%m%d_%H%M%S", time.gmtime())+"_%d" % device_id
|
||||
t = time.gmtime()
|
||||
obsid = "%s_%d/%s"%(time.strftime("%Y%m%d", t), device_id, time.strftime("%H%M%S", t))
|
||||
|
||||
# Generate directory
|
||||
if testing:
|
||||
|
|
38
process.py
38
process.py
|
@ -77,18 +77,22 @@ if __name__ == "__main__":
|
|||
fstat.write("fname,mjd,ra,de,rmsx,rmsy,mean,std,nstars,nused\n")
|
||||
|
||||
# Create output dirs
|
||||
path = args.file_dir
|
||||
if not os.path.exists(os.path.join(path, "classfd")):
|
||||
os.makedirs(os.path.join(path, "classfd"))
|
||||
if not os.path.exists(os.path.join(path, "catalog")):
|
||||
os.makedirs(os.path.join(path, "catalog"))
|
||||
if not os.path.exists(os.path.join(path, "unid")):
|
||||
os.makedirs(os.path.join(path, "unid"))
|
||||
if not os.path.exists(os.path.join(path, "processed")):
|
||||
os.makedirs(os.path.join(path, "processed"))
|
||||
if not os.path.exists(os.path.join(path, "not_seen")):
|
||||
os.makedirs(os.path.join(path, "not_seen"))
|
||||
|
||||
file_dir = os.path.dirname(args.file_dir)
|
||||
root_dir = os.path.split(file_dir)[0]
|
||||
results_dir = os.path.join(cfg.get('Common', 'results_path'),
|
||||
os.path.split(root_dir)[-1])
|
||||
processed_dir = os.path.join(root_dir, "processed")
|
||||
if not os.path.exists(os.path.join(results_dir, "classfd")):
|
||||
os.makedirs(os.path.join(results_dir, "classfd"))
|
||||
if not os.path.exists(os.path.join(results_dir, "catalog")):
|
||||
os.makedirs(os.path.join(results_dir, "catalog"))
|
||||
if not os.path.exists(os.path.join(results_dir, "unid")):
|
||||
os.makedirs(os.path.join(results_dir, "unid"))
|
||||
if not os.path.exists(os.path.join(results_dir, "not_seen")):
|
||||
os.makedirs(os.path.join(results_dir, "not_seen"))
|
||||
if not os.path.exists(processed_dir):
|
||||
os.makedirs(processed_dir)
|
||||
|
||||
# Forever loop
|
||||
while True:
|
||||
# Get files
|
||||
|
@ -113,7 +117,7 @@ if __name__ == "__main__":
|
|||
|
||||
# Extract tracks
|
||||
if is_calibrated(ff):
|
||||
extract_tracks(fname, trkrmin, drdtmin, trksig, ntrkmin, path)
|
||||
extract_tracks(fname, trkrmin, drdtmin, trksig, ntrkmin, root_dir, results_dir)
|
||||
|
||||
# Stars available and used
|
||||
nused = np.sum(pix_catalog.flag == 1)
|
||||
|
@ -135,10 +139,10 @@ if __name__ == "__main__":
|
|||
ff.zavg), np.std(ff.zavg), nstars, nused))
|
||||
|
||||
# Move processed files
|
||||
shutil.move(fname, os.path.join("processed", fname))
|
||||
shutil.move(fname + ".png", os.path.join("processed", fname + ".png"))
|
||||
shutil.move(fname + ".id", os.path.join("processed", fname + ".id"))
|
||||
shutil.move(fname + ".cat", os.path.join("processed", fname + ".cat"))
|
||||
shutil.move(fname, os.path.join(processed_dir, fname))
|
||||
shutil.move(fname + ".png", os.path.join(processed_dir, fname + ".png"))
|
||||
shutil.move(fname + ".id", os.path.join(processed_dir, fname + ".id"))
|
||||
shutil.move(fname + ".cat", os.path.join(processed_dir, fname + ".cat"))
|
||||
|
||||
# Sleep
|
||||
try:
|
||||
|
|
|
@ -231,7 +231,7 @@ def plot_header(fname, ff, iod_line):
|
|||
|
||||
|
||||
# Extract tracks
|
||||
def extract_tracks(fname, trkrmin, drdtmin, trksig, ntrkmin, path):
|
||||
def extract_tracks(fname, trkrmin, drdtmin, trksig, ntrkmin, path, results_path):
|
||||
# Read four frame
|
||||
ff = fourframe(fname)
|
||||
|
||||
|
@ -343,7 +343,7 @@ def extract_tracks(fname, trkrmin, drdtmin, trksig, ntrkmin, path):
|
|||
ppg.pgend()
|
||||
|
||||
# Store results
|
||||
store_results(ident, fname, path, iod_line)
|
||||
store_results(ident, fname, results_path, iod_line)
|
||||
object_detected = True
|
||||
elif ident.catalog.find("classfd.tle") > 0:
|
||||
# Track and stack
|
||||
|
@ -353,7 +353,7 @@ def extract_tracks(fname, trkrmin, drdtmin, trksig, ntrkmin, path):
|
|||
|
||||
# Skip if no points selected
|
||||
if np.sum(c) == 0:
|
||||
store_not_seen(ident, fname, path)
|
||||
store_not_seen(ident, fname, results_path)
|
||||
continue
|
||||
|
||||
# Compute track
|
||||
|
@ -387,12 +387,12 @@ def extract_tracks(fname, trkrmin, drdtmin, trksig, ntrkmin, path):
|
|||
|
||||
# Skip if peak is not significant
|
||||
if sigma < trksig:
|
||||
store_not_seen(ident, fname, path)
|
||||
store_not_seen(ident, fname, results_path)
|
||||
continue
|
||||
|
||||
# Skip if point is outside selection area
|
||||
if inside_selection(ident, tmid, x0, y0) is False:
|
||||
store_not_seen(ident, fname, path)
|
||||
store_not_seen(ident, fname, results_path)
|
||||
continue
|
||||
|
||||
# Format IOD line
|
||||
|
@ -430,7 +430,7 @@ def extract_tracks(fname, trkrmin, drdtmin, trksig, ntrkmin, path):
|
|||
ppg.pgend()
|
||||
|
||||
# Store results
|
||||
store_results(ident, fname, path, iod_line)
|
||||
store_results(ident, fname, results_path, iod_line)
|
||||
object_detected = True
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue