Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pes_to_spec
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
Package Registry
Model registry
Operate
Environments
Terraform modules
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
Machine Learning projects.
pes_to_spec
Merge requests
!7
Improve fit
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Improve fit
parallelization
into
main
Overview
1
Commits
13
Pipelines
0
Changes
1
Merged
Danilo Enoque Ferreira de Lima
requested to merge
parallelization
into
main
2 years ago
Overview
1
Commits
13
Pipelines
0
Changes
1
Expand
Estimate peak using a simple Gaussian filter and
np.argmax
to speed up fitting.
Calculate outliers with
IsolationForest
and per channel.
Add possibility of a polynomial fit on
pes
and
sqrt(pes)
.
Add possibility of fitting with weights and function to get weights based on the XGM intensity to get a flatter response a as a function of intensity.
Edited
2 years ago
by
Danilo Enoque Ferreira de Lima
0
0
Merge request reports
Viewing commit
ecb6b083
Prev
Next
Show latest version
1 file
+
19
−
17
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
ecb6b083
Added new test dataset.
· ecb6b083
Danilo Ferreira de Lima
authored
2 years ago
pes_to_spec/test/offline_analysis.py
+
19
−
17
Options
@@ -116,20 +116,26 @@ def main():
"""
Main entry point. Reads some data, trains and predicts.
"""
run_dir
=
"
/gpfs/exfel/exp/SA3/202121/p002935/raw
"
run_
i
d
=
"
r0015
"
run_dir
=
"
/gpfs/exfel/exp/SA3/202121/p002935/raw
/r0015
"
run_d
ir
=
"
/gpfs/exfel/exp/SQS/202201/p002828/raw/r0206
"
# get run
run
=
RunDirectory
(
f
"
{
run_dir
}
/
{
run_id
}
"
)
run
=
RunDirectory
(
run_dir
)
# get train IDs and match them, so we are sure to have information from all needed sources
# in this example, there is an offset of -2 in the SPEC train ID, so correct for it
spec_offset
=
-
2
spec_tid
=
spec_offset
+
run
[
'
SA3_XTD10_SPECT/MDL/FEL_BEAM_SPECTROMETER_SQS1:output
'
,
"
data.trainId
"
].
ndarray
()
pes_tid
=
run
[
'
SA3_XTD10_PES/ADC/1:network
'
,
"
digitizers.trainId
"
].
ndarray
()
xgm_tid
=
run
[
'
SA3_XTD10_XGM/XGM/DOOCS:output
'
,
"
data.trainId
"
].
ndarray
()
spec_name
=
'
SA3_XTD10_SPECT/MDL/FEL_BEAM_SPECTROMETER_SQS1:output
'
pes_name
=
'
SA3_XTD10_PES/ADC/1:network
'
xgm_name
=
'
SA3_XTD10_XGM/XGM/DOOCS:output
'
spec_offset
=
0
spec_name
=
'
SA3_XTD10_SPECT/MDL/SPECTROMETER_SQS_NAVITAR:output
'
pes_name
=
'
SA3_XTD10_PES/ADC/1:network
'
xgm_name
=
'
SA3_XTD10_XGM/XGM/DOOCS:output
'
spec_tid
=
spec_offset
+
run
[
spec_name
,
"
data.trainId
"
].
ndarray
()
pes_tid
=
run
[
pes_name
,
"
digitizers.trainId
"
].
ndarray
()
xgm_tid
=
run
[
xgm_name
,
"
data.trainId
"
].
ndarray
()
# these are the train ID intersection
# this could have been done by a select call in the RunDirectory, but it would not correct for the spec_offset
tids
=
matching_ids
(
spec_tid
,
pes_tid
,
xgm_tid
)
@@ -137,19 +143,15 @@ def main():
test_tids
=
tids
[
-
10
:]
# read the spec photon energy and intensity
spec_raw_pe
=
run
[
'
SA3_XTD10_SPECT/MDL/FEL_BEAM_SPECTROMETER_SQS1:output
'
,
"
data.photonEnergy
"
].
select_trains
(
by_id
[
tids
-
spec_offset
]).
ndarray
()
spec_raw_int
=
run
[
'
SA3_XTD10_SPECT/MDL/FEL_BEAM_SPECTROMETER_SQS1:output
'
,
"
data.intensityDistribution
"
].
select_trains
(
by_id
[
tids
-
spec_offset
]).
ndarray
()
spec_raw_pe
=
run
[
spec_name
,
"
data.photonEnergy
"
].
select_trains
(
by_id
[
tids
-
spec_offset
]).
ndarray
()
spec_raw_int
=
run
[
spec_name
,
"
data.intensityDistribution
"
].
select_trains
(
by_id
[
tids
-
spec_offset
]).
ndarray
()
# read the PES data for each channel
channels
=
[
f
"
channel_
{
i
}
_
{
l
}
"
for
i
,
l
in
product
(
range
(
1
,
5
),
[
"
A
"
,
"
B
"
,
"
C
"
,
"
D
"
])]
pes_raw
=
{
ch
:
run
[
'
SA3_XTD10_PES/ADC/1:network
'
,
f
"
digitizers.
{
ch
}
.raw.samples
"
].
select_trains
(
by_id
[
tids
]).
ndarray
()
pes_raw
=
{
ch
:
run
[
pes_name
,
f
"
digitizers.
{
ch
}
.raw.samples
"
].
select_trains
(
by_id
[
tids
]).
ndarray
()
for
ch
in
channels
}
pes_raw_t
=
{
ch
:
run
[
'
SA3_XTD10_PES/ADC/1:network
'
,
f
"
digitizers.
{
ch
}
.raw.samples
"
].
select_trains
(
by_id
[
test_tids
]).
ndarray
()
pes_raw_t
=
{
ch
:
run
[
pes_name
,
f
"
digitizers.
{
ch
}
.raw.samples
"
].
select_trains
(
by_id
[
test_tids
]).
ndarray
()
for
ch
in
channels
}
# read the XGM information
Loading