Helper Utilities

Internal helper modules for data models, logging, and common operations.

List Data Model

Qt-compatible list and table data models for the GUI file lists.

Logger Writer

Stream-like wrapper that redirects stdout/stderr writes to the Python logging system.

class xpcsviewer.helper.logwriter.LoggerWriter(level)[source]

Bases: object

Parameters:

level (Callable[[str], None])

__init__(level)[source]
Parameters:

level (Callable[[str], None])

Return type:

None

write(message)[source]
Parameters:

message (str)

Return type:

None

flush()[source]
Return type:

None

Utility Functions

Shared utility functions for data normalization and array slicing.

Helper utilities for XPCS data processing.

Provides common data transformation functions used across analysis modules:

  • get_min_max: Percentile-based intensity range calculation

  • norm_saxs_data: SAXS intensity normalization (I, I*q^2, I*q^4)

  • create_slice: Slice creation for array subsetting

xpcsviewer.helper.utils.get_min_max(data, min_percent=0, max_percent=100, **kwargs)[source]

Calculate intensity min/max values using percentiles.

Parameters:
  • data (ArrayLike) – Input array.

  • min_percent (float) – Lower percentile (0-100).

  • max_percent (float) – Upper percentile (0-100).

  • **kwargs (Any) – Optional plot_norm and plot_type for symmetric scaling.

Returns:

Tuple of (vmin, vmax) values.

Return type:

tuple[float, float]

xpcsviewer.helper.utils.norm_saxs_data(Iq, q, plot_norm=0)[source]

Normalize SAXS intensity data.

Parameters:
Returns:

Tuple of (normalized_Iq, xlabel, ylabel).

Return type:

tuple[ndarray[tuple[Any, …], dtype[floating[Any]]], str, str]

xpcsviewer.helper.utils.create_slice(arr, x_range)[source]

Create a slice for array subsetting based on value range.

Parameters:
Returns:

Slice object for the array subset.

Return type:

slice