scipp / scipp/ess

Consider loading detectors and analyzers in a single provider each

Open
#567 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

essspectroscopy
Dominant language
Python
Stars
1
Forks
3
Avg merge
2d 11h
Merged PRs (30d)
17

Description

Currently, we load all detectors, detector data, and analyzers individually. This means that we have 45*3 distinct file accesses. This is useful when we only want to load a small subset of detectors. But it also causes problems:

  • When using a threaded scheduler, there is high contention on the file which slows down the pipeline significantly. It is slower than a single threaded scheduler.
  • The pipeline graph is very large and unreadable for all 45 detectors.
  • We have to determine and specify the list of detector names when creating the workflow.

We keep the detectors separate for a bit but merge them all into a single data array eventually. I think we can fix all 3 issues by never even mapping the pipeline over detector names. We would have a provider similar to this:

DetectorNames[RunType] = list[DetectorName[RunType] | None

def load_all_detectors(
    location: NeXusAllComponentLocationSpec[NXdetector, RunType],
    detector_names: DetectorNames[RunType],
) -> NeXusComponent[NXdetector, RunType]: ...

where DetectorNames[RunType] defaults to None which means 'load all NXdetectors'. And similarly for analyzers and detector events.

This would still allow us to selectively load detectors but would simplify the normal case of loading all detectors. It would also reduce the size of the pipeline and would strongly reduce contention on the file.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the current detector, detector-data, analyzer, and detector-event providers and the workflow construction that maps over detector names. Compare that structure with the proposed single-provider interfaces and verify that selective loading still works while the all-detectors case reduces file accesses, pipeline size, and threaded contention.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-engineering, performance
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.