Skip to content
Snippets Groups Projects
Commit 0780cbfc authored by Laurent Mercadier's avatar Laurent Mercadier
Browse files

Simplifies load() input parameters

parent 38936026
No related branches found
No related tags found
1 merge request!47Open data
...@@ -364,9 +364,8 @@ mnemonics = { ...@@ -364,9 +364,8 @@ mnemonics = {
'dim': ['gott_pId','pixelId']} 'dim': ['gott_pId','pixelId']}
} }
def load(fields, runNB, proposalNB, semesterNB=None, topic='SCS', useRaw=True, display=False, def load(fields, runNB, proposalNB, subFolder='raw', display=False, validate=False,
validate=False, runpath='/gpfs/exfel/exp/{}/{}/{}/raw/r{:04d}/', subset=by_index[:], rois={}):
subset=by_index[:], rois={}):
""" Load a run and extract the data. Output is an xarray with aligned trainIds """ Load a run and extract the data. Output is an xarray with aligned trainIds
Inputs: Inputs:
...@@ -375,15 +374,10 @@ def load(fields, runNB, proposalNB, semesterNB=None, topic='SCS', useRaw=True, d ...@@ -375,15 +374,10 @@ def load(fields, runNB, proposalNB, semesterNB=None, topic='SCS', useRaw=True, d
{"extra": {'SCS_CDIFFT_MAG/SUPPLY/CURRENT', 'actual_current.value', None}} {"extra": {'SCS_CDIFFT_MAG/SUPPLY/CURRENT', 'actual_current.value', None}}
runNB: (str, int) run number as integer runNB: (str, int) run number as integer
proposalNB: (str, int) of the proposal number e.g. 'p002252' or 2252 proposalNB: (str, int) of the proposal number e.g. 'p002252' or 2252
semesterNB: (str, int) optional, depricated. The semester number where the proposal subFolder: (str) sub-folder from which to load the data. Use 'raw' for raw
data are saved. Depricated since karabo_data version 0.5 data or 'proc' for processed data.
topic: string of the topic. display: (bool) whether to show the run.info or not
useRaw: (bool) if True, access data from 'raw' folder of the run, otherwise validate: (bool) whether to run karabo-data-validate or not
from 'proc' folder (for processed data)
display: boolean, whether to show the run.info or not
validate: boolean, whether to run karabo-data-validate or not
runpath: a string to fromat the run folder path with topic,
semesterNB, proposalNB and runNB
subset: a subset of train that can be load with by_index[:5] for the subset: a subset of train that can be load with by_index[:5] for the
first 5 trains first 5 trains
rois: a dictionnary of mnemonics with a list of rois definition and the desired rois: a dictionnary of mnemonics with a list of rois definition and the desired
...@@ -399,8 +393,7 @@ def load(fields, runNB, proposalNB, semesterNB=None, topic='SCS', useRaw=True, d ...@@ -399,8 +393,7 @@ def load(fields, runNB, proposalNB, semesterNB=None, topic='SCS', useRaw=True, d
runNB = 'r{:04d}'.format(runNB) runNB = 'r{:04d}'.format(runNB)
if isinstance(proposalNB,int): if isinstance(proposalNB,int):
proposalNB = 'p{:06d}'.format(proposalNB) proposalNB = 'p{:06d}'.format(proposalNB)
dataSubFolder = 'raw' if useRaw else 'proc' runFolder = os.path.join(find_proposal(proposalNB), subFolder, runNB)
runFolder = os.path.join(find_proposal(proposalNB), dataSubFolder, runNB)
run = RunDirectory(runFolder).select_trains(subset) run = RunDirectory(runFolder).select_trains(subset)
if validate: if validate:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment