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
70ab551b
Commit
70ab551b
authored
6 years ago
by
Laurent Mercadier
Browse files
Options
Downloads
Patches
Plain Diff
Renames timFactorFromVoltage() to timFactorFromTable() and makes photonEnergy an argument
parent
1e08ab01
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
+1
-5
1 addition, 5 deletions
xgm.py
with
1 addition
and
5 deletions
xgm.py
+
1
−
5
View file @
70ab551b
...
...
@@ -591,7 +591,7 @@ tim_calibration_table = {
[
3.69445588e-11
,
-
1.97731342e-07
,
3.98203522e-04
,
-
3.78338599e-01
,
1.41894119e+02
]])
}
def
timFactorFrom
Voltag
e
(
voltage
,
photonEnergy
=
None
,
mcp
=
1
):
def
timFactorFrom
Tabl
e
(
voltage
,
photonEnergy
,
mcp
=
1
):
'''
Returns an energy calibration factor for TIM integrated peak signal (APD)
according to calibration from March 2019, proposal 900074, semester 201930,
runs 69 - 111 (Ni edge): https://in.xfel.eu/elog/SCS+Beamline/2323
...
...
@@ -603,15 +603,12 @@ def timFactorFromVoltage(voltage, photonEnergy=None, mcp=1):
voltage: MCP voltage in volts.
photonEnergy: FEL photon energy in eV. Calibration factor is linearly
interpolated between the known values from the calibration table.
If None, takes the median photon energy from the calibration table.
mcp: MCP channel (1, 2, or 3).
Output:
f: calibration factor in microjoule per APD signal
'''
energies
=
np
.
sort
([
key
for
key
in
tim_calibration_table
])
if
photonEnergy
is
None
:
photonEnergy
=
np
.
median
(
energies
)
if
photonEnergy
not
in
photon_energies
:
if
photonEnergy
>
energies
.
max
():
photonEnergy
=
energies
.
max
()
...
...
@@ -628,4 +625,3 @@ def timFactorFromVoltage(voltage, photonEnergy=None, mcp=1):
poly
=
np
.
poly1d
(
tim_calibration_table
[
photonEnergy
][
mcp
-
1
])
f
=
-
np
.
exp
(
poly
(
voltage
))
return
f
\ No newline at end of file
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