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

Rename BAM array dimnension to match XGM, TIM...

parent 91499d8d
No related branches found
No related tags found
No related merge requests found
......@@ -187,7 +187,8 @@ def sortBAMdata(data, key='sase3'):
corresponds to FLASH busrt length of 800 us @ 9 MHz. The bunchPatternTable
only has 2700 values, corresponding to XFEL 600 us burst length @ 4.5 MHz.
Hence, we truncate the BAM arrays to 5400 with a stride of 2 and match them
to the bunchPatternTable.
to the bunchPatternTable. If key is one of the sase, the given dimension name
of the bam arrays is 'sa[sase number]_pId', to match other data (XGM, TIM...).
Inputs:
data: xarray Dataset containing BAM arrays
key: str, ['sase1', 'sase2', 'sase3', 'scs_ppl']
......@@ -200,11 +201,14 @@ def sortBAMdata(data, key='sase3'):
ndata = data
dropList = []
mergeList = []
for key in data:
if 'BAM' in key:
dropList.append(key)
bam = data[key].isel(BAMbunchId=slice(0,5400,2))
for k in data:
if 'BAM' in k:
dropList.append(k)
bam = data[k].isel(BAMbunchId=slice(0,5400,2))
bam = bam.where(mask, drop=True)
if 'sase' in key:
name = f'sa{key[4]}_pId'
bam = bam.rename({'BAMbunchId':name})
mergeList.append(bam)
mergeList.append(data.drop(dropList))
ndata = xr.merge(mergeList, join='inner')
......
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