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

Merge branch 'fix-bam-new-bp-table' into 'master'

get_bam(): allows for varying bunch pattern table length

Closes #80

See merge request !279
parents da62f6b9 8617a3ce
No related branches found
No related tags found
1 merge request!279get_bam(): allows for varying bunch pattern table length
Pipeline #118542 passed
...@@ -7,6 +7,7 @@ unreleased ...@@ -7,6 +7,7 @@ unreleased
- **Bug fixes** - **Bug fixes**
- fix :issue:`75` regarding pulse Id assignment when reading BAM data :mr:`272` - fix :issue:`75` regarding pulse Id assignment when reading BAM data :mr:`272`
- fix :issue:`80` regarding new bunch pattern table size when reading BAM data :mr:`279`
- **Improvements** - **Improvements**
......
...@@ -59,9 +59,8 @@ def get_bam(run, mnemonics=None, merge_with=None, bunchPattern='sase3', ...@@ -59,9 +59,8 @@ def get_bam(run, mnemonics=None, merge_with=None, bunchPattern='sase3',
Example Example
------- -------
>>> import toolbox_scs as tb >>> import toolbox_scs as tb
>>> run, ds = tb.load(2711, 303, 'BAM1932S') >>> run = tb.open_run(2711, 303)
>>> ds['BAM1932S'] >>> bam = tb.get_bam(run, 'BAM1932S')
""" """
bam_mnemos = ['BAM4', 'BAM1'] bam_mnemos = ['BAM4', 'BAM1']
m2 = [] m2 = []
...@@ -102,10 +101,12 @@ def get_bam(run, mnemonics=None, merge_with=None, bunchPattern='sase3', ...@@ -102,10 +101,12 @@ def get_bam(run, mnemonics=None, merge_with=None, bunchPattern='sase3',
da_bam = merge_with[m] da_bam = merge_with[m]
else: else:
da_bam = get_array(run, m) da_bam = get_array(run, m)
da_bam = da_bam.sel(BAMbunchId=slice(0, 5400, 2)) da_bam = da_bam.sel(BAMbunchId=slice(0, None, 2))
# align the pulse Id # align the pulse Id
if bpt is not None: if bpt is not None:
da_bam = da_bam.assign_coords(BAMbunchId=np.arange(0, 2700)) n = mask.sizes[dim_names[bunchPattern]]
da_bam = da_bam.isel(BAMbunchId=slice(0, n))
da_bam = da_bam.assign_coords(BAMbunchId=np.arange(0, n))
da_bam = da_bam.rename(BAMbunchId=dim_names[bunchPattern]) da_bam = da_bam.rename(BAMbunchId=dim_names[bunchPattern])
da_bam = da_bam.where(mask, drop=True) da_bam = da_bam.where(mask, drop=True)
if run_mnemonics[m]['key'] != 'data.lowChargeArrivalTime': if run_mnemonics[m]['key'] != 'data.lowChargeArrivalTime':
......
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