Skip to content

Tofectomy for esssans#250

Merged
nvaytet merged 21 commits intomainfrom
tofectomy-esssans
Mar 27, 2026
Merged

Tofectomy for esssans#250
nvaytet merged 21 commits intomainfrom
tofectomy-esssans

Conversation

@nvaytet
Copy link
Copy Markdown
Member

@nvaytet nvaytet commented Mar 25, 2026

Needed after scipp/ess#65

See some comments below that walk a little through the more confusing changes.

@nvaytet nvaytet requested a review from SimonHeybrock March 26, 2026 13:41
@nvaytet nvaytet marked this pull request as ready for review March 26, 2026 13:41
@@ -0,0 +1,187 @@
# SPDX-License-Identifier: BSD-3-Clause
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved the stuff about larmor into a separate file, to leave the loki workflow cleaner.

source_position=source_position,
gravity=gravity,
)
return ElasticCoordTransformGraph[RunType]({**graph, **tof.elastic_Q('tof')})
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this is new in the workflow submodule (was not in the old workflow.py file. We put the functions from the tof graph back in, as a tof was recorded in the files at Larmor (short pulse source).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the reference solutions: the data values and variances have remained identical. However, some coordinates pertaining to positions (L1, source_position, sample_position...) are no longer present in the final result. We have Q and wavelength, and this is probably the way it should be.

If we want to add contributions from different measurements, we should no longer care about these positions once we are in Q-space.

direct_beam: CleanDirectBeam,
uncertainties: UncertaintyBroadcastMode,
) -> WavelengthDetector[RunType, Denominator]:
) -> DetectorTerm[RunType, Denominator]:
Copy link
Copy Markdown
Member

@SimonHeybrock SimonHeybrock Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So in summary we have:

  • Old: RawDetector->TofDetector->CorrectedDetector->WavelengthDetector
  • New: RawDetector->WavelengthDetector->CorrectedDetector->DetectorTerm

That is:

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is correct.
Screenshot_20260327_091452

Comment thread src/ess/sans/workflow.py
SANS workflow as a sciline.Pipeline
"""
workflow = GenericTofWorkflow(
workflow = GenericUnwrapWorkflow(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest, I would have just kept the GenericTofWorkflow - we are still at a TOF neutron source after all.

Copy link
Copy Markdown
Member Author

@nvaytet nvaytet Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really mind, others also suggested other names.
But this is quite late at this point. Would have been easier to pick a different name earlier.

I'm thinking maybe we don't need the "Generic" in there if we don't want the name to become too long.
So it could become something like ComputeWavelengthWorkflow? Or Just WavelengthWorkflow.

I could change the name, and then keep GenericUnwrapWorkflow for a while as an alias. And phase it out later once we've updated the other packages, so that we don't break everything again.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really care.

we are still at a TOF neutron source after all.

Does this mean we also need LokiTofWorkflow and OdinTofWorkflow? I think it's enough that the class is defined in an 'ess' package.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would keep LokiWorkflow and OdinWorkflow, as they will always want to compute wavelength.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In any case, the naming cannot be changed in this PR, it needs to be done first in essreduce.

Comment thread src/ess/sans/types.py
Comment on lines +38 to +40
LookupTableRelativeErrorThreshold = unwrap_t.LookupTableRelativeErrorThreshold
LookupTableFilename = unwrap_t.LookupTableFilename
LookupTable = unwrap_t.LookupTable
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems a bit odd to import these unqualified "LookupTable" types directly into the top-level (types module).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you would just import unwrap and then have

from ess.sans.types import unwrap

unwrap.LookupTable

?
I can do that.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But maybe that is confusing because our visualize() currently strips module names from type names.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jokasimr suggested it should be called WavelengthLookupTable.
I argued that unwrap.LookupTable was descriptive enough.
But yes, it does just show up as LookupTable in the visualization.

I don't mind revisiting the naming.

@nvaytet nvaytet merged commit 9884e9b into main Mar 27, 2026
4 checks passed
@nvaytet nvaytet deleted the tofectomy-esssans branch March 27, 2026 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants