vipr_reflectometry.reflectorch.postprocess.data_collectors package¶
Submodules¶
vipr_reflectometry.reflectorch.postprocess.data_collectors.batch_visualizations module¶
Batch visualization creation for multi-spectrum reflectometry analysis.
This module provides functions for creating visualizations that analyze trends and patterns across multiple spectra in a batch.
- vipr_reflectometry.reflectorch.postprocess.data_collectors.batch_visualizations.analyze_batch_statistics(spectra_data)¶
Analyze statistics across all spectra in a batch.
- vipr_reflectometry.reflectorch.postprocess.data_collectors.batch_visualizations.create_parameter_comparison_diagrams(app, spectra_data, parameter_names)¶
Create multiple trend diagrams for different parameters.
- vipr_reflectometry.reflectorch.postprocess.data_collectors.batch_visualizations.create_parameter_trend_diagram(app, spectra_data, parameter_name)¶
Create a scatter plot showing parameter trend across multiple spectra.
vipr_reflectometry.reflectorch.postprocess.data_collectors.collector module¶
Main ReflectorchDataCollector orchestration class.
This module contains the main ReflectorchDataCollector class that coordinates all reflectorch-specific data collection activities and integrates with the generic VIPR DataCollector system.
- class vipr_reflectometry.reflectorch.postprocess.data_collectors.collector.ReflectorchDataCollector(app)¶
Bases:
objectBatch-aware UI data collector for reflectorch results.
- collect_prediction_results(app, data=None, result=None)¶
Collect prediction results for UI visualization - unified batch handling.
vipr_reflectometry.reflectorch.postprocess.data_collectors.data_extraction module¶
Data extraction utilities for reflectorch prediction results.
This module provides pure functions for extracting and transforming data from prediction results and DataSet objects in a reflectorch-specific context.
- vipr_reflectometry.reflectorch.postprocess.data_collectors.data_extraction.detect_batch_size(prediction_data: dict, app) int¶
Smart batch size detection from multiple sources.
- vipr_reflectometry.reflectorch.postprocess.data_collectors.data_extraction.extract_first_errors(dataset)¶
Extract first spectrum’s error bars from batch DataSet.
- vipr_reflectometry.reflectorch.postprocess.data_collectors.data_extraction.extract_first_result(result_array)¶
Extract first result from batch prediction results.
- vipr_reflectometry.reflectorch.postprocess.data_collectors.data_extraction.extract_first_spectrum(dataset)¶
Extract first spectrum from batch DataSet for visualization.
- vipr_reflectometry.reflectorch.postprocess.data_collectors.data_extraction.extract_prediction_for_spectrum(prediction_data: dict, spectrum_index: int) dict¶
Extract prediction data for one spectrum - handles batch format.
- vipr_reflectometry.reflectorch.postprocess.data_collectors.data_extraction.extract_spectrum_dataset(dataset: DataSet, spectrum_index: int) DataSet¶
Extract single spectrum DataSet - handles both single and batch.
- vipr_reflectometry.reflectorch.postprocess.data_collectors.data_extraction.get_parameter_with_unit(param_name)¶
Add appropriate units to parameter names based on parameter type.
vipr_reflectometry.reflectorch.postprocess.data_collectors.spectrum_visualizations module¶
Spectrum visualization creation for individual reflectometry spectra.
This module provides the SpectrumVisualizer class that creates tables, diagrams, and images for individual spectrum data using the generic DataCollector builders.
- class vipr_reflectometry.reflectorch.postprocess.data_collectors.spectrum_visualizations.SpectrumVisualizer(app)¶
Bases:
objectCreates visualizations for individual reflectometry spectra.
- add_chi2_contributions_diagram_for_spectrum(dc: DataCollector, spectrum_dataset: DataSet, spectrum_prediction: dict, spectrum_index: int)¶
Add Chi² contributions diagram for single spectrum.
- add_parameter_table_for_spectrum(dc: DataCollector, spectrum_prediction: dict, spectrum_index: int)¶
Add parameter table for single spectrum.
- add_reflectivity_diagram_for_spectrum(dc: DataCollector, spectrum_dataset: DataSet, spectrum_prediction: dict, spectrum_index: int)¶
Add reflectivity curve diagram for single spectrum.
- add_reflectivity_image_for_spectrum(dc: DataCollector, spectrum_dataset: DataSet, spectrum_prediction: dict, spectrum_index: int)¶
Add reflectivity image for single spectrum, with standalone plot script export.
- add_residuals_diagram_for_spectrum(dc: DataCollector, spectrum_dataset: DataSet, spectrum_prediction: dict, spectrum_index: int)¶
Add residuals diagram for single spectrum.
Displays normalized residuals following reflectometry conventions: - If σ (uncertainty) available: Δ/σ = (y_exp - y_pred) / σ - If no σ available: Δ/y_exp = (y_exp - y_pred) / y_exp
- add_sld_diagram_for_spectrum(dc: DataCollector, spectrum_prediction: dict, spectrum_index: int)¶
Add SLD profile diagram for single spectrum.
vipr_reflectometry.reflectorch.postprocess.data_collectors.statistics module¶
Statistical calculations for reflectorch goodness-of-fit metrics.
This module provides pure functions for calculating comprehensive statistical metrics including Chi², RSS, MSE, RMSE, and MAE for reflectometry fits.
- vipr_reflectometry.reflectorch.postprocess.data_collectors.statistics.calculate_curve_statistics(experimental, predicted, error_bars, n_points)¶
Calculate all statistical metrics for a single curve.
- vipr_reflectometry.reflectorch.postprocess.data_collectors.statistics.calculate_spectrum_goodness_of_fit_stats(experimental_curve, spectrum_prediction, error_bars)¶
Calculate goodness-of-fit statistics for single spectrum.
vipr_reflectometry.reflectorch.postprocess.data_collectors.streaming_handler module¶
Streaming trend handling for reflectometry real-time analysis.
This module provides functions for caching parameter values across streaming updates and creating trend visualizations over time.
- vipr_reflectometry.reflectorch.postprocess.data_collectors.streaming_handler.cleanup_streaming_cache_if_needed(app, consumer_id)¶
Clean up streaming cache when a new scan is detected.
- vipr_reflectometry.reflectorch.postprocess.data_collectors.streaming_handler.create_streaming_trend(app, cached_data, param_name, include_predicted=True, polished_fallback_to_predicted=True)¶
Create trend diagram from cached parameter data.
- vipr_reflectometry.reflectorch.postprocess.data_collectors.streaming_handler.get_streaming_statistics(app, consumer_id)¶
Get statistics about cached streaming data.
- vipr_reflectometry.reflectorch.postprocess.data_collectors.streaming_handler.handle_streaming_trends(app, ui_data)¶
Simple streaming trend handling using table data.
- vipr_reflectometry.reflectorch.postprocess.data_collectors.streaming_handler.initialize_streaming_cache(app, consumer_id)¶
Initialize streaming cache for a new consumer.
Module contents¶
Reflectorch Data Collectors Package
This package provides a modular data collection system for reflectorch-specific UI visualization data. It extends the generic VIPR DataCollector with reflectometry-specific functionality.