Skip to content

Commit

Permalink
second attempts
Browse files Browse the repository at this point in the history
  • Loading branch information
kif committed Dec 10, 2024
1 parent d1c7cb8 commit 6582735
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions plugins/bm29/ispyb.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,23 +107,26 @@ def send_icat(self, proposal=None, beamline=None, sample=None, dataset=None, pat
:param data: dict with all data sent to ISpyB
"""
print(f"proposal:{proposal}, beamline:{beamline}, sample:{sample}, dataset:{dataset}, path:{path}, raw:{raw}, data:{data}, ")
logger.warning(f"proposal:{proposal}, beamline:{beamline}, sample:{sample}, dataset:{dataset}, path:{path}, raw:{raw}, data:{data}, ")
tmp = self.gallery.strip("/").split("/")
idx_process = [i for i,j in enumerate(tmp) if j.lower().startswith("process")][-1]
print(tmp, idx_process)
assert idx_process>5
if proposal is None:
proposal = tmp[idx_process-5]
if beamline is None:
beamline = tmp[idx_process-4]
if sample is None:
sample = tmp[idx_process-2]
if dataset is None:
dataset = tmp[idx_process+1]
if path is None:
path = os.path.dirname(self.gallery)
if raw is None:
raw = os.path.abspath(self.gallery[:self.gallery.lower().index("process")])
logger.warning(f"tmp: {' '.join(tmp)}, {idx_process}")
if tmp[idx_process] == "process":
assert idx_process>5
if proposal is None:
proposal = tmp[idx_process-5]
if beamline is None:
beamline = tmp[idx_process-4]
if sample is None:
sample = tmp[idx_process-2]
if dataset is None:
dataset = tmp[idx_process+1]
if path is None:
path = os.path.dirname(self.gallery)
if raw is None:
raw = os.path.abspath(self.gallery[:self.gallery.lower().index("process")])
elif tmp[idx_process] == "PROCESSED_DATA":
pass

metadata = {"definition": "SAXS",
"Sample_name": sample}
Expand Down

0 comments on commit 6582735

Please sign in to comment.