Skip to content

Commit

Permalink
Merge pull request #68 from scipp/make-facilities-accessible
Browse files Browse the repository at this point in the history
Make facility information for accessible
  • Loading branch information
nvaytet authored Jan 8, 2025
2 parents 3c9f8b2 + 57d6198 commit 83feba7
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
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]
self.frequency = facility_params.frequency
pulse_params = _make_pulses(
neutrons=self.neutrons,
Expand Down

0 comments on commit 83feba7

Please sign in to comment.