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
75eb0bca
Commit
75eb0bca
authored
3 years ago
by
Laurent Mercadier
Browse files
Options
Downloads
Patches
Plain Diff
Add digitizer_type() function
parent
939d32b9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!112
Fastadc new mnemonics
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/toolbox_scs/detectors/digitizers.py
+27
-8
27 additions, 8 deletions
src/toolbox_scs/detectors/digitizers.py
src/toolbox_scs/mnemonics_machinery.py
+3
-2
3 additions, 2 deletions
src/toolbox_scs/mnemonics_machinery.py
with
30 additions
and
10 deletions
src/toolbox_scs/detectors/digitizers.py
+
27
−
8
View file @
75eb0bca
...
...
@@ -271,6 +271,7 @@ def get_peaks(run,
# 2. Use raw data from digitizer
# minimum pulse period @ 4.5MHz, according to digitizer type
digitizer
=
digitizer_type
(
source
=
source
)
min_distance
=
1
if
digitizer
==
'
FastADC
'
:
min_distance
=
24
...
...
@@ -346,8 +347,8 @@ def get_peaks(run,
extra_dim
)
peaks
=
peaks
.
where
(
mask_on
,
drop
=
True
)
return
peaks
.
assign_coords
({
extra_dim
:
pid
})
def
channel_peak_params
(
run
,
source
,
key
=
None
,
channel
=
None
,
board
=
None
):
"""
Extract peak-integration parameters used by a channel of the digitizer.
...
...
@@ -410,7 +411,7 @@ def fastADC_channel_peak_params(run, source, channel=None):
'
baseLength
'
:
(
'
baselineSettings.length.value
'
,),
'
enable
'
:
(
'
enablePeakComputation.value
'
,),
'
pulseStart
'
:
(
'
initialDelay.value
'
,),
'
pulseLength
'
:
(
'
peakSamples.value
'
,),
'
pulseLength
'
:
(
'
peakSamples.value
'
,),
'
npulses
'
:
(
'
numPulses.value
'
,),
'
period
'
:
(
'
pulsePeriod.value
'
,)
}
...
...
@@ -470,14 +471,12 @@ def adq412_channel_peak_params(run, source, key=None,
board
=
k
[
1
]
baseName
=
f
'
board
{
board
}
.apd.channel_
{
channel
}
.
'
source
=
source
.
split
(
'
:
'
)[
0
]
adq412_keys
=
{
'
baseStart
'
:
(
baseName
+
'
baseStart.value
'
,),
'
baseStop
'
:
(
baseName
+
'
baseStop.value
'
,),
'
enable
'
:
(
baseName
+
'
enable.value
'
,),
'
pulseStart
'
:
(
baseName
+
'
pulseStart.value
'
,),
'
pulseStop
'
:
(
baseName
+
'
pulseStop.value
'
,),
'
npulses
'
:
(
baseName
+
'
numPulses.value
'
,),
'
pulseStop
'
:
(
baseName
+
'
pulseStop.value
'
,),
'
initialDelay
'
:
(
baseName
+
'
initialDelay.value
'
,),
'
upperLimit
'
:
(
baseName
+
'
upperLimit.value
'
,),
'
npulses
'
:
(
f
'
board
{
board
}
.apd.numberOfPulses.value
'
,)
...
...
@@ -581,7 +580,8 @@ def get_peak_params(run, mnemonic, raw_trace=None, ntrains=200):
title
=
'
Digitizer peak params
'
else
:
mnemo_raw
=
mnemonic
min_distance
=
24
if
"
FastADC
"
in
mnemonic
else
440
digitizer
=
digitizer_type
(
mnemonic
,
run_mnemonics
)
min_distance
=
24
if
digitizer
==
"
FastADC
"
else
440
title
=
'
Auto-find peak params
'
if
raw_trace
is
None
:
sel
=
run
.
select_trains
(
np
.
s_
[:
ntrains
])
...
...
@@ -647,7 +647,8 @@ def check_peak_params(run, mnemonic, raw_trace=None, ntrains=200, params=None,
log
.
warning
(
'
The digitizer did not record peak-integrated data.
'
)
if
not
plot
:
return
params
min_distance
=
24
if
"
FastADC
"
in
mnemonic
else
440
digitizer
=
digitizer_type
(
mnemonic
,
run_mnemonics
)
min_distance
=
24
if
digitizer
==
"
FastADC
"
else
440
if
'
bunchPatternTable
'
in
run_mnemonics
and
bunchPattern
!=
'
None
'
:
sel
=
run
.
select_trains
(
np
.
s_
[:
ntrains
])
bp_params
=
{}
...
...
@@ -747,6 +748,24 @@ def plotPeakIntegrationWindow(raw_trace, params, bp_params, show_all=False):
return
fig
,
ax
def
digitizer_type
(
mnemonic
=
None
,
mnemo_dict
=
None
,
source
=
None
):
if
mnemonic
is
not
None
:
source
=
mnemo_dict
[
mnemonic
][
'
source
'
]
if
'
:channel
'
in
source
:
return
'
FastADC
'
if
'
:network
'
in
source
:
return
'
ADQ412
'
dic
=
{
'
XTD10_MCP
'
:
'
FastADC
'
,
'
FastADC
'
:
'
FastADC
'
,
'
PES
'
:
'
ADQ412
'
,
'
MCP
'
:
'
ADQ412
'
}
for
k
,
v
in
dic
.
items
():
if
k
in
mnemonic
:
return
v
log
.
warning
(
f
'
Could not find digitizer type from mnemonic
{
mnemonic
}
.
'
)
return
'
ADQ412
'
def
get_tim_peaks
(
run
,
mnemonics
=
None
,
merge_with
=
None
,
bunchPattern
=
'
sase3
'
,
integParams
=
None
,
keepAllSase
=
False
):
...
...
This diff is collapsed.
Click to expand it.
src/toolbox_scs/mnemonics_machinery.py
+
3
−
2
View file @
75eb0bca
...
...
@@ -83,7 +83,7 @@ def mnemonics_to_process(mnemo_list, merge_with, detector, func=None):
merge_with: xarray Dataset
Dataset that may contain non-processed arrays
detector: str
One in {
'
ADQ412
'
,
'
FastADC
'
,
'
XGM
'
,
'
BAM
'
}
One in {
'
ADQ412
'
,
'
FastADC
'
,
'
XGM
'
,
'
BAM
'
,
'
PES
'
}
func: function
function that takes one argument, an unprocessed mnemonic string,
and converts it into a processed one, i.e. from
'
MCP2apd
'
to
...
...
@@ -110,7 +110,8 @@ def mnemonics_to_process(mnemo_list, merge_with, detector, func=None):
default_mnemo
=
'
SCS_SA3
'
default_processed
=
'
SCS_SA3
'
if
detector
==
'
ADQ412
'
:
det_mnemos
=
[
m
for
m
in
_mnemonics
if
'
MCP
'
in
m
]
det_mnemos
=
[
m
for
m
in
_mnemonics
if
'
MCP
'
in
m
and
'
XTD10_
'
not
in
m
]
default_mnemo
=
'
MCP2apd
'
default_processed
=
'
MCP2peaks
'
if
detector
==
'
FastADC
'
:
...
...
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