diff --git a/docs/examples/amor.ipynb b/docs/examples/amor.ipynb index f45e4f5..37b5778 100644 --- a/docs/examples/amor.ipynb +++ b/docs/examples/amor.ipynb @@ -20,8 +20,7 @@ "import scipp as sc\n", "import sciline\n", "from essreflectometry.amor import providers, default_parameters\n", - "from essreflectometry.types import *\n", - "from essreflectometry.amor.types import SampleRotation" + "from essreflectometry.types import *" ] }, { diff --git a/src/essreflectometry/amor/__init__.py b/src/essreflectometry/amor/__init__.py index c19a7e6..8e15ff7 100644 --- a/src/essreflectometry/amor/__init__.py +++ b/src/essreflectometry/amor/__init__.py @@ -6,7 +6,15 @@ import scipp as sc from .. import providers as reflectometry_providers -from ..types import Run +from ..types import ( + Alpha, + BeamSize, + CriticalEdge, + DetectorSpatialResolution, + Gravity, + MValue, + SampleSize, +) from . import beamline, calibrations, conversions, load, normalize, resolution from .beamline import instrument_view_components from .instrument_view import instrument_view diff --git a/src/essreflectometry/amor/beamline.py b/src/essreflectometry/amor/beamline.py index d8a1b43..30479b8 100644 --- a/src/essreflectometry/amor/beamline.py +++ b/src/essreflectometry/amor/beamline.py @@ -4,18 +4,20 @@ from ..choppers import make_chopper from ..logging import log_call -from ..types import Run +from ..types import ( + BeamSize, + DetectorSpatialResolution, + Gravity, + Run, + SampleRotation, + SampleSize, +) from .types import ( BeamlineParams, - BeamSize, Chopper1Position, Chopper2Position, ChopperFrequency, ChopperPhase, - DetectorSpatialResolution, - Gravity, - SampleRotation, - SampleSize, ) diff --git a/src/essreflectometry/amor/calibrations.py b/src/essreflectometry/amor/calibrations.py index cfa44e4..f6a3e94 100644 --- a/src/essreflectometry/amor/calibrations.py +++ b/src/essreflectometry/amor/calibrations.py @@ -3,8 +3,14 @@ import scipp as sc # from ..reflectometry import orso -from ..types import CalibratedReference, Histogrammed, Reference -from .types import Alpha, CriticalEdge, MValue +from ..types import ( + Alpha, + CalibratedReference, + CriticalEdge, + Histogrammed, + MValue, + Reference, +) def supermirror_calibration( diff --git a/src/essreflectometry/amor/types.py b/src/essreflectometry/amor/types.py index d58dc61..01627a2 100644 --- a/src/essreflectometry/amor/types.py +++ b/src/essreflectometry/amor/types.py @@ -1,4 +1,4 @@ -from typing import NewType, TypeVar +from typing import NewType import sciline import scipp as sc @@ -14,35 +14,6 @@ class BeamlineParams(sciline.Scope[Run, dict], dict): """Parameters describing the beamline""" -# TODO What do they mean? -# Supermirror parameters -MValue = NewType('MValue', sc.Variable) -CriticalEdge = NewType('CriticalEdge', sc.Variable) -Alpha = NewType('Alpha', sc.Variable) -SupermirrorParameter = TypeVar('SupermirrorParameter', MValue, CriticalEdge, Alpha) - - -class SampleRotation(sciline.Scope[Run, sc.Variable], sc.Variable): - """The rotation of the sample / the reference sample.""" - - -class BeamSize(sciline.Scope[Run, sc.Variable], sc.Variable): - """FWHM of the neutron beam.""" - - -class DetectorSpatialResolution(sciline.Scope[Run, sc.Variable], sc.Variable): - # TODO - """Don't know what this is.""" - - -class SampleSize(sciline.Scope[Run, sc.Variable], sc.Variable): - # TODO is this radius or total length? - """Size of the sample.""" - - -Gravity = NewType('Gravity', sc.Variable) - - class ChopperFrequency(sciline.Scope[Run, sc.Variable], sc.Variable): """Frequency of the choppers used in the run.""" diff --git a/src/essreflectometry/types.py b/src/essreflectometry/types.py index 5c369cf..6b857fa 100644 --- a/src/essreflectometry/types.py +++ b/src/essreflectometry/types.py @@ -24,9 +24,6 @@ class QData(sciline.Scope[Run, sc.DataArray], sc.DataArray): """Theta data transformed to momentum transfer""" -QResolution = NewType('QResolution', sc.Variable) - - class FootprintCorrected(sciline.Scope[Run, sc.DataArray], sc.DataArray): """Experiment data corrected by footprint on sample""" @@ -47,6 +44,7 @@ class Normalized(sciline.Scope[Run, sc.DataArray], sc.DataArray): NormalizedIofQ = NewType('NormalizedIofQ', sc.DataArray) +QResolution = NewType('QResolution', sc.Variable) ''' Parameters for the workflow ''' @@ -56,3 +54,32 @@ class Normalized(sciline.Scope[Run, sc.DataArray], sc.DataArray): class Filename(sciline.Scope[Run, str], str): """Filename of the raw data""" + + +# TODO What do they mean? +# Supermirror parameters +MValue = NewType('MValue', sc.Variable) +CriticalEdge = NewType('CriticalEdge', sc.Variable) +Alpha = NewType('Alpha', sc.Variable) +SupermirrorParameter = TypeVar('SupermirrorParameter', MValue, CriticalEdge, Alpha) + + +class SampleRotation(sciline.Scope[Run, sc.Variable], sc.Variable): + """The rotation of the sample / the reference sample.""" + + +class BeamSize(sciline.Scope[Run, sc.Variable], sc.Variable): + """FWHM of the neutron beam.""" + + +class DetectorSpatialResolution(sciline.Scope[Run, sc.Variable], sc.Variable): + # TODO + """Don't know what this is.""" + + +class SampleSize(sciline.Scope[Run, sc.Variable], sc.Variable): + # TODO is this radius or total length? + """Size of the sample.""" + + +Gravity = NewType('Gravity', sc.Variable)