ewoksid02.tasks.normalizationtask.NormalizationTask#
- class ewoksid02.tasks.normalizationtask.NormalizationTask(inputs=None, varinfo=None, node_id=None, node_attrs=None, execinfo=None, profile_directory=None)[source]#
Bases:
ID02ProcessingTaskThe NormalizationTask class is responsible for normalizing datasets in the ID02 SAXS pipeline. It extends the ID02ProcessingTask class and provides additional functionality to apply a standard pyFAI normalization: - Methods to read monitor values from the metadata file or from blissdata - Methods to read normalization parameters from the metadata file or from the headers - Methods to cache pyFAI azimuthal integrator and apply normalization - Applies corrections such as masking, dark frame subtraction, flat field correction, and polarization adjustments.
- Optional Inputs:
filename_mask_normalization (str): Path to the mask file for correcting detector gaps or bad pixels.
filename_dark_normalization (str): Path to the file for dark current correction.
filename_flat_normalization (str): Path to the file for flat field correction.
Dummy (float): Value to replace invalid pixels in the dataset.
DDummy (float): Tolerance for dummy pixel replacement.
NormalizationFactor (float): Factor for normalizing the dataset.
polarization_factor (float): Factor for polarization correction.
polarization_axis_offset (float): Axis for polarization correction.
Center_1 (float): Beam center in the first dimension.
Center_2 (float): Beam center in the second dimension.
PSize_1 (float): Pixel size 1.
PSize_2 (float): Pixel size 2.
BSize_1 (float): Pixel binning 1.
BSize_2 (float): Pixel binning 2.
SampleDistance (float): Sample to detector distance in meters.
WaveLength (float): Wavelength of beam in meters.
DetectorRotation_1 (float): rot2 of pyFAI.
DetectorRotation_2 (float): rot1 of pyFAI.
DetectorRotation_3 (float): rot3 of pyFAI.
pin_monitor (str): Pin to the monitor stream.
header_pin_monitor (str): Header key used to monitor values.
variance_formula (str): Formula for calculating variance in the dataset.
algorithm_normalization (str): Implementation to perform the normalization (cython or cupy).
dark_filter (str): Filter to use in case the dark-current file is a multi-frame scan file.
dark_filter_quantil_lower (str): In case the dark_filter is quantil, lower limit.
dark_filter_quantil_upper (str): In case the dark_filter is quantil, upper limit.
- Parameters:
inputs (
Optional[Mapping])varinfo (
Optional[dict])node_id (
Union[str,int,tuple,None])node_attrs (
Optional[dict])execinfo (
Optional[dict])profile_directory (
Optional[dict])
- MISSING_DATA = <MISSING_DATA>#
- assert_ready_to_execute()#
- cancel()#
Function called when a task is cancelled. To be implemented by the derived classes
- property cancelled: bool#
Return True if the task has been cancelled by the user
- classmethod class_nonce()#
- classmethod class_nonce_data()#
- classmethod class_registry_name()#
- Return type:
Optional[str]
- cleanup_references()#
Removes all references to the inputs. Side effect: fixes the uhash of the task and outputs
- create_id02_processed_file(filename)#
- Parameters:
filename (
str)
- property done: bool#
Completed (with or without exception)
- property exception: Exception | None#
- execute(force_rerun=False, raise_on_error=True, cleanup_references=False)#
- Parameters:
force_rerun (
Optional[bool])raise_on_error (
Optional[bool])cleanup_references (
Optional[bool])
- property failed: bool#
Completed with exception
- fix_uhash()#
Fix the uhash when it is derived from the uhash data.
- get_HS32C_array()#
- get_HS32V_array()#
- get_exposuretime_values()#
- Return type:
tuple
- get_input_uhashes()#
- get_input_value(key, default=<MISSING_DATA>)#
- Parameters:
default (
Any)- Return type:
Any
- get_input_values()#
- get_memory_info()#
- get_monitor_1_values()[source]#
Generic method to read monitor_values online (from blissdata streams) or offline (from a group in the scalers file)
- get_named_input_values()#
- get_output_transfer_data()#
The values are either DataUri or Variable
- get_output_uhashes()#
- get_output_value(key, default=<MISSING_DATA>)#
- Parameters:
default (
Any)- Return type:
Any
- get_output_values()#
- get_parameter(key, to_integer=False, default=None)#
- Parameters:
key (
str)to_integer (
bool)
- get_positional_input_values()#
- get_stream(index_pin=None, name=None, header_key_pin=None, prefix='', suffix='', subscan_2=False)#
- Parameters:
index_pin (
int)name (
str)header_key_pin (
str)prefix (
str)suffix (
str)subscan_2 (
bool)
- Return type:
tuple
- get_stream_deltatime()#
- Return type:
tuple
- get_stream_exposuretime()#
In blissdata, this stream is (normally) called scalers:time (in subscan1) In the header, there is key “HSTime” pointing to the string ‘time’
- Return type:
tuple
- get_stream_exposuretime_raw()#
In blissdata, this stream is (normally) called mcs:time_raw (in subscan1) In the header, there is key “HSTime” pointing to the string ‘time’
- Return type:
tuple
- get_stream_fast_timer()#
- Return type:
tuple
- get_stream_monitor_0()#
- Return type:
tuple
- get_stream_monitor_1()#
- Return type:
tuple
- get_stream_slow_timer()#
- Return type:
tuple
- get_streams_HS32_raw()#
- Return type:
list
- get_streams_HS32_scalers()#
- Return type:
list
- classmethod get_subclass(registry_name, _second_attempt=False)#
Retrieving a derived class
- classmethod get_subclass_names()#
- Return type:
List[str]
- classmethod get_subclasses()#
- get_uhash_init(serialize=False)#
- classmethod input_model()#
- Return type:
Optional[Type[BaseInputModel]]
- classmethod input_names()#
- Return type:
Set[str]
- property input_uhashes#
- property input_values#
DEPRECATED
- property input_variables: VariableContainer#
- property inputs: ReadOnlyVariableContainerNamespace#
- instance_nonce()#
- classmethod instantiate(registry_name, **kw)#
Factory method for instantiating a derived class.
- Parameters:
registry_name (
str) – for example “tasklib.tasks.MyTask” or “MyTask”**kw – Task constructor arguments
registry_name
- Returns Task:
- is_first_loop()#
- is_new_cycle()#
- is_new_workflow()#
- property is_ready_to_execute#
- property job_id: str | None#
- property label: str#
- load_scan()#
- log_allocated_memory()#
- log_debug(msg)#
- log_error(msg)#
- log_info(msg)#
- log_warning(msg)#
- property missing_inputs: VariableContainerMissingNamespace#
- property missing_outputs: VariableContainerMissingNamespace#
- property n_positional_inputs: int#
- classmethod n_required_positional_inputs()#
- Return type:
int
- property named_input_values#
DEPRECATED
- property node_id: str | int | tuple#
- property npositional_inputs#
DEPRECATED
- open_id02_file(filename, mode='r')#
- Parameters:
filename (
str)mode (
str)
- classmethod optional_input_names()#
- Return type:
Set[str]
- property output_metadata: dict | None#
- classmethod output_model()#
- Return type:
Optional[Type[BaseOutputModel]]
- classmethod output_names()#
- Return type:
Set[str]
- property output_transfer_data#
DEPRECATED
- property output_uhashes#
DEPRECATED
- property output_values#
DEPRECATED
- property output_variables: VariableContainer#
- property outputs: VariableContainerNamespace#
- property positional_input_values#
DEPRECATED
- read_from_stream_interpolate(stream_sliceable, stream_slice=None, datatype='float32')#
stream_object is a sliceable object (numpy.ndarray or blissdata stream object) Valid for all streams, from subscan1 and subscan2
- Parameters:
datatype (
str)- Return type:
ndarray
- classmethod required_input_names()#
- Return type:
Set[str]
- reset_state()#
- run()#
To be implemented by the derived classes
- save()#
- set_uhash_init(pre_uhash=None, instance_nonce=None)#
- Parameters:
pre_uhash (
Union[str,bytes,UniversalHash,HasUhash,None])instance_nonce (
Optional[Any])
- property succeeded: bool#
Completed without exception and with output values
- property task_identifier: str#
- property uhash: UniversalHash | None#
- uhash_randomize()#
- undo_fix_uhash()#
- undo_randomize()#
- property workflow_id: str | None#