Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Provide a pyFAI Geometry Optimization Task #59

Draft
wants to merge 316 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
316 commits
Select commit Hold shift + click to select a range
4d675b6
[edit] Remove hot pixels + percentile(95)
LouConreux Nov 14, 2024
82c6d42
Merge branch 'dev' of https://github.com/LouConreux/lute into dev
LouConreux Nov 14, 2024
25bdb2e
[edit] percentile 98
LouConreux Nov 14, 2024
c6672ee
[edit] Change max rings to 10 instead of 5
LouConreux Nov 14, 2024
780b880
Auto-commit black formatting
actions-user Nov 14, 2024
8e00112
[edit] Set max_rings=5 but percentile(99)
LouConreux Nov 14, 2024
55774a3
Merge branch 'dev' of https://github.com/LouConreux/lute into dev
LouConreux Nov 14, 2024
743a9b7
[edit] Max_rings=10 and percentile(99)
LouConreux Nov 14, 2024
6bced5d
[test] Only percentile(99)
LouConreux Nov 14, 2024
4cb0757
Auto-commit black formatting
actions-user Nov 14, 2024
5edfaca
[test] max_rings=10
LouConreux Nov 14, 2024
cc1143f
Merge branch 'dev' of https://github.com/LouConreux/lute into dev
LouConreux Nov 14, 2024
d61026f
[test] Add thresholding filter with thresh=1e4
LouConreux Nov 14, 2024
7043e12
[edit] Add max_rings and Imin as args
LouConreux Nov 14, 2024
c7af138
[edit] fix an omission
LouConreux Nov 14, 2024
ac39a56
[edit] Preprocess powder + set up default Imin to 99-percentile
LouConreux Nov 14, 2024
7d31b64
[edit] remove powder[nice_pix]=0
LouConreux Nov 15, 2024
763e2be
[edit] Fix display
LouConreux Nov 15, 2024
4f7f7ce
Auto-commit black formatting
actions-user Nov 15, 2024
1e76b4f
[edit] Fix display
LouConreux Nov 15, 2024
f3c6395
[edit] Fix merging display
LouConreux Nov 15, 2024
a09efb6
Auto-commit black formatting
actions-user Nov 15, 2024
4547e14
[edit] Fix plotting powder intensity colorbar scale
LouConreux Nov 15, 2024
08be9cd
[edit] Fix merging plotting powder
LouConreux Nov 15, 2024
e44ed18
Auto-commit black formatting
actions-user Nov 15, 2024
f79df97
[edit] Set default max_rings to 10
LouConreux Nov 15, 2024
462ce7f
Merge branch 'dev' of https://github.com/LouConreux/lute into dev
LouConreux Nov 15, 2024
a98f152
[edit] Set vmin=np.percentile(powder, 25)
LouConreux Nov 15, 2024
8367369
[edit] Compute a custom score for exploring large distance range
LouConreux Nov 15, 2024
80572f1
[edit] Change back to residuals
LouConreux Nov 16, 2024
e7d8dd6
[edit] Trying a score based on two stats
LouConreux Nov 16, 2024
cdf8f9a
Auto-commit black formatting
actions-user Nov 16, 2024
675f46a
[edit] Trying a score based on two stats
LouConreux Nov 16, 2024
29d1297
Merge branch 'dev' of https://github.com/LouConreux/lute into dev
LouConreux Nov 16, 2024
5e54a8a
[edit] Add diagnostic plots and prints
LouConreux Nov 16, 2024
3c1d527
Auto-commit black formatting
actions-user Nov 16, 2024
5eeab95
[edit] Clean logs out of rank-dependent prints
LouConreux Nov 16, 2024
48ce15a
Merge branch 'dev' of https://github.com/LouConreux/lute into dev
LouConreux Nov 16, 2024
2ef1c10
[edit] Add diagnostics plots
LouConreux Nov 16, 2024
7ad687c
[edit] Final edit for plotting diagnostics
LouConreux Nov 16, 2024
026f459
Auto-commit black formatting
actions-user Nov 16, 2024
7c1b016
[edit] Final edit for plotting diagnostics
LouConreux Nov 16, 2024
d3d4d29
[edit] Final edit for plotting diagnostics
LouConreux Nov 16, 2024
e310267
Auto-commit black formatting
actions-user Nov 16, 2024
5cdfccd
[edit] Final edit of plotting diagnostics
LouConreux Nov 16, 2024
c655567
Merge branch 'dev' of https://github.com/LouConreux/lute into dev
LouConreux Nov 16, 2024
345ccb4
[edit] Final edit of plotting diagnostics
LouConreux Nov 16, 2024
04ce283
Auto-commit black formatting
actions-user Nov 16, 2024
7bbfec6
[edit] Fix figsize and dpi
LouConreux Nov 17, 2024
e52ed5b
Merge branch 'dev' of https://github.com/LouConreux/lute into dev
LouConreux Nov 17, 2024
069d393
[edit] Filter out residuals for which #CP < 10th-percentile
LouConreux Nov 19, 2024
c28ac05
Auto-commit black formatting
actions-user Nov 19, 2024
d14f355
[edit] Change path to update geometry to have both .geom and .data in…
LouConreux Nov 19, 2024
eb1d5d1
Merge branch 'dev' of https://github.com/LouConreux/lute into dev
LouConreux Nov 19, 2024
c61871f
Auto-commit black formatting
actions-user Nov 19, 2024
94dfc15
[edit] Change path to update geometry to have both .geom and .data in…
LouConreux Nov 19, 2024
9350d66
[edit] Change path to update geometry to have both .geom and .data in…
LouConreux Nov 19, 2024
f46de9f
Auto-commit black formatting
actions-user Nov 19, 2024
756e50c
[edit] Since filtering valid residuals reset index of array, need to …
LouConreux Nov 19, 2024
2645a42
Merge branch 'dev' of https://github.com/LouConreux/lute into dev
LouConreux Nov 19, 2024
e4799e5
[edit] Change filtering from 10 to 15% scores
LouConreux Nov 19, 2024
7e71cf4
[edit] Change filtering from 10 to 15% scores
LouConreux Nov 19, 2024
8390cbd
[edit] Change filtering from 15 to 10% scores
LouConreux Nov 19, 2024
585ce2f
[test] Change treshold from mean+3std to mean+2std
LouConreux Nov 19, 2024
954d10f
[edit] Skip distances for which all initial samples have score 0, hen…
LouConreux Nov 21, 2024
4c59b7d
Auto-commit black formatting
actions-user Nov 21, 2024
1436a6f
[edit] Skip distances for which all initial samples have score 0, hen…
LouConreux Nov 21, 2024
eb09c4b
Merge branch 'dev' of https://github.com/LouConreux/lute into dev
LouConreux Nov 21, 2024
b7bb767
[edit] Skip distances for which all initial samples have score 0, hen…
LouConreux Nov 21, 2024
9a4c745
[edit] Fix plots after recent modifications
LouConreux Nov 21, 2024
b9bc147
[test] Replace 10% percentile with mean-std threshold for distance sc…
LouConreux Nov 21, 2024
b7a0ae9
Auto-commit black formatting
actions-user Nov 21, 2024
72aa4a7
[test] Replace threshold with 12% percentile
LouConreux Nov 21, 2024
8d97706
Merge branch 'dev' of https://github.com/LouConreux/lute into dev
LouConreux Nov 21, 2024
1085680
[edit] Add some metrics to quantify score number of control points vs…
LouConreux Nov 21, 2024
9d8b30a
Auto-commit black formatting
actions-user Nov 21, 2024
0dda99b
[edit] Add some metrics to quantify score number of control points vs…
LouConreux Nov 21, 2024
dd8d372
Merge branch 'dev' of https://github.com/LouConreux/lute into dev
LouConreux Nov 21, 2024
9c9793c
[edit] Mask false status pixels, edges and central pixels of panels +…
LouConreux Nov 21, 2024
ef8b9db
Auto-commit black formatting
actions-user Nov 21, 2024
a4e3894
[edit] Mask false status pixels, edges and central pixels of panels +…
LouConreux Nov 21, 2024
d0bdf8c
[edit] Mask false status pixels, edges and central pixels of panels +…
LouConreux Nov 21, 2024
77d401c
[edit] Mask false status pixels, edges and central pixels of panels +…
LouConreux Nov 21, 2024
7c4372f
Auto-commit black formatting
actions-user Nov 21, 2024
220a4ec
[edit] Mask false status pixels, edges and central pixels of panels +…
LouConreux Nov 21, 2024
2d397c0
Merge branch 'dev' of https://github.com/LouConreux/lute into dev
LouConreux Nov 21, 2024
7355241
[edit] Mask false status pixels, edges and central pixels of panels +…
LouConreux Nov 21, 2024
e7a352d
[edit] Mask false status pixels, edges and central pixels of panels +…
LouConreux Nov 21, 2024
71a4bae
[edit] Mask false status pixels, edges and central pixels of panels +…
LouConreux Nov 21, 2024
e6e757d
[edit] Mask false status pixels, edges and central pixels of panels +…
LouConreux Nov 21, 2024
477080c
[edit] Mask false status pixels, edges and central pixels of panels +…
LouConreux Nov 21, 2024
9d68d92
[edit] Mask false status pixels, edges and central pixels of panels +…
LouConreux Nov 21, 2024
8303356
[edit] Mask false status pixels, edges and central pixels of panels +…
LouConreux Nov 21, 2024
1fda86c
[edit] Reduce Rayonix radial integration to circle within 1920/4 * sq…
LouConreux Nov 21, 2024
f48f0d9
[edit] Find peaks in scores vs distance to estimate regions where bes…
LouConreux Nov 21, 2024
9380a2c
[edit] Add find_peaks method to compare possible best residuals
LouConreux Nov 21, 2024
fcbd458
[edit] Add find_peaks method to compare possible best residuals
LouConreux Nov 21, 2024
c0982cb
Auto-commit black formatting
actions-user Nov 21, 2024
f89c49b
[test] Threshold powder at mean + 5 std
LouConreux Nov 22, 2024
e0a1ec6
Merge branch 'dev' of https://github.com/LouConreux/lute into dev
LouConreux Nov 22, 2024
89b25a6
[test] find_peaks distance=5 height=percentile_10
LouConreux Nov 22, 2024
f02b950
[test] threshold instead of height=percentile
LouConreux Nov 22, 2024
d6ff791
[test] no threshold only distance=5
LouConreux Nov 22, 2024
359ee12
[test] distance=5 height=percentile10
LouConreux Nov 22, 2024
6f8ff19
[test] Testing new implementation for finding best Imin
LouConreux Nov 24, 2024
5a17845
Auto-commit black formatting
actions-user Nov 24, 2024
283eb07
[test] Testing new implementation for finding best Imin
LouConreux Nov 24, 2024
4c84957
Merge branch 'dev' of https://github.com/LouConreux/lute into dev
LouConreux Nov 24, 2024
396059b
[test] Testing new implementation for finding best Imin
LouConreux Nov 24, 2024
d35e53d
[test] Testing new implementation for finding best Imin
LouConreux Nov 24, 2024
ed2db62
[test] Testing new implementation for finding best Imin
LouConreux Nov 24, 2024
f072fec
[test] Testing new implementation for finding best Imin
LouConreux Nov 25, 2024
b1d41d4
[test] Testing new implementation for finding best Imin
LouConreux Nov 25, 2024
95fda13
[test] Testing new implementation for finding best Imin
LouConreux Nov 25, 2024
2edf7cf
[test] Testing new implementation for finding best Imin
LouConreux Nov 25, 2024
47109c2
[edit] Test new implementation of Imin without taking non zero pixels
LouConreux Nov 25, 2024
ab3db4a
[edit] Test new implementation of Imin without taking non zero pixels
LouConreux Nov 25, 2024
9ee9a45
Auto-commit black formatting
actions-user Nov 25, 2024
a39f02a
[edit] Add find peaks to retrieve nice residuals
LouConreux Nov 25, 2024
c501937
Merge branch 'dev' of https://github.com/LouConreux/lute into dev
LouConreux Nov 25, 2024
9b3d6dd
[edit] Fixing Imin overwriting
LouConreux Nov 25, 2024
dd893f8
[edit] Fixing Imin overwriting
LouConreux Nov 25, 2024
648b145
[edit] Fixing Imin overwriting
LouConreux Nov 25, 2024
cc5b6c1
[edit] Setting bounds for Imin from 95 to 99.9%
LouConreux Nov 25, 2024
9524d79
[edit] Setting bounds for Imin from 95 to 99.9%
LouConreux Nov 25, 2024
ffc8937
[edit] Setting bounds for Imin from 95 to 99.9% + find_peaks for scores
LouConreux Nov 25, 2024
0ddce76
[edit] Setting bounds for Imin from 95 to 99.9% + find_peaks for scores
LouConreux Nov 25, 2024
54a3262
Auto-commit black formatting
actions-user Nov 25, 2024
d09b15f
[edit] Setting bounds for Imin from 95 to 99.9% + find_peaks for scor…
LouConreux Nov 25, 2024
09d5c87
[edit] Setting bounds for Imin from 95 to 99.9% + find_peaks for scor…
LouConreux Nov 25, 2024
515f95c
[edit] Manually add adjacent peaks to find best res
LouConreux Nov 25, 2024
41f5407
Auto-commit black formatting
actions-user Nov 25, 2024
5a49036
[edit] Manually add adjacent peaks to find best res
LouConreux Nov 25, 2024
7c2ac5f
[edit] Manually add adjacent peaks to find best res
LouConreux Nov 25, 2024
ba1e984
[edit] Manually add adjacent peaks to find best res
LouConreux Nov 25, 2024
dc14348
[edit] Add distance option: either specifies dist bounds to search or…
LouConreux Nov 26, 2024
a8b118d
Auto-commit black formatting
actions-user Nov 26, 2024
c20f1e4
[edit] Remove bounds pydantic definition for more flexibility on dist…
LouConreux Nov 26, 2024
588acbd
Merge branch 'dev' of https://github.com/LouConreux/lute into dev
LouConreux Nov 26, 2024
e204dc0
[edit] Refine bounds pydantic definition for more flexibility on dist…
LouConreux Nov 26, 2024
38e68b0
[edit] Wrong def for distance guess bounds my bad
LouConreux Nov 26, 2024
4b2bdea
[add] Implemented SMD+GeomOpt workflow and updated task and task para…
LouConreux Nov 28, 2024
61a1d6b
Auto-commit black formatting
actions-user Nov 28, 2024
6a6bf49
[edit] max_cores=120
LouConreux Nov 28, 2024
5510963
Merge branch 'dev' of https://github.com/LouConreux/lute into dev
LouConreux Nov 28, 2024
3b7701d
[edit] Forgot to import validator from pydantic
LouConreux Nov 28, 2024
c9a3cf2
[edit] Create fig folder if not already existing
LouConreux Nov 28, 2024
877d0a5
Auto-commit black formatting
actions-user Nov 28, 2024
b6eb5c3
[edit] Change validators for workflow handling
LouConreux Nov 28, 2024
6173616
Merge branch 'dev' of https://github.com/LouConreux/lute into dev
LouConreux Nov 28, 2024
5fd5792
[edit] Add prints for debugging
LouConreux Nov 29, 2024
24fe713
[edit] Add prints for debugging
LouConreux Nov 29, 2024
7ec7dda
Auto-commit black formatting
actions-user Nov 29, 2024
c8ef29b
[edit] Add prints for debugging
LouConreux Nov 29, 2024
1504f32
Merge branch 'dev' of https://github.com/LouConreux/lute into dev
LouConreux Nov 29, 2024
7c372a7
Auto-commit black formatting
actions-user Nov 29, 2024
858d417
[edit] Fix validator in_file
LouConreux Nov 29, 2024
0006bd1
Merge branch 'dev' of https://github.com/LouConreux/lute into dev
LouConreux Nov 29, 2024
9eca5c1
[edit] Fix validator in_file
LouConreux Nov 29, 2024
9dfb05e
[edit] Fix validator in_file
LouConreux Nov 29, 2024
e797818
[edit] Fix validator in_file
LouConreux Nov 29, 2024
72cdae4
[edit] Fix validator in_file
LouConreux Nov 29, 2024
3e318c5
Auto-commit black formatting
actions-user Nov 29, 2024
081b34d
[edit] Fix validator in_file
LouConreux Nov 29, 2024
5c91999
[edit] Fix validator in_file
LouConreux Nov 29, 2024
44ea70b
[edit] Fix validator in_file
LouConreux Nov 29, 2024
10d6ac2
Auto-commit black formatting
actions-user Nov 29, 2024
124cc26
[edit] Fix validator in_file
LouConreux Nov 29, 2024
6bf58f2
[edit] Fix validator in_file
LouConreux Nov 29, 2024
6905260
Auto-commit black formatting
actions-user Nov 29, 2024
a213ba2
[edit] Fix extract powder
LouConreux Nov 29, 2024
2188bd3
Merge branch 'dev' of https://github.com/LouConreux/lute into dev
LouConreux Nov 29, 2024
6ac7049
[edit] Fix extract powder
LouConreux Nov 29, 2024
3e20c99
[edit] Fix extract powder
LouConreux Nov 29, 2024
441a806
[edit] Add validate_calib_path as custom validator + change get wavel…
LouConreux Nov 30, 2024
dd0a6ab
Auto-commit black formatting
actions-user Nov 30, 2024
7c16212
[edit] Fix fetching wavelength from EBeam
LouConreux Nov 30, 2024
96c09ba
[edit] Fix fetching wavelength from EBeam
LouConreux Nov 30, 2024
30a0d3a
Auto-commit black formatting
actions-user Nov 30, 2024
1a95eec
[edit] Fig folder creation fixing
LouConreux Nov 30, 2024
7313078
Merge branch 'dev' of https://github.com/LouConreux/lute into dev
LouConreux Nov 30, 2024
358d686
[edit] Using right smalldata producer to get max powder
LouConreux Dec 1, 2024
44a3aef
Auto-commit black formatting
actions-user Dec 1, 2024
417bb9f
[edit] Prevent from cloning smalldata_tools before running SmallDataP…
LouConreux Dec 1, 2024
23698e8
[edit] Prevent from cloning smalldata_tools before running SmallDataP…
LouConreux Dec 1, 2024
51e2dae
[edit] Relaxed intensity search
LouConreux Dec 1, 2024
c7a6045
[edit] Relaxed intensity search
LouConreux Dec 1, 2024
c5fd45b
[edit] Relaxed intensity search
LouConreux Dec 1, 2024
7c7d4f9
[edit] Relaxed intensity search
LouConreux Dec 1, 2024
1f709b2
[edit] Allow for more flexibility in Imin search
LouConreux Dec 3, 2024
1d287f9
[edit] Allow for more flexibility in Imin search
LouConreux Dec 3, 2024
1cd52d3
[edit] Allow for more flexibility in Imin search
LouConreux Dec 3, 2024
e92f29e
[edit] Fix scaling error in converting energy_photon to wavelength
LouConreux Dec 3, 2024
f03f1e6
[test] 6 STDS
LouConreux Dec 4, 2024
8033e2d
[test] 5 STDS
LouConreux Dec 4, 2024
7aabca5
[test] 6 STDS
LouConreux Dec 4, 2024
ba7ac44
[test] 6 STDS
LouConreux Dec 4, 2024
1373113
[test] 8 STDS
LouConreux Dec 4, 2024
ad9518d
[test] 10 STDS
LouConreux Dec 4, 2024
250404a
[edit] Handle case where final residual computation is impossible sin…
LouConreux Dec 5, 2024
711f816
[edit] back to 5 STDS
LouConreux Dec 5, 2024
a2b679d
[edit] Fix unnecessary imports to pass PR tests
LouConreux Dec 6, 2024
b8fbbd1
Auto-commit black formatting
actions-user Dec 6, 2024
ae5e8f3
Merge branch 'dev' of github.com:slac-lcls/lute into dev
LouConreux Dec 6, 2024
e77c24b
Merge branch 'dev' of https://github.com/LouConreux/lute into dev
LouConreux Dec 6, 2024
4fbc029
[edit] Add type: ignore to fix mypy test
LouConreux Dec 7, 2024
1bc8498
Auto-commit black formatting
actions-user Dec 7, 2024
09d85bd
[edit] Fix mypy testing through asserting correct pydantic type
LouConreux Dec 9, 2024
a840e2a
Merge branch 'dev' of https://github.com/LouConreux/lute into dev
LouConreux Dec 9, 2024
c5a7111
[edit] Fix mypy testing through asserting correct pydantic type
LouConreux Dec 9, 2024
a2d8b67
Auto-commit black formatting
actions-user Dec 9, 2024
6dc7a00
[edit] Fix mypy testing through asserting correct pydantic type
LouConreux Dec 10, 2024
09aaa5a
[edit] Fix mypy pydantic check
LouConreux Dec 10, 2024
5b12484
[refacto] Fix unnecessary logs and set back to default mapping of mpi…
LouConreux Dec 10, 2024
9aaacf4
Auto-commit black formatting
actions-user Dec 10, 2024
5cab26d
[edit] Set --bind-to core inside mpi command for MPIExecutor
LouConreux Dec 10, 2024
79cf672
Merge branch 'dev' of https://github.com/LouConreux/lute into dev
LouConreux Dec 10, 2024
5947427
[edit] Set --map-by core inside mpi command for MPIExecutor
LouConreux Dec 10, 2024
8f4778e
[refacto] Removed surrogate map and acquisition map from bayes opt hi…
LouConreux Dec 10, 2024
9f9436c
[edit] Fix pyOpenCL after importing modules
LouConreux Dec 10, 2024
dddab65
Auto-commit black formatting
actions-user Dec 10, 2024
a9ee817
[edit] Try to compute detector edge resolution
LouConreux Dec 11, 2024
a3c1578
Merge branch 'dev' of https://github.com/LouConreux/lute into dev
LouConreux Dec 11, 2024
1493b36
Auto-commit black formatting
actions-user Dec 11, 2024
122f9ff
[edit] Set Imin lower bound to 98
LouConreux Dec 11, 2024
bdb65ee
Merge branch 'dev' of https://github.com/LouConreux/lute into dev
LouConreux Dec 11, 2024
5a4a1c7
[edit] Set Imin lower bound to 99
LouConreux Dec 11, 2024
5ea90a4
[edit] Set Imin lower bound to 99
LouConreux Dec 11, 2024
55380dd
[edit] Set Imin lower bound to 99
LouConreux Dec 11, 2024
1e2d8fe
[edit] Set Imin lower bound to 99.5
LouConreux Dec 11, 2024
a80de81
[edit] Set back to 95
LouConreux Dec 11, 2024
ee2ac0e
[edit] Add refined dist to label
LouConreux Dec 11, 2024
e8d6f7b
Auto-commit black formatting
actions-user Dec 11, 2024
336b054
[edit] Fix plots
LouConreux Dec 11, 2024
4f4a5ff
Merge branch 'dev' of https://github.com/LouConreux/lute into dev
LouConreux Dec 11, 2024
2bd18cb
[edit] Fix output on eLog
LouConreux Dec 11, 2024
9618b1d
[edit] Fix plot for Elog summary
LouConreux Dec 11, 2024
c6365e8
[edit] Include plots in the eLog summary
LouConreux Dec 11, 2024
27ea664
Auto-commit black formatting
actions-user Dec 11, 2024
dca2ccd
[edit] Set back to 98
LouConreux Dec 12, 2024
deef9f4
Merge branch 'dev' of https://github.com/LouConreux/lute into dev
LouConreux Dec 12, 2024
5e9ac77
[edit] Refine not on rotation first, only on dist cx cy, then finally…
LouConreux Dec 12, 2024
d12e239
Auto-commit black formatting
actions-user Dec 12, 2024
f75e4a6
[edit] Set back to 95
LouConreux Dec 12, 2024
1a57e9e
Merge branch 'dev' of https://github.com/LouConreux/lute into dev
LouConreux Dec 12, 2024
d868e57
[edit] Set back normal
LouConreux Dec 12, 2024
5f90f33
Auto-commit black formatting
actions-user Dec 12, 2024
09b9ef6
[edit] Set to 99
LouConreux Dec 12, 2024
a169ebb
Merge branch 'dev' of https://github.com/LouConreux/lute into dev
LouConreux Dec 12, 2024
90920fe
[edit] Set back to 95
LouConreux Dec 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lute/execution/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1151,7 +1151,7 @@ def _submit_cmd(self, executable_path: str, params: str) -> str:
nprocs: int = max(
int(os.environ.get("SLURM_NPROCS", len(os.sched_getaffinity(0)))) - 1, 1
)
mpi_cmd: str = f"mpirun -np {nprocs}"
mpi_cmd: str = f"mpirun -np {nprocs} --map-by core"
if __debug__:
py_cmd = f"python -B -u -m mpi4py.run {executable_path} {params}"
else:
Expand Down
12 changes: 12 additions & 0 deletions lute/execution/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,22 @@ def get_logger(name: str, is_task: bool = True) -> logging.Logger:
other_logger, logging.PlaceHolder
):
other_logger.disabled = True
elif "pyFAI" in other_name and not isinstance(
other_logger, logging.PlaceHolder
):
other_logger.disabled = True
elif "goniometer" in other_name and not isinstance(
other_logger, logging.PlaceHolder
):
other_logger.disabled = True
elif "numpy" in other_name and not isinstance(
other_logger, logging.PlaceHolder
):
other_logger.setLevel(logging.CRITICAL)
elif "numexpr.utils" in other_name and not isinstance(
other_logger, logging.PlaceHolder
):
other_logger.setLevel(logging.WARNING)
logger: logging.Logger = logging.getLogger(name)
logger.propagate = False
handler: logging.Handler
Expand Down
1 change: 1 addition & 0 deletions lute/io/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
from .tests import *
from .mpi_tests import *
from .geometry import *
from .geom_opt import *
160 changes: 160 additions & 0 deletions lute/io/models/geom_opt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
"""Models for optimizing detector geometry using PyFAI and Bayesian optimization.

Classes:
- OptimizePyFAIGeometryParameters(TaskParameters):
Parameters for optimizing detector geometry using PyFAI and Bayesian optimization.
"""

__all__ = ["OptimizePyFAIGeometryParameters"]
__author__ = "Louis Conreux"

from typing import Any, Dict, Optional, Union, Tuple

from pydantic import BaseModel, Field, validator

from lute.io.models.base import TaskParameters
from lute.io.models.validators import validate_smd_path, validate_calib_path


class OptimizePyFAIGeometryParameters(TaskParameters):
"""Parameters for optimizing detector geometry using PyFAI and Bayesian optimization.

The Bayesian Optimization has default hyperparameters that can be overriden by the user.
"""

class Config(TaskParameters.Config):
set_result: bool = True
"""Whether the Executor should mark a specified parameter as a result."""

class BayesGeomOptParameters(BaseModel):
"""Bayesian optimization hyperparameters."""

bounds: Dict[str, Union[float, Tuple[float, float]]] = Field(
{
"dist": (0.02, 0.6),
"poni1": (-0.01, 0.01),
"poni2": (-0.01, 0.01),
},
description="Bounds defining the parameter search space for the Bayesian optimization.",
)

res: float = Field(
None,
description="Resolution of the grid used to discretize the parameter search space.",
)

max_rings: int = Field(
5,
description="Maximum number of rings to be used for the Bayesian optimization.",
)

n_samples: Optional[int] = Field(
50,
description="Number of random starts to initialize the Bayesian optimization.",
)

n_iterations: Optional[int] = Field(
50,
description="Number of iterations to run the Bayesian optimization.",
)

prior: Optional[bool] = Field(
True,
description="Whether to use a gaussian prior centered on the search space for the Bayesian optimization or randomly pick samples.",
)

af: Optional[str] = Field(
"ucb",
description="Acquisition function to be used by the Bayesian optimization.",
)

hyperparams: Optional[Dict[str, float]] = Field(
{
"beta": 1.96,
"epsilon": 0.01,
},
description="Hyperparameters for the acquisition function.",
)

seed: Optional[int] = Field(
None,
description="Seed for the random number generator for potential reproducibility.",
)

_find_smd_path = validate_smd_path("powder")

_find_in_file_path = validate_calib_path("in_file")

exp: str = Field(
"",
description="Experiment name.",
)

run: Union[str, int] = Field(
None,
description="Run number.",
)

det_type: str = Field(
"",
description="Detector type. Currently supported: 'ePix10k2M', 'ePix10kaQuad', 'Rayonix', 'Jungfrau1M', 'Jungfrau4M'",
)

work_dir: str = Field(
"",
description="Main working directory for LUTE.",
)

in_file: str = Field(
"",
description="Path to the input .data file containing the detector geometry info to be calibrated.",
)

powder: str = Field(
"",
description="Powder diffraction pattern to be used for the calibration.",
)

