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
Thomas Kluyver
ToolBox
Commits
aa264a14
Commit
aa264a14
authored
5 years ago
by
Laurent Mercadier
Browse files
Options
Downloads
Patches
Plain Diff
added function to match XGM and TIM pulse Id
parent
fcd1612e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
xgm.py
+42
-1
42 additions, 1 deletion
xgm.py
with
42 additions
and
1 deletion
xgm.py
+
42
−
1
View file @
aa264a14
...
@@ -395,6 +395,7 @@ def getTIMapd(data, mcp=1, use_apd=True, intstart=None, intstop=None,
...
@@ -395,6 +395,7 @@ def getTIMapd(data, mcp=1, use_apd=True, intstart=None, intstop=None,
The missing values, in case of change of number of pulses, are filled
The missing values, in case of change of number of pulses, are filled
with NaNs.
with NaNs.
Inputs:
data: xarray Dataset containing MCP raw traces (e.g.
'
MCP1raw
'
)
data: xarray Dataset containing MCP raw traces (e.g.
'
MCP1raw
'
)
intstart: trace index of integration start
intstart: trace index of integration start
intstop: trace index of integration stop
intstop: trace index of integration stop
...
@@ -721,4 +722,44 @@ def checkTimApdWindow(data, mcp=1, use_apd=True, intstart=None, intstop=None):
...
@@ -721,4 +722,44 @@ def checkTimApdWindow(data, mcp=1, use_apd=True, intstart=None, intstop=None):
ax2
.
legend
(
lines
+
lines2
,
labels
+
labels2
,
loc
=
0
)
ax2
.
legend
(
lines
+
lines2
,
labels
+
labels2
,
loc
=
0
)
else
:
else
:
ax
.
legend
(
loc
=
'
lower left
'
)
ax
.
legend
(
loc
=
'
lower left
'
)
plt
.
tight_layout
()
plt
.
tight_layout
()
\ No newline at end of file
def
matchXgmTimPulseId
(
data
,
use_apd
=
True
,
intstart
=
None
,
intstop
=
None
,
bkgstart
=
None
,
bkgstop
=
None
,
t_offset
=
None
,
npulses
=
None
):
'''
Function to match XGM pulse Id with TIM pulse Id.
Inputs:
data: xarray Dataset containing XGM and TIM data
use_apd: bool. If True, uses the digitizer APD (
'
MCP[1,2,3,4]apd
'
).
If False, peak integration is performed from raw traces.
All following parameters are needed in this case.
intstart: trace index of integration start
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
npulses: number of pulses to compute
Output:
xr DataSet containing XGM and TIM signals with the share
dimension
'
pId
'
. Raw traces, raw XGM and raw APD are dropped.
'''
res
=
tb
.
selectSASEinXGM
(
data
,
xgm
=
'
SCS_XGM
'
).
rename
({
'
XGMbunchId
'
:
'
pId
'
})
res2
=
tb
.
selectSASEinXGM
(
data
,
xgm
=
'
SA3_XGM
'
).
rename
({
'
XGMbunchId
'
:
'
pId
'
})
dropList
=
[
'
SCS_XGM
'
,
'
SA3_XGM
'
]
mergeList
=
[
res
,
res2
]
for
mcp
in
range
(
1
,
5
):
if
'
MCP{}apd
'
.
format
(
mcp
)
in
data
or
'
MCP{}raw
'
.
format
(
mcp
)
in
data
:
MCPapd
=
tb
.
getTIMapd
(
data
,
mcp
=
mcp
,
use_apd
=
use_apd
,
intstart
=
intstart
,
intstop
=
intstop
,
bkgstart
=
bkgstart
,
bkgstop
=
bkgstop
,
t_offset
=
t_offset
,
npulses
=
npulses
).
rename
(
'
MCP{}apd
'
.
format
(
mcp
))
if
use_apd
:
MCPapd
=
MCPapd
.
rename
({
'
apdId
'
:
'
pId
'
})
else
:
MCPapd
=
MCPapd
.
rename
({
'
MCP{}fromRaw
'
.
format
(
mcp
):
'
pId
'
})
dropList
.
append
(
'
MCP{}raw
'
.
format
(
mcp
))
mergeList
.
append
(
MCPapd
)
dropList
.
append
(
'
MCP{}apd
'
.
format
(
mcp
))
mergeList
.
append
(
data
.
drop
(
dropList
))
subset
=
xr
.
merge
(
mergeList
,
join
=
'
inner
'
)
return
subset
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