Unarchived Data Fix

SwissFEL scan descriptions are JSON files containing references to absolut paths:

$ cat /sf/instrument/data/p12345/raw/run0123-ImportantData/meta/scan.json 
{
    "scan_files": [
        [
            "/sf/instrument/data/p12345/raw/run0123-ImportantData/data/acq0001.PVDATA.h5",
            "/sf/instrument/data/p12345/raw/run0123-ImportantData/data/acq0001.BSDATA.h5",
            "/sf/instrument/data/p12345/raw/run0123-ImportantData/data/acq0001.CAMERAS.h5"
        ],
...

Unarchived data arrives in /sf/instrument/data/p12345/work/retrieve/, and the paths in the JSON files need to be updated accordingly:

$ cat /sf/instrument/data/p12345/work/retrieve/sf/instrument/data/p12345/raw/run0123-ImportantData/meta/scan_mod.json 
{
    "scan_files": [
        [
            "/sf/instrument/data/p12345/work/retrieve/sf/instrument/data/p12345/raw/run0123-ImportantData/data/acq0001.PVDATA.h5",
            "/sf/instrument/data/p12345/work/retrieve/sf/instrument/data/p12345/raw/run0123-ImportantData/data/acq0001.BSDATA.h5",
            "/sf/instrument/data/p12345/work/retrieve/sf/instrument/data/p12345/raw/run0123-ImportantData/data/acq0001.CAMERAS.h5"
        ],
...

unarchived_data_fix automates this update:

usage: unarchived_data_fix.py [-h] [--no-dryrun] [--inplace] [--overwrite]
                              {alvra,bernina,cristallina,diavolezza,maloja,furka}
                              pgroup

positional arguments:
  {alvra,bernina,cristallina,diavolezza,maloja,furka}
  pgroup

optional arguments:
  -h, --help            show this help message and exit
  --no-dryrun
  --inplace
  --overwrite
S
Description
Fix paths in unarchived data
Readme 32 KiB
Languages
Python 100%