calibrant: str = Field(
"",
description="Calibrant used for the calibration supported by pyFAI: https://github.com/silx-kit/pyFAI/tree/main/src/pyFAI/resources/calibration",
)

out_file: str = Field(
"",
description="Path to the output .data file containing the optimized detector geometry.",
is_result=True,
)

bo_params: BayesGeomOptParameters = Field(
BayesGeomOptParameters(),
description="Bayesian optimization parameters containing bounds and resolution for defining space search and hyperparameters.",
)

@validator("exp", always=True)
def validate_exp(cls, exp: str, values: Dict[str, Any]) -> str:
if not exp:
exp = values["lute_config"].experiment
return exp

@validator("run", always=True)
def validate_run(
cls, run: Union[str, int], values: Dict[str, Any]
) -> Union[str, int]:
if not run:
run = values["lute_config"].run
return run

@validator("work_dir", always=True)
def validate_work_dir(cls, work_dir: str, values: Dict[str, Any]) -> str:
if not work_dir:
work_dir = values["lute_config"].work_dir
return work_dir

@validator("out_file", always=True)
def validate_out_file(cls, out_file: str, values: Dict[str, Any]) -> str:
if not out_file:
in_file = values["in_file"]
run = values["run"]
out_file = in_file.replace("0-end.data", f"{run}-end.data")
return out_file
35 changes: 33 additions & 2 deletions lute/io/models/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
parameters for validation.
"""

__all__ = ["template_parameter_validator", "validate_smd_path"]
__author__ = "Gabriel Dorlhiac"
__all__ = ["template_parameter_validator", "validate_smd_path", "validate_calib_path"]
__author__ = ["Gabriel Dorlhiac", "Louis Conreux"]

import os
from typing import Dict, Any, Optional
Expand All @@ -15,6 +15,9 @@

from lute.io.db import read_latest_db_entry

import psana # type: ignore
from PSCalib.CalibFileFinder import find_calib_file # type: ignore


def template_parameter_validator(template_params_name: str):
"""Populates a TaskParameters model with a set of validated TemplateParameters.
Expand Down Expand Up @@ -68,3 +71,31 @@ def _validate_smd_path(cls, smd_path: str, values: Dict[str, Any]) -> str:
return smd_path

