From 80b6d3f17dd98393d7d13fccdbcec2d29e7f9212 Mon Sep 17 00:00:00 2001 From: Thomas Morris Date: Wed, 24 Jan 2024 13:35:54 -0500 Subject: [PATCH 1/2] write to proposal directories --- startup/00-base.py | 9 +++++++ startup/20-area-detectors.py | 46 ++++++++++++++++++------------------ 2 files changed, 32 insertions(+), 23 deletions(-) diff --git a/startup/00-base.py b/startup/00-base.py index c0acfd3..0371797 100644 --- a/startup/00-base.py +++ b/startup/00-base.py @@ -63,6 +63,15 @@ def _load(file): # PersistentDict will create the directory if it does not exist RE.md = PersistentDict(runengine_metadata_dir) +data_session = RE.md.get("data_session") +if data_session is None: + raise ValueError("Data session is None!") + +cycle = '2023-3' # TODO: don't hardcode this + +proposal_dir = f"/nsls2/data/chx/proposals/{cycle}/{data_session}" +Path(proposal_dir).mkdir(parents=True, exist_ok=True) + # send ophyd debug log to the console # import logging #logging.getLogger('ophyd').setLevel('DEBUG') diff --git a/startup/20-area-detectors.py b/startup/20-area-detectors.py index aad40a0..90028a5 100644 --- a/startup/20-area-detectors.py +++ b/startup/20-area-detectors.py @@ -129,14 +129,14 @@ def hints(self): class StandardProsilicaWithTIFF(StandardProsilica): tiff = Cpt(TIFFPluginWithFileStore, suffix='TIFF1:', - write_path_template='/nsls2/data/chx/legacy/data/%Y/%m/%d/', - root='/nsls2/data/chx/legacy/data') + write_path_template=f'{proposal_dir}/legacy/data/%Y/%m/%d/', + root=f'{proposal_dir}/legacy/data') class StandardProsilicaWithTIFFV33(StandardProsilicaV33): tiff = Cpt(TIFFPluginWithFileStore, suffix='TIFF1:', - write_path_template='/nsls2/data/chx/legacy/data/%Y/%m/%d/', - root='/nsls2/data/chx/legacy/data') + write_path_template=f'{proposal_dir}/legacy/data/%Y/%m/%d/', + root=f'{proposal_dir}/legacy/data') #root='/XF11ID/data') class EigerSimulatedFilePlugin(Device, FileStoreBase): @@ -524,9 +524,9 @@ def counter_cb(value, timestamp, **kwargs): xray_eye4_writing = StandardProsilicaWithTIFFV33('XF:11IDB-BI{Cam:09}', name='xray_eye4') OAV_writing = StandardProsilicaWithTIFFV33('XF:11IDB-BI{Cam:10}', name='OAV') #OAV_writing = StandardProsilicaWithTIFFV33('XF:11ID-M3{Det-Cam:3}', name='OAV') # printer OAV using Grasshoper UBS3 camera -OAV_writing.tiff.write_path_template = '/nsls2/data/chx/legacy/data/%Y/%m/%d/' -OAV_writing.tiff.read_path_template = '/nsls2/data/chx/legacy/data/%Y/%m/%d/' -OAV_writing.tiff.reg_root = '/nsls2/data/chx/legacy/data/' +OAV_writing.tiff.write_path_template = f'{proposal_dir}/legacy/data/%Y/%m/%d/' +OAV_writing.tiff.read_path_template = f'{proposal_dir}/legacy/data/%Y/%m/%d/' +OAV_writing.tiff.reg_root = f'{proposal_dir}/legacy/data/' BCam_writing = StandardProsilicaWithTIFFV33('XF:11IDB-ES{BFLY-Cam:1}', name='BCam') @@ -648,8 +648,8 @@ def enable_plugins(det, plugin_names): set_eiger_defaults(eiger500k_single) # AD v3.3+ config: eiger500k_single.cam.ensure_nonblocking() - eiger500k_single.file.write_path_template = '/nsls2/data/chx/assets/eiger500k/%Y/%m/%d/' - eiger500k_single.file.reg_root ='/nsls2/data/chx/assets/eiger500k/' + eiger500k_single.file.write_path_template = f'{proposal_dir}/assets/eiger500k/%Y/%m/%d/' + eiger500k_single.file.reg_root =f'{proposal_dir}/assets/eiger500k/' except Exception: print('eiger500k not configured...') raise @@ -664,8 +664,8 @@ def enable_plugins(det, plugin_names): # Eiger 4M using internal trigger eiger4m_single = EigerSingleTrigger_AD37_V2('XF:11IDB-ES{Det:Eig4M}', name='eiger4m_single') -eiger4m_single.file.write_path_template = '/nsls2/data/chx/assets/eiger4m/%Y/%m/%d/' -eiger4m_single.file.reg_root ='/nsls2/data/chx/assets/eiger4m/' +eiger4m_single.file.write_path_template = f'{proposal_dir}/assets/eiger4m/%Y/%m/%d/' +eiger4m_single.file.reg_root =f'{proposal_dir}/assets/eiger4m/' set_eiger_defaults(eiger4m_single) # AD v3.3+ config: eiger4m_single.cam.ensure_nonblocking() @@ -674,22 +674,22 @@ def enable_plugins(det, plugin_names): # Eiger 500K using fast trigger assembly eiger500k = EigerFastTrigger('XF:11IDB-ES{Det:Eig500K}', name='eiger500k') set_eiger_defaults(eiger500k) - eiger500k.file.write_path_template = '/nsls2/data/chx/assets/eiger500k/%Y/%m/%d/' - eiger500k.file.reg_root ='/nsls2/data/chx/assets/eiger500k/' + eiger500k.file.write_path_template = f'{proposal_dir}/assets/eiger500k/%Y/%m/%d/' + eiger500k.file.reg_root =f'{proposal_dir}/assets/eiger500k/' except Exception: print('eiger500k not configured...') # Eiger 1M using fast trigger assembly eiger1m = EigerFastTrigger('XF:11IDB-ES{Det:Eig1M}', name='eiger1m') set_eiger_defaults(eiger1m) -eiger1m.file.write_path_template = '/nsls2/data/chx/assets/eiger1m/%Y/%m/%d/' -eiger1m.file.reg_root ='/nsls2/data/chx/assets/eiger1m/' +eiger1m.file.write_path_template = f'{proposal_dir}/assets/eiger1m/%Y/%m/%d/' +eiger1m.file.reg_root =f'{proposal_dir}/assets/eiger1m/' # Eiger 4M using fast trigger assembly eiger4m = EigerFastTrigger('XF:11IDB-ES{Det:Eig4M}', name='eiger4m') set_eiger_defaults(eiger4m) -eiger4m.file.write_path_template = '/nsls2/data/chx/assets/eiger4m/%Y/%m/%d/' -eiger4m.file.reg_root ='/nsls2/data/chx/assets/eiger4m/' +eiger4m.file.write_path_template = f'{proposal_dir}/assets/eiger4m/%Y/%m/%d/' +eiger4m.file.reg_root =f'{proposal_dir}/assets/eiger4m/' # setup manual eiger for 1d scans # prototype @@ -698,19 +698,19 @@ def enable_plugins(det, plugin_names): # (only one key name should be used) eiger4m_manual = EigerManualTrigger('XF:11IDB-ES{Det:Eig4M}', name='eiger4m_single') set_eiger_defaults(eiger4m_manual) -eiger4m_manual.file.write_path_template = '/nsls2/data/chx/assets/eiger4m/%Y/%m/%d/' -eiger4m_manual.file.reg_root ='/nsls2/data/chx/assets/eiger4m/' +eiger4m_manual.file.write_path_template = f'{proposal_dir}/assets/eiger4m/%Y/%m/%d/' +eiger4m_manual.file.reg_root =f'{proposal_dir}/assets/eiger4m/' eiger1m_manual = EigerManualTrigger('XF:11IDB-ES{Det:Eig1M}', name='eiger1m_single') set_eiger_defaults(eiger1m_manual) -eiger1m_manual.file.write_path_template = '/nsls2/data/chx/assets/eiger1m/%Y/%m/%d/' -eiger1m_manual.file.reg_root ='/nsls2/data/chx/assets/eiger1m/' +eiger1m_manual.file.write_path_template = f'{proposal_dir}/assets/eiger1m/%Y/%m/%d/' +eiger1m_manual.file.reg_root =f'{proposal_dir}/assets/eiger1m/' try: eiger500k_manual = EigerManualTrigger('XF:11IDB-ES{Det:Eig500K}', name='eiger500k_single') set_eiger_defaults(eiger500k_manual) - eiger500k_manual.file.write_path_template = '/nsls2/data/chx/assets/eiger500k/%Y/%m/%d/' - eiger500k_manual.file.reg_root ='/nsls2/data/chx/assets/eiger500k/' + eiger500k_manual.file.write_path_template = f'{proposal_dir}/assets/eiger500k/%Y/%m/%d/' + eiger500k_manual.file.reg_root =f'{proposal_dir}/assets/eiger500k/' except Exception: print('eiger500k not configured...') From 69f4b4349deda811fb9b9144dc9005aa90355100 Mon Sep 17 00:00:00 2001 From: Thomas Morris Date: Wed, 24 Jan 2024 13:46:30 -0500 Subject: [PATCH 2/2] revert paths for legacy --- startup/20-area-detectors.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/startup/20-area-detectors.py b/startup/20-area-detectors.py index 90028a5..2de6ec6 100644 --- a/startup/20-area-detectors.py +++ b/startup/20-area-detectors.py @@ -129,14 +129,14 @@ def hints(self): class StandardProsilicaWithTIFF(StandardProsilica): tiff = Cpt(TIFFPluginWithFileStore, suffix='TIFF1:', - write_path_template=f'{proposal_dir}/legacy/data/%Y/%m/%d/', - root=f'{proposal_dir}/legacy/data') + write_path_template='/nsls2/data/chx/legacy/data/%Y/%m/%d/', + root='/nsls2/data/chx/legacy/data') class StandardProsilicaWithTIFFV33(StandardProsilicaV33): tiff = Cpt(TIFFPluginWithFileStore, suffix='TIFF1:', - write_path_template=f'{proposal_dir}/legacy/data/%Y/%m/%d/', - root=f'{proposal_dir}/legacy/data') + write_path_template='/nsls2/data/chx/legacy/data/%Y/%m/%d/', + root='/nsls2/data/chx/legacy/data') #root='/XF11ID/data') class EigerSimulatedFilePlugin(Device, FileStoreBase): @@ -524,9 +524,9 @@ def counter_cb(value, timestamp, **kwargs): xray_eye4_writing = StandardProsilicaWithTIFFV33('XF:11IDB-BI{Cam:09}', name='xray_eye4') OAV_writing = StandardProsilicaWithTIFFV33('XF:11IDB-BI{Cam:10}', name='OAV') #OAV_writing = StandardProsilicaWithTIFFV33('XF:11ID-M3{Det-Cam:3}', name='OAV') # printer OAV using Grasshoper UBS3 camera -OAV_writing.tiff.write_path_template = f'{proposal_dir}/legacy/data/%Y/%m/%d/' -OAV_writing.tiff.read_path_template = f'{proposal_dir}/legacy/data/%Y/%m/%d/' -OAV_writing.tiff.reg_root = f'{proposal_dir}/legacy/data/' +OAV_writing.tiff.write_path_template = '/nsls2/data/chx/legacy/data/%Y/%m/%d/' +OAV_writing.tiff.read_path_template = '/nsls2/data/chx/legacy/data/%Y/%m/%d/' +OAV_writing.tiff.reg_root = '/nsls2/data/chx/legacy/data/' BCam_writing = StandardProsilicaWithTIFFV33('XF:11IDB-ES{BFLY-Cam:1}', name='BCam')