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
5f85ed01
Commit
5f85ed01
authored
5 years ago
by
Laurent Mercadier
Browse files
Options
Downloads
Patches
Plain Diff
Simplified getTIMapd() for case with no change of number of pulses
parent
53021a06
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
xgm.py
+26
-1
26 additions, 1 deletion
xgm.py
with
26 additions
and
1 deletion
xgm.py
+
26
−
1
View file @
5f85ed01
...
...
@@ -518,7 +518,7 @@ def mcpPeaks(data, intstart, intstop, bkgstart, bkgstop, mcp=1, t_offset=None, n
pattern and determine the t_offset assuming mininum pulse
separation of 220 ns and digitizer resolution of 2 GHz.
npulses: number of pulses. If None, takes the maximum number of
pulses according to the bunch patter (field
'
npulses_sase3
'
)
pulses according to the bunch patter
n
(field
'
npulses_sase3
'
)
Output:
results: DataArray with dims trainId x max(sase3 pulses)
...
...
@@ -592,7 +592,32 @@ def getTIMapd(data, mcp=1, use_apd=True, intstart=None, intstop=None,
t_offset
=
t_offset
,
npulses
=
npulses
)
return
tim
#1. case where number of SASE 3 pulses were not changed during the run:
sa3
=
data
[
'
sase3
'
].
where
(
data
[
'
sase3
'
]
>
1
,
drop
=
True
)
sa3
-=
sa3
[
0
,
0
]
idx
=
np
.
unique
(
sa3
,
axis
=
0
)
npulses_sa3
=
data
[
'
npulses_sase3
'
]
maxpulses
=
int
(
npulses_sa3
.
max
().
values
)
if
npulses
is
not
None
:
maxpulses
=
np
.
min
([
npulses
,
maxpulses
])
if
len
(
idx
)
==
1
:
if
use_apd
:
apd
=
data
[
'
MCP{}apd
'
.
format
(
mcp
)]
initialDelay
=
data
.
attrs
[
'
run
'
].
get_array
(
'
SCS_UTC1_ADQ/ADC/1
'
,
'
board1.apd.channel_0.initialDelay.value
'
)[
0
].
values
upperLimit
=
data
.
attrs
[
'
run
'
].
get_array
(
'
SCS_UTC1_ADQ/ADC/1
'
,
'
board1.apd.channel_0.upperLimit.value
'
)[
0
].
values
period
=
upperLimit
-
initialDelay
#period of the apd in number of digitizer samples
idx
/=
int
(
period
/
440
)
#440 samples correspond to the separation between two pulses at 4.5 MHz
if
len
(
idx
)
==
1
:
idx
=
idx
[
0
].
astype
(
int
)
tim
=
apd
.
isel
(
apdId
=
idx
)
return
tim
else
:
apd
=
mcpPeaks
(
data
,
intstart
,
intstop
,
bkgstart
,
bkgstop
,
mcp
=
mcp
,
t_offset
=
t_offset
,
npulses
=
maxpulses
)
#2. case where the number of SASE 3 pulses varied during the run:
npulses_sa3
=
data
[
'
npulses_sase3
'
]
maxpulses
=
int
(
npulses_sa3
.
max
().
values
)
if
npulses
is
not
None
:
...
...
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