return validator(smd_path_name, always=True, allow_reuse=True)(_validate_smd_path)


def validate_calib_path(calib_path_name: str):
"""Finds the path to a valid calibration file or raises an error."""

def _validate_calib_path(cls, calib_path: str, values: Dict[str, Any]) -> str:
if calib_path == "":
exp: str = values["lute_config"].experiment
run: int = int(values["lute_config"].run)
try:
det_type: str = values["det_type"]
except KeyError:
det_type = values["detname"]
cdir = f"/sdf/data/lcls/ds/{exp[:3]}/{exp}/calib"
ds_args = f"exp={exp}:run={run}:idx"
ds = psana.DataSource(ds_args)
det = psana.Detector(det_type, ds.env())
src = str(det.name)
type = "geometry"
calib_path = find_calib_file(cdir, src, type, run, pbits=1)
if calib_path is None:
raise ValueError(f"No calibration file found for {det_type} in {cdir}")

return calib_path

return validator(calib_path_name, always=True, allow_reuse=True)(
_validate_calib_path
)
5 changes: 5 additions & 0 deletions lute/managed_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,8 @@

PeakFinderPsocake: Executor = Executor("FindPeaksPsocake")
"""Performs Bragg peak finding using psocake - *DEPRECATED*."""

# PyFAI
#######
PyFAIGeometryOptimizer: MPIExecutor = MPIExecutor("OptimizePyFAIGeometry")
"""Optimize detector geometry using PyFAI coupled with Bayesian Optimization."""
5 changes: 5 additions & 0 deletions lute/tasks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ def import_task(task_name: str) -> Type[Task]:

return TestMultiNodeCommunication

if task_name == "OptimizePyFAIGeometry":
from .geom_opt import OptimizePyFAIGeometry

return OptimizePyFAIGeometry

if task_name == "OptimizeAgBhGeometryExhaustive":
from .geometry import OptimizeAgBhGeometryExhaustive

Expand Down
Loading
Loading