Skip to content

Commit

Permalink
fix: move Beamline and Resolution types to amor module. remove superm…
Browse files Browse the repository at this point in the history
…irror scope
  • Loading branch information
jokasimr committed Oct 25, 2023
1 parent 51bb355 commit d83eea9
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 34 deletions.
6 changes: 3 additions & 3 deletions src/essreflectometry/amor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
)

default_parameters = {
Supermirror[MValue]: sc.scalar(5, unit=sc.units.dimensionless),
Supermirror[CriticalEdge]: 0.022 * sc.Unit('1/angstrom'),
Supermirror[Alpha]: sc.scalar(0.25 / 0.088, unit=sc.units.angstrom),
MValue: sc.scalar(5, unit=sc.units.dimensionless),
CriticalEdge: 0.022 * sc.Unit('1/angstrom'),
Alpha: sc.scalar(0.25 / 0.088, unit=sc.units.angstrom),
BeamSize[Run]: 2.0 * sc.units.mm,
SampleSize[Run]: 10.0 * sc.units.mm,
DetectorSpatialResolution[Run]: 0.0025 * sc.units.m,
Expand Down
3 changes: 2 additions & 1 deletion src/essreflectometry/amor/beamline.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

from ..choppers import make_chopper
from ..logging import log_call
from ..types import BeamlineParams, Run
from ..types import Run
from .types import (
BeamlineParams,
BeamSize,
Chopper1Position,
Chopper2Position,
Expand Down
8 changes: 4 additions & 4 deletions src/essreflectometry/amor/calibrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

# from ..reflectometry import orso
from ..types import CalibratedReference, Histogrammed, Reference
from .types import Alpha, CriticalEdge, MValue, Supermirror
from .types import Alpha, CriticalEdge, MValue


def supermirror_calibration(
data_array: Histogrammed[Reference],
m_value: Supermirror[MValue],
critical_edge: Supermirror[CriticalEdge],
alpha: Supermirror[Alpha],
m_value: MValue,
critical_edge: CriticalEdge,
alpha: Alpha,
) -> CalibratedReference:
"""
Calibrate supermirror measurements
Expand Down
3 changes: 2 additions & 1 deletion src/essreflectometry/amor/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
import scippnexus as snx

from ..logging import get_logger
from ..types import BeamlineParams, Filename, Raw, Run
from ..types import Filename, Raw, Run
from .data import get_path
from .types import BeamlineParams


def _tof_correction(data: sc.DataArray, dim: str = 'tof') -> sc.DataArray:
Expand Down
11 changes: 2 additions & 9 deletions src/essreflectometry/amor/resolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,8 @@
import scipp as sc

from ..tools import fwhm_to_std
from ..types import (
AngularResolution,
QBins,
QData,
QResolution,
Sample,
SampleSizeResolution,
WavelengthResolution,
)
from ..types import QBins, QData, QResolution, Sample
from .types import AngularResolution, SampleSizeResolution, WavelengthResolution


def wavelength_resolution(da: QData[Sample]) -> WavelengthResolution:
Expand Down
19 changes: 12 additions & 7 deletions src/essreflectometry/amor/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,23 @@

from ..types import Run

WavelengthResolution = NewType('WavelengthResolution', sc.Variable)
AngularResolution = NewType('AngularResolution', sc.Variable)
SampleSizeResolution = NewType('SampleSizeResolution', sc.Variable)


class BeamlineParams(sciline.Scope[Run, dict], dict):
"""Parameters describing the beamline"""


# TODO What do they mean?
# Supermirror parameters
MValue = NewType('MValue', str)
CriticalEdge = NewType('CriticalEdge', str)
Alpha = NewType('Alpha', str)
MValue = NewType('MValue', sc.Variable)
CriticalEdge = NewType('CriticalEdge', sc.Variable)
Alpha = NewType('Alpha', sc.Variable)
SupermirrorParameter = TypeVar('SupermirrorParameter', MValue, CriticalEdge, Alpha)


class Supermirror(sciline.Scope[SupermirrorParameter, sc.Variable], sc.Variable):
"""Supermirror parameter scope."""


class SampleRotation(sciline.Scope[Run, sc.Variable], sc.Variable):
"""The rotation of the sample / the reference sample."""

Expand Down
9 changes: 0 additions & 9 deletions src/essreflectometry/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,6 @@ class FootprintCorrected(sciline.Scope[Run, sc.DataArray], sc.DataArray):
"""Experiment data corrected by footprint on sample"""


WavelengthResolution = NewType('WavelengthResolution', sc.Variable)
AngularResolution = NewType('AngularResolution', sc.Variable)
SampleSizeResolution = NewType('SampleSizeResolution', sc.Variable)


class BeamlineParams(sciline.Scope[Run, dict], dict):
"""Parameters describing the beamline"""


SpecularReflectionCoordTransformGraph = NewType(
'SpecularReflectionCoordTransformGraph', dict
)
Expand Down

0 comments on commit d83eea9

Please sign in to comment.