Skip to content

Instantly share code, notes, and snippets.

@heathhenley
Created July 15, 2019 12:15
Show Gist options
  • Save heathhenley/76fcc2551df4e498dff59636ffa5f287 to your computer and use it in GitHub Desktop.
Save heathhenley/76fcc2551df4e498dff59636ffa5f287 to your computer and use it in GitHub Desktop.
Run all the cal files
import pathlib
import time
import calibrate
CALIBRATION_DIR = r"\\pvd\calibrationdata"
p = pathlib.Path(CALIBRATION_DIR)
for pattern in ("*SH4*", "*SH6*"):
folders = list(p.glob(pattern))
print("Processing {} folders matching: {}".format(len(folders), pattern))
print("Running calibrate.py in:")
for idx, f in enumerate(folders):
path_to_file = f / "0 deg" / "61.3"
try:
if path_to_file.is_dir():
print( "{}... ".format(path_to_file),
flush=True, end='')
args = ["-p", str(path_to_file), "--hide-plots"]
tic = time.clock()
calibrate.main(argv=args)
toc = time.clock()
print("Done ({:.2f}sec)".format(toc-tic))
print(" Approximate time remaining: {} minutes"
.format(int((toc-tic)*(len(folders) - idx)/60.0)))
except Exception as e:
print("Failed")
print("Path: {} raised an exception {}".format(path_to_file, e))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment