Skip to content

Commit 5869eca

Browse files
authored
Merge pull request #566 from OpenCOMPES/ph-peak-for-sector-alignment
Photon peak tutorial for sector alignment
2 parents d4b757b + 4784095 commit 5869eca

File tree

9 files changed

+684
-9
lines changed

9 files changed

+684
-9
lines changed

.cspell/custom-dictionary.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ figsize
127127
figsz
128128
filenotfound
129129
fixedvertex
130+
FLACPUPGLASER
130131
flatidx
131132
fluence
132133
fontsize
@@ -158,6 +159,7 @@ imkwds
158159
imread
159160
imshow
160161
imwrite
162+
incoupl
161163
incrementation
162164
inequivalent
163165
interp
@@ -300,6 +302,7 @@ printfuncs
300302
psutil
301303
ptargs
302304
pullrequest
305+
PULSEENERGY
303306
pval
304307
pyarrow
305308
pydantic

.github/workflows/benchmark.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,6 @@ jobs:
6464
commit-message: Update benchmark targets
6565
title: "Update benchmark targets"
6666
branch: "update_benchmark_targets"
67+
base: ${{ github.head_ref }}
6768
body: |
6869
Generated new benchmark targets.

docs/scripts/build_flash_parquets.py

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
from importlib.util import find_spec
3+
from typing import Any
34

45
from sed import SedProcessor
56
from sed.dataset import dataset
@@ -12,7 +13,7 @@
1213
data_path = dataset.dir
1314

1415

