snapred.backend.dao.state package

Subpackages

Submodules

snapred.backend.dao.state.DetectorState module

class snapred.backend.dao.state.DetectorState.DetectorState(*, PVs: dict[str, Any], stateId: ObjectSHA | None)

Bases: BaseModel

LEGACY_SCHEMA: ClassVar[Dict[str, Any]] = {'derivedPVs': {'deltaTheta': {'items': [[[_LegacyGuideStatePos.IN], 0.0064], [[_LegacyGuideStatePos.OUT], 0.002]], 'keyPVs': ['BL3:Mot:OpticsPos:Pos']}}, 'length': 16, 'properties': {'BL3:Chop:Skf1:WavelengthUserReq': {'alias': 'WavelengthUserReq', 'resolution': 0.1, 'type': 'number'}, 'BL3:Det:TH:BL:Frequency': {'alias': 'Frequency', 'type': 'integer'}, 'BL3:Mot:OpticsPos:Pos': {'alias': 'Pos', 'type': 'integer'}, 'det_arc1': {'alias': 'vdet_arc1', 'resolution': 0.5, 'type': 'number'}, 'det_arc2': {'alias': 'vdet_arc2', 'resolution': 0.5, 'type': 'number'}, 'det_lin1': {'ignore': True, 'type': 'number'}, 'det_lin2': {'ignore': True, 'type': 'number'}}, 'required': ['det_arc1', 'det_arc2', 'BL3:Chop:Skf1:WavelengthUserReq', 'BL3:Det:TH:BL:Frequency', 'BL3:Mot:OpticsPos:Pos', 'det_lin1', 'det_lin2'], 'type': 'object', 'use_legacy_rounding': True}
PVs: dict[str, Any]
classmethod SHA(PVs: Dict[str, Any], schema: Dict[str, Any]) ObjectSHA
property arc: Tuple[float, float]
property freq: float
classmethod fromPVLogs(logs: Mapping[str, Any], schema: Dict[str, Any]) DetectorState
property guideStat: int
items() Iterable[Tuple[str, Any]]
keys() Iterable
len() int
property lin: Tuple[float, float]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

pvLogsKey(PVs: Iterable[str], schema: Dict[str, Any]) Tuple[Any, ...]
roundedPVForState(PV: str, schema: Dict[str, Any]) Any
stateId: ObjectSHA | None
toPVLogs() Dict[str, Any]
values() Iterable[Any]
property wav: float

snapred.backend.dao.state.DiffractionCalibrant module

class snapred.backend.dao.state.DiffractionCalibrant.DiffractionCalibrant(*, runNumber: str, filename: str, diffCalPath: str, name: str | None = None, latticeParameters: str | None = None, reference: str | None = None, crystallographicInfo: CrystallographicInfo | None = None, fSquaredThreshold: float | None = None)

Bases: BaseModel

crystallographicInfo: CrystallographicInfo | None
diffCalPath: str
fSquaredThreshold: float | None
filename: str
latticeParameters: str | None
model_config: ClassVar[ConfigDict] = {'strict': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str | None
reference: str | None
runNumber: str

snapred.backend.dao.state.FocusGroup module

class snapred.backend.dao.state.FocusGroup.FocusGroup(*, name: str, definition: str)

Bases: BaseModel

definition: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str

snapred.backend.dao.state.GroupingMap module

class snapred.backend.dao.state.GroupingMap.GroupingMap(*, stateId: ObjectSHA | str, nativeFocusGroups: List[FocusGroup] = None, liteFocusGroups: List[FocusGroup] = None)

Bases: BaseModel

classmethod calibrationGroupingHome() Path
coerceStateId(stateId: ObjectSHA)
defaultStateId: ClassVar[ObjectSHA] = ObjectSHA(hex='aabbbcccdddeeeff', decodedKey=None)
getMap(useLiteMode: bool) Dict[str, FocusGroup]
property isDefault
property isDirty: bool
property lite: Dict[str, FocusGroup]
liteFocusGroups: List[FocusGroup]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context: Any, /) None

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Args:

self: The BaseModel instance. context: The context.

property native: Dict[str, FocusGroup]
nativeFocusGroups: List[FocusGroup]
setDirty(flag: bool)
stateId: ObjectSHA | str
classmethod str_to_ObjectSHA(v: Any) ObjectSHA
validate_GroupingMap()

snapred.backend.dao.state.InstrumentConfig module

class snapred.backend.dao.state.InstrumentConfig.InstrumentConfig(*, version: int | ~snapred.backend.dao.indexing.Versioning.VersionState, indexEntry: ~snapred.backend.dao.indexing.IndexEntry.IndexEntry, facility: str, bandwidth: float, maxBandwidth: float, L1: float, L2: float, delTOverT: float, delLOverL: float, width: float, frequency: float, lowWavelengthCrop: float = <factory>, name: str | None = None, nexusFileExtension: str | None = None, nexusFilePrefix: str | None = None, calibrationFileExtension: str | None = None, calibrationFilePrefix: str | None = None, calibrationDirectory: str | None = None, pixelGroupingDirectory: str | None = None, sharedDirectory: str | None = None, nexusDirectory: str | None = None, reducedDataDirectory: str | None = None, reductionRecordDirectory: str | None = None, cycle: ~snapred.backend.dao.state.Cycle.Cycle | None = None, stateIdSchema: ~typing.Dict[str, ~typing.Any] = {'derivedPVs': {'deltaTheta': {'items': [[[_LegacyGuideStatePos.IN], 0.0064], [[_LegacyGuideStatePos.OUT], 0.002]], 'keyPVs': ['BL3:Mot:OpticsPos:Pos']}}, 'length': 16, 'properties': {'BL3:Chop:Skf1:WavelengthUserReq': {'alias': 'WavelengthUserReq', 'resolution': 0.1, 'type': 'number'}, 'BL3:Det:TH:BL:Frequency': {'alias': 'Frequency', 'type': 'integer'}, 'BL3:Mot:OpticsPos:Pos': {'alias': 'Pos', 'type': 'integer'}, 'det_arc1': {'alias': 'vdet_arc1', 'resolution': 0.5, 'type': 'number'}, 'det_arc2': {'alias': 'vdet_arc2', 'resolution': 0.5, 'type': 'number'}, 'det_lin1': {'ignore': True, 'type': 'number'}, 'det_lin2': {'ignore': True, 'type': 'number'}}, 'required': ['det_arc1', 'det_arc2', 'BL3:Chop:Skf1:WavelengthUserReq', 'BL3:Det:TH:BL:Frequency', 'BL3:Mot:OpticsPos:Pos', 'det_lin1', 'det_lin2'], 'type': 'object', 'use_legacy_rounding': True}, **extra_data: ~typing.Any)

Bases: IndexedObject

Class to hold the instrument parameters.

L1: float
L2: float
bandwidth: float
calibrationDirectory: str | None

Read-only data descriptor used to emit a runtime deprecation warning before accessing a deprecated field.

Attributes:

msg: The deprecation message to be emitted. wrapped_property: The property instance if the deprecated field is a computed field, or None. field_name: The name of the field being deprecated.

calibrationFileExtension: str | None

Read-only data descriptor used to emit a runtime deprecation warning before accessing a deprecated field.

Attributes:

msg: The deprecation message to be emitted. wrapped_property: The property instance if the deprecated field is a computed field, or None. field_name: The name of the field being deprecated.

calibrationFilePrefix: str | None

Read-only data descriptor used to emit a runtime deprecation warning before accessing a deprecated field.

Attributes:

msg: The deprecation message to be emitted. wrapped_property: The property instance if the deprecated field is a computed field, or None. field_name: The name of the field being deprecated.

cycle: Cycle | None
delLOverL: float
delTOverT: float
derivedPV(name: str, detectorState: DetectorState) Any
facility: str
frequency: float
lowWavelengthCrop: float
maxBandwidth: float
model_config: ClassVar[ConfigDict] = {'extra': 'allow', 'strict': True, 'validate_assignment': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context: Any, /) None

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Args:

self: The BaseModel instance. context: The context.

name: str | None

Read-only data descriptor used to emit a runtime deprecation warning before accessing a deprecated field.

Attributes:

msg: The deprecation message to be emitted. wrapped_property: The property instance if the deprecated field is a computed field, or None. field_name: The name of the field being deprecated.

nexusDirectory: str | None

Read-only data descriptor used to emit a runtime deprecation warning before accessing a deprecated field.

Attributes:

msg: The deprecation message to be emitted. wrapped_property: The property instance if the deprecated field is a computed field, or None. field_name: The name of the field being deprecated.

nexusFileExtension: str | None

Read-only data descriptor used to emit a runtime deprecation warning before accessing a deprecated field.

Attributes:

msg: The deprecation message to be emitted. wrapped_property: The property instance if the deprecated field is a computed field, or None. field_name: The name of the field being deprecated.

nexusFilePrefix: str | None

Read-only data descriptor used to emit a runtime deprecation warning before accessing a deprecated field.

Attributes:

msg: The deprecation message to be emitted. wrapped_property: The property instance if the deprecated field is a computed field, or None. field_name: The name of the field being deprecated.

pixelGroupingDirectory: str | None

Read-only data descriptor used to emit a runtime deprecation warning before accessing a deprecated field.

Attributes:

msg: The deprecation message to be emitted. wrapped_property: The property instance if the deprecated field is a computed field, or None. field_name: The name of the field being deprecated.

reducedDataDirectory: str | None

Read-only data descriptor used to emit a runtime deprecation warning before accessing a deprecated field.

Attributes:

msg: The deprecation message to be emitted. wrapped_property: The property instance if the deprecated field is a computed field, or None. field_name: The name of the field being deprecated.

reductionRecordDirectory: str | None

Read-only data descriptor used to emit a runtime deprecation warning before accessing a deprecated field.

Attributes:

msg: The deprecation message to be emitted. wrapped_property: The property instance if the deprecated field is a computed field, or None. field_name: The name of the field being deprecated.

sharedDirectory: str | None

Read-only data descriptor used to emit a runtime deprecation warning before accessing a deprecated field.

Attributes:

msg: The deprecation message to be emitted. wrapped_property: The property instance if the deprecated field is a computed field, or None. field_name: The name of the field being deprecated.

stateIdSchema: Dict[str, Any]
width: float

snapred.backend.dao.state.InstrumentState module

class snapred.backend.dao.state.InstrumentState.InstrumentState(*, id: ObjectSHA, instrumentConfig: InstrumentConfig, detectorState: DetectorState, gsasParameters: GSASParameters, particleBounds: ParticleBounds, defaultGroupingSliceValue: float, fwhmMultipliers: Pair[float], peakTailCoefficient: float)

Bases: BaseModel

defaultGroupingSliceValue: float
property deltaTheta: float
detectorState: DetectorState
fwhmMultipliers: Pair[float]
gsasParameters: GSASParameters
id: ObjectSHA
instrumentConfig: InstrumentConfig
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

particleBounds: ParticleBounds
peakTailCoefficient: float
classmethod str_to_ObjectSHA(v: Any) Any
classmethod validate_fwhmMultipliers(v: Any) Pair[float]

snapred.backend.dao.state.NormalizationCalibrant module

class snapred.backend.dao.state.NormalizationCalibrant.NormalizationCalibrant(*, numAnnuli: int, numSlices: int | None = None, attenuationCrossSection: float, attenuationHeight: float, geometry: str | None = None, FWHM: List[List[int]], mask: str, material: str | None = None, peaks: List[float], radius: float, sampleNumberDensity: float, scatteringCrossSection: float, smoothPoints: int, calibrationState: str | None = None)

Bases: BaseModel

FWHM: List[List[int]]
attenuationCrossSection: float
attenuationHeight: float
calibrationState: str | None
geometry: str | None
mask: str
material: str | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

numAnnuli: int
numSlices: int | None
peaks: List[float]
radius: float
sampleNumberDensity: float
scatteringCrossSection: float
smoothPoints: int

snapred.backend.dao.state.PixelGroup module

class snapred.backend.dao.state.PixelGroup.PixelGroup(*, pixelGroupingParameters: ~typing.List[~snapred.backend.dao.state.PixelGroupingParameters.PixelGroupingParameters] | ~typing.Dict[int, ~snapred.backend.dao.state.PixelGroupingParameters.PixelGroupingParameters] = {}, nBinsAcrossPeakWidth: int = <factory>, focusGroup: ~snapred.backend.dao.state.FocusGroup.FocusGroup, timeOfFlight: ~snapred.backend.dao.Limit.BinnedValue[float], binningMode: ~snapred.backend.dao.state.PixelGroup.PixelGroup.BinningMode = BinningMode.LOG)

Bases: BaseModel

class BinningMode(value)

Bases: IntEnum

LINEAR = 1
LOG = -1
property L2: List[float]
property azimuth: List[float]
binningMode: BinningMode
dBin() List[float]
dMax() List[float]
dMin() List[float]
property dRelativeResolution: List[float]
property dResolution: List[Limit[float]]
focusGroup: FocusGroup
property groupIDs: List[int]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

nBinsAcrossPeakWidth: int
pixelGroupingParameters: List[PixelGroupingParameters] | Dict[int, PixelGroupingParameters]
timeOfFlight: BinnedValue[float]
property twoTheta: List[float]
classmethod validate_TOF(v)
classmethod validate_pixelGroupingParameters(pgps: List[PixelGroupingParameters] | Dict[int, PixelGroupingParameters])

snapred.backend.dao.state.PixelGroupingParameters module

class snapred.backend.dao.state.PixelGroupingParameters.PixelGroupingParameters(*, groupID: int, isMasked: bool = False, L2: float, twoTheta: Annotated[float, Ge(ge=0.0), Le(le=6.283185307179586)], azimuth: Annotated[float, Ge(ge=-3.141592653589793), Le(le=3.141592653589793)], dResolution: Limit[float], dRelativeResolution: Annotated[float, Gt(gt=0)])

Bases: BaseModel

L2: float
azimuth: float
dRelativeResolution: float
dResolution: Limit[float]
groupID: int
isMasked: bool

Read-only data descriptor used to emit a runtime deprecation warning before accessing a deprecated field.

Attributes:

msg: The deprecation message to be emitted. wrapped_property: The property instance if the deprecated field is a computed field, or None. field_name: The name of the field being deprecated.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

twoTheta: float
classmethod validate_resolution_type(v)

Module contents