Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
ToolBox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SCS
ToolBox
Commits
a66a627b
Commit
a66a627b
authored
1 year ago
by
Laurent Mercadier
Browse files
Options
Downloads
Patches
Plain Diff
fix: assign pId coords when extracting BAM
parent
a7db1a8d
No related branches found
No related tags found
1 merge request
!272
fix: assign pId coords when extracting BAM
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
doc/changelog.rst
+1
-0
1 addition, 0 deletions
doc/changelog.rst
src/toolbox_scs/detectors/bam_detectors.py
+6
-12
6 additions, 12 deletions
src/toolbox_scs/detectors/bam_detectors.py
with
7 additions
and
12 deletions
doc/changelog.rst
+
1
−
0
View file @
a66a627b
...
...
@@ -6,6 +6,7 @@ unreleased
- **Bug fixes**
- fix :issue:`75` regarding pulse Id assignment when reading BAM data :mr:`272`
- **Improvements**
...
...
This diff is collapsed.
Click to expand it.
src/toolbox_scs/detectors/bam_detectors.py
+
6
−
12
View file @
a66a627b
...
...
@@ -89,13 +89,13 @@ def get_bam(run, mnemonics=None, merge_with=None, bunchPattern='sase3',
else
:
ds_mw
=
xr
.
Dataset
()
dim_names
=
{
'
sase3
'
:
'
sa3_pId
'
,
'
sase1
'
:
'
sa1_pId
'
,
'
scs_ppl
'
:
'
ol_pId
'
}
bpt
=
load_bpt
(
run
,
ds_mw
)
if
bpt
is
not
None
:
mask
=
is_pulse_at
(
bpt
,
bunchPattern
)
pattern_changed
=
~
(
mask
=
=
mask
[
0
]).
all
().
values
mask
=
mask
.
rename
({
'
pulse_slot
'
:
dim_names
[
bunchPattern
]})
ds
=
xr
.
Dataset
()
dim_names
=
{
'
sase3
'
:
'
sa3_pId
'
,
'
sase1
'
:
'
sa1_pId
'
,
'
scs_ppl
'
:
'
ol_pId
'
}
run_mnemonics
=
mnemonics_for_run
(
run
)
for
m
in
mnemonics
:
if
merge_with
is
not
None
and
m
in
merge_with
:
...
...
@@ -105,15 +105,9 @@ def get_bam(run, mnemonics=None, merge_with=None, bunchPattern='sase3',
da_bam
=
da_bam
.
sel
(
BAMbunchId
=
slice
(
0
,
5400
,
2
))
# align the pulse Id
if
bpt
is
not
None
:
if
not
pattern_changed
:
pulseIds
=
np
.
nonzero
(
mask
[
0
].
values
)[
0
]
da_bam
=
da_bam
.
isel
(
BAMbunchId
=
pulseIds
)
da_bam
=
da_bam
.
assign_coords
(
BAMbunchId
=
pulseIds
)
da_bam
=
da_bam
.
rename
(
BAMbunchId
=
dim_names
[
bunchPattern
])
else
:
mask
=
mask
.
rename
({
'
pulse_slot
'
:
dim_names
[
bunchPattern
]})
da_bam
=
da_bam
.
rename
(
BAMbunchId
=
dim_names
[
bunchPattern
])
da_bam
=
da_bam
.
where
(
mask
,
drop
=
True
)
da_bam
=
da_bam
.
assign_coords
(
BAMbunchId
=
np
.
arange
(
0
,
2700
))
da_bam
=
da_bam
.
rename
(
BAMbunchId
=
dim_names
[
bunchPattern
])
da_bam
=
da_bam
.
where
(
mask
,
drop
=
True
)
if
run_mnemonics
[
m
][
'
key
'
]
!=
'
data.lowChargeArrivalTime
'
:
da_bam
*=
1e-3
ds
=
ds
.
merge
(
da_bam
,
join
=
'
inner
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment