Skip to content

Commit

Permalink
Additional code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Gruzinov committed Mar 5, 2024
1 parent b49250c commit a97c32e
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions mxcubecore/HardwareObjects/DESY/P11Collect.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,12 +380,12 @@ def data_collection_hook(self):
HWR.beamline.detector.start_acquisition()

if collection_type == "Characterization":
print("STARTING CHARACTERISATION")
self.log.debug("STARTING CHARACTERISATION")
self.collect_characterisation(
start_angle, img_range, nframes, angle_inc, exp_time
)
else:
print("STARTING STANDARD COLLECTION")
self.log.debug("STARTING STANDARD COLLECTION")
self.collect_std_collection(start_angle, stop_angle)
self.generate_xds_template()

Expand All @@ -394,7 +394,7 @@ def data_collection_hook(self):
finally:
self.add_h5_info(self.latest_h5_filename)
self.acquisition_cleanup()
print("STARTING PROCESSING")
self.log.debug("STARTING PROCESSING")

def collect_std_collection(self, start_angle, stop_angle):
"""
Expand Down Expand Up @@ -451,11 +451,11 @@ def collect_characterisation(
self.omega_mv(start_angle, self.default_speed)

for img_no in range(nimages):
print("collecting image %s" % img_no)
self.log.debug("collecting image %s" % img_no)
start_at = start_angle + angle_inc * img_no
stop_angle = start_at + img_range * 1.0

print("collecting image %s, angle %f" % (img_no, start_at))
self.log.debug("collecting image %s, angle %f" % (img_no, start_at))

# Keep it here for now. It is not clear if it is needed.
if start_at >= stop_angle:
Expand Down Expand Up @@ -866,8 +866,9 @@ def trigger_auto_processing(self, process_event=None, frame_number=None):
open(datasets_file, "a", encoding="utf-8").write(
xdsapp_path_local.split("/gpfs/current/processed/")[1] + "\n"
)
except RuntimeError:
print(sys.exc_info())
except RuntimeError as err_msg:
self.log.debug("Cannot write to datasets.txt")
self.log.debug(sys.exc_info())

# create call
ssh = btHelper.get_ssh_command()
Expand Down Expand Up @@ -1079,13 +1080,13 @@ def check_path(self, path=None, force=False):
try:
os.mkdir(path, mode=0o777)
except RuntimeError:
print("mkdir failed:", str(sys.exc_info()))
self.log.debug("mkdir failed:", str(sys.exc_info()))
return False
else:
print("dir not found:", str(sys.exc_info()))
self.log.debug("dir not found:", str(sys.exc_info()))
return False
if not os.access(path, os.W_OK):
print("dir not writeable:", str(sys.exc_info()))
self.log.debug("dir not writeable:", str(sys.exc_info()))
return False
return path

Expand Down

0 comments on commit a97c32e

Please sign in to comment.