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
b4fc0138
Commit
b4fc0138
authored
6 years ago
by
Laurent Mercadier
Browse files
Options
Downloads
Patches
Plain Diff
Fixes mcpPeaks by calculating the t_offset from the 'sase3' bunchpattern
parent
d3e656b3
No related branches found
No related tags found
1 merge request
!11
Tim calibration table
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
xgm.py
+8
-5
8 additions, 5 deletions
xgm.py
with
8 additions
and
5 deletions
xgm.py
+
8
−
5
View file @
b4fc0138
...
...
@@ -341,7 +341,7 @@ def calibrateXGMs(data, rollingWindow=200, plot=False):
return
np
.
array
([
sa3_calib_factor
,
scs_calib_factor
])
def
mcpPeaks
(
data
,
intstart
,
intstop
,
bkgstart
,
bkgstop
,
t_offset
=
1760
,
mcp
=
1
,
npulses
=
None
):
def
mcpPeaks
(
data
,
intstart
,
intstop
,
bkgstart
,
bkgstop
,
mcp
=
1
,
t_offset
=
None
,
npulses
=
None
):
'''
Computes peak integration from raw MCP traces.
Inputs:
...
...
@@ -350,8 +350,8 @@ def mcpPeaks(data, intstart, intstop, bkgstart, bkgstop, t_offset=1760, mcp=1, n
intstop: trace index of integration stop
bkgstart: trace index of background start
bkgstop: trace index of background stop
t_offset: index separation between two pulses
mcp: MCP channel number
t_offset: index separation between two pulses
npulses: number of pulses
Output:
...
...
@@ -361,10 +361,13 @@ def mcpPeaks(data, intstart, intstop, bkgstart, bkgstop, t_offset=1760, mcp=1, n
keyraw
=
'
MCP{}raw
'
.
format
(
mcp
)
if
keyraw
not
in
data
:
raise
ValueError
(
"
Source not found: {}!
"
.
format
(
keyraw
))
sa3
=
data
[
'
sase3
'
].
where
(
data
[
'
sase3
'
]
>
1
)
step
=
sa3
.
where
(
data
[
'
npulses_sase3
'
]
>
0
,
drop
=
True
)[
0
,:
2
].
values
step
=
int
(
step
[
1
]
-
step
[
0
])
if
t_offset
is
None
:
t_offset
=
440
*
step
if
npulses
is
None
:
npulses
=
int
((
data
[
'
sase3
'
].
max
().
values
+
1
)
/
4
)
sa3
=
data
[
'
sase3
'
].
where
(
data
[
'
sase3
'
]
>
1
)
/
4
sa3
-=
sa3
[:,
0
]
npulses
=
int
((
sa3
.
max
().
values
-
sa3
.
min
().
values
+
step
)
/
step
)
results
=
xr
.
DataArray
(
np
.
empty
((
sa3
.
shape
[
0
],
npulses
)),
coords
=
sa3
.
coords
,
dims
=
[
'
trainId
'
,
'
MCP{}fromRaw
'
.
format
(
mcp
)])
for
i
in
range
(
npulses
):
...
...
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