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

Make facility information for accessible #68

Merged
merged 3 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
20 changes: 18 additions & 2 deletions src/tof/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2023 Scipp contributors (https://github.com/scipp)

# flake8: noqa F401

from .chopper import AntiClockwise, Chopper, ChopperReading, Clockwise
from .detector import Detector, DetectorReading
from .facilities import library as facilities
from .model import Model
from .reading import ComponentReading, ReadingData, ReadingField
from .result import Result
from .source import Source, SourceParameters

__all__ = [
'AntiClockwise',
'Chopper',
'ChopperReading',
'Clockwise',
'ComponentReading',
'Detector',
'DetectorReading',
'facilities',
'Model',
'ReadingData',
'ReadingField',
'Result',
'Source',
'SourceParameters',
]
6 changes: 4 additions & 2 deletions src/tof/facilities/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2023 Scipp contributors (https://github.com/scipp)

# flake8: noqa F401
from .ess_pulse import pulse as esspulse

from .ess_pulse import pulse as ess
library = {'ess': esspulse}

__all__ = ['library']
5 changes: 5 additions & 0 deletions src/tof/facilities/ess_pulse.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2023 Scipp contributors (https://github.com/scipp)

"""
The data here was obtained from the McStas model of the ESS moderator.
See https://www2.mcstas.org/download/components/3.4_current/sources/ESS_butterfly.html.
"""

import scipp as sc

from ..utils import FacilityPulse
Expand Down
4 changes: 2 additions & 2 deletions src/tof/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import scipp as sc
from scipp.scipy.interpolate import interp1d

from . import facilities
from .facilities import library as facilities
from .utils import Plot, wavelength_to_speed

TIME_UNIT = "us"
Expand Down Expand Up @@ -208,7 +208,7 @@ def __init__(
self.data = None

if facility is not None:
facility_params = getattr(facilities, self.facility)
facility_params = facilities[self.facility]
Copy link
Member

Choose a reason for hiding this comment

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

👍

self.frequency = facility_params.frequency
pulse_params = _make_pulses(
neutrons=self.neutrons,
Expand Down
Loading