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
ca508756
Commit
ca508756
authored
5 years ago
by
Laurent Mercadier
Browse files
Options
Downloads
Patches
Plain Diff
Copied relevant masks, no need to load euxfel_bunch_pattern package
parent
e03ba9c7
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Load.py
+13
-7
13 additions, 7 deletions
Load.py
with
13 additions
and
7 deletions
Load.py
+
13
−
7
View file @
ca508756
...
...
@@ -10,7 +10,6 @@ from karabo_data import by_index, RunDirectory
from
karabo_data.read_machinery
import
find_proposal
import
xarray
as
xr
import
os
import
euxfel_bunch_pattern
as
bp
mnemonics
=
{
# Machine
...
...
@@ -377,8 +376,10 @@ mnemonics = {
}
def
extractSaseBunchPattern
(
runDir
,
sase
=
3
):
'''
generate the
"
saseX
"
and
"
npulse_saseX
"
arrays directly from the bunch pattern table and not using the
MDL device BUNCH_DECODER.
'''
generate the
"
saseX
"
and
"
npulse_saseX
"
arrays directly from the bunch pattern
table and not using the MDL device BUNCH_DECODER. This is inspired from the
euxfel_bunch_pattern project,
https://git.xfel.eu/gitlab/karaboDevices/euxfel_bunch_pattern.git
Inputs:
runDir: run directory obtained by karabo_data.runDirectory()
sase: int, sase number between 1 and 3
...
...
@@ -390,18 +391,23 @@ def extractSaseBunchPattern(runDir, sase=3):
'''
if
not
(
1
<=
sase
<=
3
):
raise
ValueError
(
"
Invalid SASE value {!r}, expected 1-3
"
)
# define relevant masks, see euxfel_bunch_pattern project for details
DESTINATION_MASK
=
0xf
<<
18
DESTINATION_T4D
=
4
<<
18
# SASE1/3 dump
DESTINATION_T5D
=
2
<<
18
# SASE2 dump
PHOTON_LINE_DEFLECTION
=
1
<<
27
# Soft kick (e.g. SA3)
bp_mnemo
=
mnemonics
[
'
bunchPatternTable
'
]
bp_table
=
runDir
.
get_array
(
bp_mnemo
[
'
source
'
],
bp_mnemo
[
'
key
'
],
extra_dims
=
bp_mnemo
[
'
dim
'
])
destination
=
bp
.
DESTINATION_T5D
if
(
sase
==
2
)
else
bp
.
DESTINATION_T4D
matched
=
(
bp_table
&
bp
.
DESTINATION_MASK
)
==
destination
destination
=
DESTINATION_T5D
if
(
sase
==
2
)
else
DESTINATION_T4D
matched
=
(
bp_table
&
DESTINATION_MASK
)
==
destination
if
sase
==
1
:
# Pulses to SASE 1 when soft kick is off
matched
&=
(
bp_table
&
bp
.
PHOTON_LINE_DEFLECTION
)
==
0
matched
&=
(
bp_table
&
PHOTON_LINE_DEFLECTION
)
==
0
elif
sase
==
3
:
# Pulses to SASE 3 when soft kick is on
matched
&=
(
bp_table
&
bp
.
PHOTON_LINE_DEFLECTION
)
!=
0
matched
&=
(
bp_table
&
PHOTON_LINE_DEFLECTION
)
!=
0
nz
=
np
.
nonzero
(
matched
.
values
)
dim_pId
=
matched
.
shape
[
1
]
...
...
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