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
aa19e723
Commit
aa19e723
authored
5 years ago
by
Laurent Mercadier
Browse files
Options
Downloads
Patches
Plain Diff
raise TypeError if npulses missing when no pulse pattern info is available
parent
0ae0897c
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
+15
-9
15 additions, 9 deletions
xgm.py
with
15 additions
and
9 deletions
xgm.py
+
15
−
9
View file @
aa19e723
...
@@ -126,7 +126,7 @@ def selectSASEinXGM(data, sase='sase3', xgm='SCS_XGM', sase3First=True, npulses=
...
@@ -126,7 +126,7 @@ def selectSASEinXGM(data, sase='sase3', xgm='SCS_XGM', sase3First=True, npulses=
sase: key of sase to select: {
'
sase1
'
,
'
sase3
'
}
sase: key of sase to select: {
'
sase1
'
,
'
sase3
'
}
xgm: key of xgm to select: {
'
SA3_XGM
'
,
'
SCS_XGM
'
}
xgm: key of xgm to select: {
'
SA3_XGM
'
,
'
SCS_XGM
'
}
sase3First: bool, optional. Used in case no bunch pattern was recorded
sase3First: bool, optional. Used in case no bunch pattern was recorded
npulses: int, optional.
Us
ed in case no bunch pattern was recorded.
npulses: int, optional.
Requir
ed in case no bunch pattern was recorded.
Output:
Output:
DataArray that has all trainIds that contain a lasing
DataArray that has all trainIds that contain a lasing
...
@@ -135,10 +135,13 @@ def selectSASEinXGM(data, sase='sase3', xgm='SCS_XGM', sase3First=True, npulses=
...
@@ -135,10 +135,13 @@ def selectSASEinXGM(data, sase='sase3', xgm='SCS_XGM', sase3First=True, npulses=
are filled with NaNs.
are filled with NaNs.
'''
'''
if
sase
not
in
data
:
if
sase
not
in
data
:
print
(
'
Missing bunch pattern info!
\n
'
print
(
'
Missing bunch pattern info!
'
)
+
'
Retrieving {} SASE {} pulses assuming that
'
.
format
(
npulses
,
sase
[
4
])
if
npulses
is
None
:
raise
TypeError
(
'
npulses argument is required when bunch pattern
'
+
'
info is missing.
'
)
print
(
'
Retrieving {} SASE {} pulses assuming that
'
.
format
(
npulses
,
sase
[
4
])
+
'
SASE {} pulses come first.
'
.
format
(
'
3
'
if
sase3First
else
'
1
'
))
+
'
SASE {} pulses come first.
'
.
format
(
'
3
'
if
sase3First
else
'
1
'
))
#in older version of DAQ, non
data numbers were filled with 0.0.
#in older version of DAQ, non
-
data numbers were filled with 0.0.
xgmData
=
data
[
xgm
].
where
(
data
[
xgm
]
!=
0.0
,
drop
=
True
)
xgmData
=
data
[
xgm
].
where
(
data
[
xgm
]
!=
0.0
,
drop
=
True
)
xgmData
=
xgmData
.
fillna
(
0.0
).
where
(
xgmData
!=
1.0
,
drop
=
True
)
xgmData
=
xgmData
.
fillna
(
0.0
).
where
(
xgmData
!=
1.0
,
drop
=
True
)
if
(
sase3First
and
sase
==
'
sase3
'
)
or
(
not
sase3First
and
sase
==
'
sase1
'
):
if
(
sase3First
and
sase
==
'
sase3
'
)
or
(
not
sase3First
and
sase
==
'
sase1
'
):
...
@@ -449,7 +452,7 @@ def getTIMapd(data, mcp=1, use_apd=True, intstart=None, intstop=None,
...
@@ -449,7 +452,7 @@ def getTIMapd(data, mcp=1, use_apd=True, intstart=None, intstop=None,
bkgstop: trace index of background stop
bkgstop: trace index of background stop
t_offset: index separation between two pulses
t_offset: index separation between two pulses
mcp: MCP channel number
mcp: MCP channel number
npulses: int, optional. Number of pulses to compute.
Need
ed if
npulses: int, optional. Number of pulses to compute.
Requir
ed if
no bunch pattern info is available.
no bunch pattern info is available.
stride: int, optional. Used to select pulses in the APD array if
stride: int, optional. Used to select pulses in the APD array if
no bunch pattern info is available.
no bunch pattern info is available.
...
@@ -458,9 +461,12 @@ def getTIMapd(data, mcp=1, use_apd=True, intstart=None, intstop=None,
...
@@ -458,9 +461,12 @@ def getTIMapd(data, mcp=1, use_apd=True, intstart=None, intstop=None,
with N=max(number of pulses per train)
with N=max(number of pulses per train)
'''
'''
if
'
sase3
'
not
in
data
:
if
'
sase3
'
not
in
data
:
print
(
'
Missing bunch pattern info!
\n
'
print
(
'
Missing bunch pattern info!
\n
'
)
+
'
Retrieving {} SASE 3 pulses assuming that
'
.
format
(
npulses
)
if
npulses
is
None
:
+
'
SASE 3 pulses come first.
'
)
raise
TypeError
(
'
npulses argument is required when bunch pattern
'
+
'
info is missing.
'
)
print
(
'
Retrieving {} SASE 3 pulses assuming that
'
.
format
(
npulses
)
+
'
SASE 3 pulses come first.
'
)
if
use_apd
:
if
use_apd
:
tim
=
data
[
'
MCP{}apd
'
.
format
(
mcp
)][:,:
npulses
:
stride
]
tim
=
data
[
'
MCP{}apd
'
.
format
(
mcp
)][:,:
npulses
:
stride
]
else
:
else
:
...
@@ -800,7 +806,7 @@ def matchXgmTimPulseId(data, use_apd=True, intstart=None, intstop=None,
...
@@ -800,7 +806,7 @@ def matchXgmTimPulseId(data, use_apd=True, intstart=None, intstop=None,
bkgstart: trace index of background start
bkgstart: trace index of background start
bkgstop: trace index of background stop
bkgstop: trace index of background stop
t_offset: index separation between two pulses
t_offset: index separation between two pulses
npulses: number of pulses to compute.
Need
ed if no bunch
npulses: number of pulses to compute.
Requir
ed if no bunch
pattern info is available
pattern info is available
sase3First: bool, needed if bunch pattern is missing.
sase3First: bool, needed if bunch pattern is missing.
stride: int, used to select pulses in the TIM APD array if
stride: int, used to select pulses in the TIM APD array if
...
...
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