Make process.py robust for when not yet calibrated
process.py does not attempt to process the files, if calibration has not been solved yet. Only if test.fits is available, the processing will start. This makes process.py, just wait for new files, to try the calibrate on. This is handy if you started process.py, while the sky is still bright or clouded.pull/67/head
parent
bc24bbd88c
commit
46677f45fa
67
process.py
67
process.py
|
@ -200,43 +200,50 @@ if __name__ == "__main__":
|
|||
solved = False
|
||||
# Loop over files to find a suitable calibration file
|
||||
for fname in fnames:
|
||||
# Generate star catalog
|
||||
pix_catalog = generate_star_catalog(fname)
|
||||
# Was this file already tried?
|
||||
if not os.path.exists(fname+".cat"):
|
||||
# Generate star catalog
|
||||
pix_catalog = generate_star_catalog(fname)
|
||||
|
||||
# Solve
|
||||
if pix_catalog.nstars > nstarsmin:
|
||||
print(colored("Computing astrometric calibration for %s" % fname, "yellow"))
|
||||
solved = generate_reference_with_anet(fname, "")
|
||||
# Solve
|
||||
if pix_catalog.nstars > nstarsmin:
|
||||
print(colored("Computing astrometric calibration for %s" % fname, "yellow"))
|
||||
solved = generate_reference_with_anet(fname, "")
|
||||
|
||||
# Break when solved
|
||||
if solved:
|
||||
break
|
||||
# Break when solved
|
||||
if solved:
|
||||
break
|
||||
else:
|
||||
# test.fits exists, so calibration has been solved
|
||||
solved = True
|
||||
|
||||
p = mp.Pool(processes=cpu_count)
|
||||
# Only attempt processing if we have a calibration file
|
||||
if solved:
|
||||
p = mp.Pool(processes=cpu_count)
|
||||
|
||||
try:
|
||||
# Loop over files in parallel, print output every batch size of cpu_count
|
||||
satobs_chunks = chunks(fnames,cpu_count)
|
||||
for chk in satobs_chunks:
|
||||
for result in p.map(process_loop, chk):
|
||||
(screenoutput, fileoutput, screenoutput_idents) = result
|
||||
try:
|
||||
# Loop over files in parallel, print output every batch size of cpu_count
|
||||
satobs_chunks = chunks(fnames,cpu_count)
|
||||
for chk in satobs_chunks:
|
||||
for result in p.map(process_loop, chk):
|
||||
(screenoutput, fileoutput, screenoutput_idents) = result
|
||||
|
||||
fstat.write(fileoutput)
|
||||
print(screenoutput)
|
||||
fstat.write(fileoutput)
|
||||
print(screenoutput)
|
||||
|
||||
if screenoutput_idents is not None:
|
||||
for [outfilename, iod_line, color] in screenoutput_idents:
|
||||
print(colored(iod_line,color))
|
||||
# Write iodline
|
||||
with open(outfilename, "a") as fp:
|
||||
fp.write("%s\n" % iod_line)
|
||||
if screenoutput_idents is not None:
|
||||
for [outfilename, iod_line, color] in screenoutput_idents:
|
||||
print(colored(iod_line,color))
|
||||
# Write iodline
|
||||
with open(outfilename, "a") as fp:
|
||||
fp.write("%s\n" % iod_line)
|
||||
|
||||
p.close()
|
||||
p.join()
|
||||
except KeyboardInterrupt:
|
||||
fstat.close()
|
||||
p.close()
|
||||
sys.exit()
|
||||
p.close()
|
||||
p.join()
|
||||
except KeyboardInterrupt:
|
||||
fstat.close()
|
||||
p.close()
|
||||
sys.exit()
|
||||
|
||||
# Sleep
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue