snapred.backend.dao.ingredients package

Submodules

snapred.backend.dao.ingredients.CalibrationMetricsWorkspaceIngredients module

class snapred.backend.dao.ingredients.CalibrationMetricsWorkspaceIngredients.CalibrationMetricsWorkspaceIngredients(*, runNumber: int, version: int | VersionState, focusGroupCalibrationMetrics: FocusGroupMetric, timestamp: float | None = None)

Bases: BaseModel

The CalibrationMetricsWorkspaceIngredients class is designed to encapsulate the essential components required for generating workspaces dedicated to calibration metrics. It includes a calibrationRecord to reference the specific calibration data being analyzed and an optional timestamp to mark the time of workspace generation.

focusGroupCalibrationMetrics: FocusGroupMetric
model_config: ClassVar[ConfigDict] = {}

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

runNumber: int
timestamp: float | None
classmethod validate_timestamp(v: Any)
version: int | VersionState

snapred.backend.dao.ingredients.DiffractionCalibrationIngredients module

class snapred.backend.dao.ingredients.DiffractionCalibrationIngredients.DiffractionCalibrationIngredients(*, runConfig: ~snapred.backend.dao.RunConfig.RunConfig, pixelGroup: ~snapred.backend.dao.state.PixelGroup.PixelGroup, groupedPeakLists: ~typing.List[~snapred.backend.dao.GroupPeakList.GroupPeakList], convergenceThreshold: float = <factory>, peakFunction: ~snapred.meta.mantid.AllowedPeakTypes.SymmetricPeakEnum = <factory>, maxOffset: float = <factory>, maxChiSq: float = <factory>, removeBackground: bool = False)

Bases: BaseModel

The DiffractionCalibrationIngredients class encapsulates all the necessary components for conducting diffraction calibration. It contains a runConfig for the calibration run settings, a pixelGroup specifying the group of pixels under consideration, and a list of groupedPeakLists detailing the peaks identified in each group. Additionally, it defines a convergenceThreshold for calibration accuracy, a peakFunction selected based on system configuration for modeling the peaks, and a maxOffset limit for calibration adjustments.

convergenceThreshold: float
groupedPeakLists: List[GroupPeakList]
maxChiSq: float
maxOffset: float
model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}

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

peakFunction: SymmetricPeakEnum
pixelGroup: PixelGroup
removeBackground: bool
runConfig: RunConfig

snapred.backend.dao.ingredients.GroceryListItem module

class snapred.backend.dao.ingredients.GroceryListItem.GroceryListItem(*, workspaceType: Literal['neutron', 'grouping', 'diffcal', 'diffcal_output', 'diffcal_diagnostic', 'diffcal_table', 'diffcal_mask', 'normalization', 'reduction_pixel_mask'], useLiteMode: bool, loader: Literal['', 'LoadCalibrationWorkspaces', 'LoadNexusMonitors', 'LoadEventNexus', 'LoadGroupingDefinition', 'LoadLiveDataInterval', 'LoadNexus', 'LoadNexusProcessed'] = '', numberTag: int | None = None, runNumber: str | None = None, normCalVersion: int | None = None, diffCalVersion: int | None = None, diffCalFilePath: Path | None = None, timestamp: float | None = None, groupingScheme: str | None = None, unit: Literal['TOF', 'DSP', 'diagnostic'] | None = None, instrumentPropertySource: Literal['InstrumentName', 'InstrumentFilename', 'InstrumentDonor'] | None = None, instrumentSource: str | None = None, liveDataArgs: LiveDataArgs | None = None, keepItClean: bool = True, hidden: bool = False, propertyName: str | None = None, state: str | None = None)

Bases: BaseModel

Holds necessary information for a single item in grocery list

RESERVED_LITE_RUNNUMBER: ClassVar[str] = '000001'
RESERVED_NATIVE_RUNNUMBER: ClassVar[str] = '000000'
builder()
diffCalFilePath: Path | None
diffCalVersion: int | None
groupingScheme: str | None
hidden: bool
instrumentPropertySource: Literal['InstrumentName', 'InstrumentFilename', 'InstrumentDonor'] | None
instrumentSource: str | None
keepItClean: bool
liveDataArgs: LiveDataArgs | None
loader: Literal['', 'LoadCalibrationWorkspaces', 'LoadNexusMonitors', 'LoadEventNexus', 'LoadGroupingDefinition', 'LoadLiveDataInterval', 'LoadNexus', 'LoadNexusProcessed']
model_config: ClassVar[ConfigDict] = {}

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

normCalVersion: int | None
numberTag: int | None
propertyName: str | None
runNumber: str | None
state: str | None
timestamp: float | None
unit: Literal['TOF', 'DSP', 'diagnostic'] | None
useLiteMode: bool
classmethod validate_ingredients_for_groceries(v: Any)
workspaceType: Literal['neutron', 'grouping', 'diffcal', 'diffcal_output', 'diffcal_diagnostic', 'diffcal_table', 'diffcal_mask', 'normalization', 'reduction_pixel_mask']
class snapred.backend.dao.ingredients.GroceryListItem.LiveDataArgs(duration)

Bases: tuple

duration: timedelta

Alias for field number 0

snapred.backend.dao.ingredients.NormalizationIngredients module

class snapred.backend.dao.ingredients.NormalizationIngredients.NormalizationIngredients(*, pixelGroup: PixelGroup, calibrantSample: CalibrantSample, detectorPeaks: List[GroupPeakList])

Bases: BaseModel

Class to hold the ingredients necessary for normalization calibration workflow

calibrantSample: CalibrantSample
detectorPeaks: List[GroupPeakList]
model_config: ClassVar[ConfigDict] = {}

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

pixelGroup: PixelGroup

snapred.backend.dao.ingredients.PeakIngredients module

class snapred.backend.dao.ingredients.PeakIngredients.PeakIngredients(*, instrumentState: InstrumentState, crystalInfo: CrystallographicInfo, pixelGroup: PixelGroup, peakIntensityThreshold: float)

Bases: BaseModel

Class to hold the ingredients for various peak manipulation algorithms

crystalInfo: CrystallographicInfo
instrumentState: InstrumentState
model_config: ClassVar[ConfigDict] = {}

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

peakIntensityThreshold: float
pixelGroup: PixelGroup

snapred.backend.dao.ingredients.PixelGroupingIngredients module

class snapred.backend.dao.ingredients.PixelGroupingIngredients.PixelGroupingIngredients(*, instrumentState: ~snapred.backend.dao.state.InstrumentState.InstrumentState, groupingScheme: str | None = None, nBinsAcrossPeakWidth: int = <factory>)

Bases: BaseModel

Class to hold the ingredients necessary for pixel grouping parameter calculation.

groupingScheme: str | None
instrumentState: InstrumentState
model_config: ClassVar[ConfigDict] = {}

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

nBinsAcrossPeakWidth: int

snapred.backend.dao.ingredients.ReductionIngredients module

class snapred.backend.dao.ingredients.ReductionIngredients.ReductionIngredients(*, runNumber: str, useLiteMode: bool, timestamp: float, pixelGroups: List[PixelGroup], unmaskedPixelGroups: List[PixelGroup], detectorPeaksMany: List[List[GroupPeakList]] | None = None, smoothingParameter: float | None, calibrantSamplePath: str | None, peakIntensityThreshold: float | None, keepUnfocused: bool, isDiagnostic: bool = True, convertUnitsTo: str, artificialNormalizationIngredients: ArtificialNormalizationIngredients | None = None)

Bases: BaseModel

Data class to hold the ingredients for each subrecipe of reduction and itself

applyNormalization(groupingIndex: int) ApplyNormalizationIngredients
artificialNormalizationIngredients: ArtificialNormalizationIngredients | None
calibrantSamplePath: str | None
convertUnitsTo: str
detectorPeaksMany: List[List[GroupPeakList]] | None
effectiveInstrument(groupingIndex: int) EffectiveInstrumentIngredients
generateFocussedVanadium(groupingIndex: int) GenerateFocussedVanadiumIngredients
getDetectorPeaks(groupingIndex: int) List[GroupPeakList]
groupProcessing(groupingIndex: int) ReductionGroupProcessingIngredients
isDiagnostic: bool
keepUnfocused: bool
model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'strict': True}

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

peakIntensityThreshold: float | None
pixelGroups: List[PixelGroup]
preprocess() PreprocessReductionIngredients
runNumber: str
smoothingParameter: float | None
timestamp: float
unmaskedPixelGroups: List[PixelGroup]
useLiteMode: bool

Module contents