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

Frame unwrapping and WFM #472

Merged
merged 43 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
60ecf33
Experiment with new frame-unwrapping workflow
SimonHeybrock Nov 27, 2023
243729c
Simpler WFM frame offsetting
SimonHeybrock Nov 28, 2023
ce8ef99
Move code to module
SimonHeybrock Nov 28, 2023
6179931
Cleanup
SimonHeybrock Nov 28, 2023
c8dcebb
Add provider setup helper
SimonHeybrock Nov 28, 2023
69f7078
Add docstrings
SimonHeybrock Nov 29, 2023
218c45e
Start graph refactor so we can also offset event_time_zero
SimonHeybrock Nov 29, 2023
9522b82
Compute OffsetToTimeOfFlight
SimonHeybrock Nov 30, 2023
712244c
Support beamlines using full pulse
SimonHeybrock Dec 7, 2023
6da49f3
Document
SimonHeybrock Dec 7, 2023
99c0478
Handle inter-subframe events using NAN
SimonHeybrock Dec 7, 2023
23b9306
Generalize graph so we can handle monitors
SimonHeybrock Dec 7, 2023
13c908f
Sketch approach for non-event data
SimonHeybrock Dec 7, 2023
266141e
Fix subframe merge in chopper_cascade module
SimonHeybrock Dec 12, 2023
c1c5b7f
WIP tests [no ci]
SimonHeybrock Dec 21, 2023
f5bcb93
Support getting frame at any distance
SimonHeybrock Jan 11, 2024
172b1c9
Basic test of unwrapping code
SimonHeybrock Jan 11, 2024
6be1439
Use choppers from fakes for docs
SimonHeybrock Jan 11, 2024
42f11bb
Begin updating frame-unwrapping notebook
SimonHeybrock Jan 11, 2024
ae1f4f5
Remove merged notebook
SimonHeybrock Jan 11, 2024
8016270
Remove old tof.frames module
SimonHeybrock Jan 11, 2024
ac58634
Reject overlapping frames
SimonHeybrock Jan 11, 2024
aeda208
Module docstring
SimonHeybrock Jan 11, 2024
20f51e3
Test frame period
SimonHeybrock Jan 11, 2024
68fca82
More tests
SimonHeybrock Jan 11, 2024
1da5272
Test frame skipping
SimonHeybrock Jan 11, 2024
91d3e5e
Begin testing wfm, but ran into conceptual issues [no ci]
SimonHeybrock Jan 11, 2024
c1f7171
Fix some WFM issues
SimonHeybrock Jan 12, 2024
f59f9a9
Merge branch 'main' into unwrap
SimonHeybrock Jan 12, 2024
b20bb9c
Update test envs
SimonHeybrock Jan 12, 2024
cc66335
Docstrings and comments
SimonHeybrock Jan 18, 2024
62158fd
Extend docstrings
SimonHeybrock Jan 24, 2024
938486e
Merge branch 'main' into unwrap
SimonHeybrock Jan 25, 2024
96e5de0
Fix WFM offset computation and restructure logic
SimonHeybrock Feb 7, 2024
5d60e14
Improve graph structure
SimonHeybrock Feb 7, 2024
bb79688
Add L1 and improve docs
SimonHeybrock Feb 7, 2024
ec8b9fe
Apply suggestions from code review
SimonHeybrock Feb 13, 2024
c5ccebe
Update src/scippneutron/tof/unwrap.py
SimonHeybrock Feb 13, 2024
c67e32c
Apply automatic formatting
SimonHeybrock Feb 13, 2024
efd7ed4
Grammar
SimonHeybrock Feb 13, 2024
f41165e
Correct Ltotal instead of setting L1
SimonHeybrock Feb 13, 2024
91a84f5
Fix some tests
SimonHeybrock Feb 20, 2024
d24ac9f
Test to_time_of_flight
SimonHeybrock Feb 20, 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
3 changes: 3 additions & 0 deletions .buildconfig/ci-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ dependencies:
- sphinx-copybutton==0.5.2
- sphinx-design==0.5.0
- sphinxcontrib-bibtex==2.6.1

# docs and tests
- sciline==24.01.1
3 changes: 3 additions & 0 deletions .buildconfig/ci-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ dependencies:
- scipp==23.07.0
- scippnexus==23.12.1
- scipy==1.12.0

# docs and tests
- sciline==24.01.1
3 changes: 3 additions & 0 deletions .buildconfig/ci-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ dependencies:
- scipp==23.07.0
- scippnexus==23.12.1
- scipy==1.12.0

# docs and tests
- sciline==24.01.1
149 changes: 7 additions & 142 deletions docs/api-reference/chopper-cascade.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"source": [
"## Example: WFM chopper cascade\n",
"\n",
"As an example, consider the WFM chopper cascade from [the tof package documentation](https://tof.readthedocs.io/en/stable/short-example.html):"
"As an example, consider the WFM chopper cascade from [the tof package documentation](https://tof.readthedocs.io/en/stable/short-example.html).\n",
"The choppers are defined in the `fakes` module of the `tof` package:"
]
},
{
Expand All @@ -30,148 +31,12 @@
"metadata": {},
"outputs": [],
"source": [
"from scippneutron.tof import chopper_cascade\n",
"from scippneutron.tof import chopper_cascade, fakes\n",
"import scipp as sc\n",
"import matplotlib as mpl\n",
"\n",
"mpl.rcParams['figure.dpi'] = 300"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"wfm1 = chopper_cascade.Chopper(\n",
" distance=sc.scalar(6.6, unit='m'),\n",
" time_open=sc.array(\n",
" dims=('cutout',),\n",
" values=[\n",
" -0.000396,\n",
" 0.001286,\n",
" 0.005786,\n",
" 0.008039,\n",
" 0.010133,\n",
" 0.012080,\n",
" 0.013889,\n",
" 0.015571,\n",
" ],\n",
" unit='s',\n",
" ),\n",
" time_close=sc.array(\n",
" dims=('cutout',),\n",
" values=[\n",
" 0.000654,\n",
" 0.002464,\n",
" 0.006222,\n",
" 0.008646,\n",
" 0.010899,\n",
" 0.012993,\n",
" 0.014939,\n",
" 0.016750,\n",
" ],\n",
" unit='s',\n",
" ),\n",
")\n",
"wfm2 = chopper_cascade.Chopper(\n",
" distance=sc.scalar(7.1, unit='m'),\n",
" time_open=sc.array(\n",
" dims=('cutout',),\n",
" values=[\n",
" 0.000654,\n",
" 0.002451,\n",
" 0.006222,\n",
" 0.008645,\n",
" 0.010898,\n",
" 0.012993,\n",
" 0.014940,\n",
" 0.016737,\n",
" ],\n",
" unit='s',\n",
" ),\n",
" time_close=sc.array(\n",
" dims=('cutout',),\n",
" values=[\n",
" 0.001567,\n",
" 0.003641,\n",
" 0.006658,\n",
" 0.009252,\n",
" 0.011664,\n",
" 0.013759,\n",
" 0.015853,\n",
" 0.017927,\n",
" ],\n",
" unit='s',\n",
" ),\n",
")\n",
"frame_overlap_1 = chopper_cascade.Chopper(\n",
" distance=sc.scalar(8.8, unit='m'),\n",
" time_open=sc.array(\n",
" dims=('cutout',),\n",
" values=[\n",
" -0.000139,\n",
" 0.002460,\n",
" 0.006796,\n",
" 0.010020,\n",
" 0.012733,\n",
" 0.015263,\n",
" 0.017718,\n",
" 0.020317,\n",
" ],\n",
" unit='s',\n",
" ),\n",
" time_close=sc.array(\n",
" dims=('cutout',),\n",
" values=[\n",
" 0.000640,\n",
" 0.003671,\n",
" 0.007817,\n",
" 0.011171,\n",
" 0.013814,\n",
" 0.016146,\n",
" 0.018497,\n",
" 0.021528,\n",
" ],\n",
" unit='s',\n",
" ),\n",
")\n",
"frame_overlap_2 = chopper_cascade.Chopper(\n",
" distance=sc.scalar(15.9, unit='m'),\n",
" time_open=sc.array(\n",
" dims=('cutout',),\n",
" values=[\n",
" -0.000306,\n",
" 0.010939,\n",
" 0.016495,\n",
" 0.021733,\n",
" 0.026416,\n",
" 0.030880,\n",
" 0.035409,\n",
" ],\n",
" unit='s',\n",
" ),\n",
" time_close=sc.array(\n",
" dims=('cutout',),\n",
" values=[\n",
" 0.002582,\n",
" 0.014570,\n",
" 0.020072,\n",
" 0.024730,\n",
" 0.029082,\n",
" 0.033316,\n",
" 0.038297,\n",
" ],\n",
" unit='s',\n",
" ),\n",
")\n",
"pulse_overlap = chopper_cascade.Chopper(\n",
" distance=sc.scalar(22.0, unit='m'),\n",
" time_open=sc.array(dims=('cutout',), values=[-0.130952, 0.011905], unit='s'),\n",
" time_close=sc.array(dims=('cutout',), values=[-0.087302, 0.055556], unit='s'),\n",
")\n",
"\n",
"choppers = [wfm1, wfm2, frame_overlap_1, frame_overlap_2, pulse_overlap]"
"mpl.rcParams['figure.dpi'] = 300\n",
"choppers = fakes.wfm_choppers"
]
},
{
Expand All @@ -193,7 +58,7 @@
" wavelength_min=sc.scalar(0.0, unit='angstrom'),\n",
" wavelength_max=sc.scalar(10.0, unit='angstrom'),\n",
")\n",
"frames = frames.chop(choppers)\n",
"frames = frames.chop(choppers.values())\n",
"at_sample = frames.propagate_to(sc.scalar(26.0, unit='m'))\n",
"\n",
"at_sample.draw()"
Expand Down Expand Up @@ -296,7 +161,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.16"
"version": "3.10.12"
}
},
"nbformat": 4,
Expand Down
Loading
Loading