From 961f2b61670e801fb0b7906429f5053e77720e3f Mon Sep 17 00:00:00 2001 From: Philipp Schmidt <philipp.schmidt@xfel.eu> Date: Mon, 14 Aug 2023 08:49:51 +0200 Subject: [PATCH] Add optional flag to require PPU trigger if configured --- .../AGIPD/AGIPD_Correct_and_Verify.ipynb | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb b/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb index 5d2818765..e731d46f6 100644 --- a/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb +++ b/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb @@ -88,6 +88,7 @@ "# Optional auxiliary devices\n", "use_ppu_device = '' # Device ID for a pulse picker device to only process picked trains, empty string to disable\n", "ppu_train_offset = 0 # When using the pulse picker, offset between the PPU's sequence start and actually picked train\n", + "require_ppu_trigger = False # Optional protection against running without PPU or without triggering trains.\n", "\n", "use_litframe_finder = 'off' # Process only illuminated frames: 'off' - disable, 'device' - use online device data, 'offline' - use offline algorithm, 'auto' - choose online/offline source automatically (default)\n", "litframe_device_id = '' # Device ID for a lit frame finder device, empty string to auto detection\n", @@ -321,23 +322,31 @@ "\n", " if train_ids:\n", " print(f'PPU device {use_ppu_device} triggered for {len(train_ids)} train(s)')\n", + " elif require_ppu_trigger:\n", + " raise RuntimeError(f'PPU device {use_ppu_device} not triggered but required, aborting!')\n", " else:\n", " print(f'PPU device {use_ppu_device} not triggered, processing all valid trains')\n", " train_ids = None\n", + " \n", + "elif use_ppu_device:\n", + " # PPU configured but not present.\n", + " \n", + " if require_ppu_trigger:\n", + " raise RuntimeError(f'PPU device {use_ppu_device} required but not found, aborting!')\n", + " else:\n", + " print(f'PPU device {use_ppu_device} configured but not found, processing all valid trains')\n", + " train_ids = None\n", "\n", "elif train_ids != [-1]:\n", " # Specific trains passed by parameter, convert to ndarray.\n", " train_ids = np.array(train_ids)\n", " \n", " print(f'Processing up to {len(train_ids)} manually selected train(s)')\n", + "\n", "else:\n", - " # Process all trains.\n", - " train_ids = None\n", - " \n", - " if use_ppu_device:\n", - " print(f'PPU device {use_ppu_device} configured but not found, processing all valid trains')\n", - " else:\n", - " print(f'Processing all valid trains')" + " # No PPU configured.\n", + " print(f'Processing all valid trains')\n", + " train_ids = None" ] }, { -- GitLab