15-
config_override = {
16+
config_override: dict[str, Any] = {
1617
"core": {
1718
"paths": {
1819
"raw": data_path,
@@ -51,3 +52,66 @@
5152
system_config=config_file,
5253
collect_metadata=False,
5354
)
55+
56+
dataset.get("Photon_peak", root_dir="./tutorial")
57+
data_path = dataset.dir
58+
59+
config_override = {
60+
"core": {
61+
"paths": {
62+
"raw": data_path,
63+
"processed": data_path + "/processed/",
64+
},
65+
},
66+
"dataframe": {
67+
"ubid_offset": 0,
68+
"channels": {
69+
"timeStamp": {
70+
"index_key": "/zraw/TIMINGINFO/TIME1.BUNCH_FIRST_INDEX.1/dGroup/index",
71+
"dataset_key": "/zraw/TIMINGINFO/TIME1.BUNCH_FIRST_INDEX.1/dGroup/time",
72+
},
73+
"pulseId": {
74+
"index_key": "/zraw/FLASH.FEL/HEXTOF.DAQ/DLD1/dGroup/index",
75+
"dataset_key": "/zraw/FLASH.FEL/HEXTOF.DAQ/DLD1/dGroup/value",
76+
},
77+
"dldPosX": {
78+
"index_key": "/zraw/FLASH.FEL/HEXTOF.DAQ/DLD1/dGroup/index",
79+
"dataset_key": "/zraw/FLASH.FEL/HEXTOF.DAQ/DLD1/dGroup/value",
80+
},
81+
"dldPosY": {
82+
"index_key": "/zraw/FLASH.FEL/HEXTOF.DAQ/DLD1/dGroup/index",
83+
"dataset_key": "/zraw/FLASH.FEL/HEXTOF.DAQ/DLD1/dGroup/value",
84+
},
85+
"dldTimeSteps": {
86+
"index_key": "/zraw/FLASH.FEL/HEXTOF.DAQ/DLD1/dGroup/index",
87+
"dataset_key": "/zraw/FLASH.FEL/HEXTOF.DAQ/DLD1/dGroup/value",
88+
},
89+
"dldAux": {
90+
"index_key": "/zraw/FLASH.FEL/HEXTOF.DAQ/DLD1/dGroup/index",
91+
"dataset_key": "/zraw/FLASH.FEL/HEXTOF.DAQ/DLD1/dGroup/value",
92+
},
93+
"bam": {
94+
"index_key": "/zraw/FLASH.SDIAG/BAM.DAQ/4DBC3.HIGH_CHARGE_ARRIVAL_TIME/dGroup/index",
95+
"dataset_key": "/zraw/FLASH.SDIAG/BAM.DAQ/4DBC3.HIGH_CHARGE_ARRIVAL_TIME/dGroup/value",
96+
},
97+
"delayStage": {
98+
"index_key": "/zraw/FLASH.SYNC/LASER.LOCK.EXP/FLASH1.MOD1.PG.OSC/FMC0.MD22.1.ENCODER_POSITION.RD/dGroup/index",
99+
"dataset_key": "/zraw/FLASH.SYNC/LASER.LOCK.EXP/FLASH1.MOD1.PG.OSC/FMC0.MD22.1.ENCODER_POSITION.RD/dGroup/value",
100+
},
101+
"opticalDiode": {
102+
"format": "per_train",
103+
"index_key": "/uncategorised/FLASH.LASER/FLACPUPGLASER1.PULSEENERGY/PG2_incoupl/PULSEENERGY.MEAN/index",
104+
"dataset_key": "/uncategorised/FLASH.LASER/FLACPUPGLASER1.PULSEENERGY/PG2_incoupl/PULSEENERGY.MEAN/value",
105+
},
106+
},
107+
},
108+
}
109+
110+
runs = ["40887"]
111+
for run in runs:
112+
sp = SedProcessor(
113+
runs=run,
114+
config=config_override,
115+
system_config=config_file,
116+
collect_metadata=False,
117+
)

docs/scripts/download_data.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
dataset.get("TaS2", remove_zip=True, root_dir=root_dir)
88
dataset.get("Au_Mica", remove_zip=True, root_dir=root_dir)
99
dataset.get("W110", remove_zip=True, root_dir=root_dir)
10+
dataset.get("Photon_peak", remove_zip=True, root_dir=root_dir)

docs/workflows/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ myst:
1111
../tutorial/5_sxp_workflow
1212
../tutorial/9_hextof_workflow_trXPD
1313
../tutorial/12_momentum_correction_of_binned_data
14+
../tutorial/13_hextof_dld_sector_alignment_with_photon_peak
1415
```

src/sed/config/datasets.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@
2222
],
2323
"rearrange_files": true
2424
},
25+
"Photon_peak": {
26+
"url": "https://zenodo.org/records/15011781/files/single_event_data.zip",
27+
"subdirs": [
28+
"analysis_data"
29+
],
30+
"rearrange_files": true
31+
},
2532
"TaS2": {
2633
"url": "https://zenodo.org/records/10160182/files/TaS2.zip",
2734
"subdirs": [

src/sed/config/flash_example_config.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ dataframe:
5151
forward_fill_iterations: 2 # Number of iterations to fill the pulseId forward
5252
split_sector_id_from_dld_time: True # Remove reserved bits for dldSectorID from dldTimeSteps column
5353
sector_id_reserved_bits: 3 # Bits reserved for dldSectorID in the dldTimeSteps column
54-
sector_delays: [0., 0., 0., 0., 0., 0., 0., 0.] # Sector delays
54+
sector_delays: [0., 0., 0., 0., 0., 0., 0., 0.] # Sector delays in 'step' units applied to dldTimeSteps column
5555

5656
# Time and binning settings
5757
tof_binwidth: 2.0576131995767355E-11 # Base time-of-flight bin width in seconds
@@ -177,10 +177,11 @@ dataframe:
177177
slice: 15
178178

179179
# ADC containing the pulser sign (1: value approx. 35000, 0: 33000)
180-
pulserSignAdc:
181-
format: per_pulse
182-
index_key: "/FL1/Experiment/PG/SIS8300 100MHz ADC/CH6/TD/index"
183-
dataset_key: "/FL1/Experiment/PG/SIS8300 100MHz ADC/CH6/TD/value"
180+
# enable if needed
181+
# pulserSignAdc:
182+
# format: per_pulse
183+
# index_key: "/FL1/Experiment/PG/SIS8300 100MHz ADC/CH6/TD/index"
184+
# dataset_key: "/FL1/Experiment/PG/SIS8300 100MHz ADC/CH6/TD/value"
184185

185186
# the energy of the monochromatized beam. This is a quasi-static value.
186187
# there is a better channel which still needs implementation.

tutorial/12_momentum_correction_of_binned_data.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@
194194
"metadata": {},
195195
"outputs": [],
196196
"source": [
197-
"fig,ax = plt.subplots(1,2,figsize=(8,3), layout='constrained')\n",
197+
"fig,ax = plt.subplots(1,2,figsize=(6,2.5), layout='constrained')\n",
198198
"binned_data.isel(t=40).T.plot(ax=ax[0], cmap=\"terrain_r\")\n",
199199
"ax[0].set_title('corrected data')\n",
200200
"difference_data.isel(t=40).T.plot(ax=ax[1])\n",
@@ -212,9 +212,9 @@
212212
],
213213
"metadata": {
214214
"kernelspec": {
215-
"display_name": "sed_kernel_v1",
215+
"display_name": ".venv",
216216
"language": "python",
217-
"name": "sed_kernel_v1"
217+
"name": "python3"
218218
},
219219
"language_info": {
220220
"codemirror_mode": {

0 commit comments

Comments
 (0)