vipr_reflectometry.panpe.postprocess.data_collectors package

Submodules

vipr_reflectometry.panpe.postprocess.data_collectors.collector module

PANPE Data Collector

This module provides the main PanpeDataCollector class that integrates PANPE inference results with the VIPR DataCollector system for UI visualization.

class vipr_reflectometry.panpe.postprocess.data_collectors.collector.PanpeDataCollector(app)

Bases: object

Data collector for PANPE inference results.

This collector hooks into the VIPR inference workflow to capture PANPE InferenceResult objects and create visualizations for the frontend.

collect_panpe_results(app, data=None, result=None)

Collect PANPE inference results for UI visualization.

This hook is called after the postprocessing step and checks if the result contains a PANPE InferenceResult object. If so, it creates visualizations and stores them via the DataCollector.

Parameters:
  • app – VIPR application instance

  • data – Original data passed to the hook

  • result – Result data from postprocessing step

vipr_reflectometry.panpe.postprocess.data_collectors.visualizations module

PANPE Visualization Functions

This module provides functions to create visualizations from PANPE inference results, including posterior samples plotted with reflectivity curves and SLD profiles.

vipr_reflectometry.panpe.postprocess.data_collectors.visualizations.create_panpe_posterior_plot(inference_result, num_samples: int = 1000, show_prior: bool = True)

Create a posterior samples plot from PANPE InferenceResult and return the matplotlib figure together with the raw numpy arrays needed for the standalone plot script export.

This function calls PANPE’s built-in plot_sampled_profiles() method which creates a matplotlib figure with two subplots: - Left: Reflectivity curves (R(q) vs q) - Right: SLD profiles (ρ(z) vs z)

Parameters:
  • inference_result – PANPE InferenceResult object containing posterior samples

  • num_samples – Number of samples to plot (default: 1000)

  • show_prior – Whether to show prior samples in the plot (default: True)

Returns:

(figure, plot_arrays) — plot_arrays is the dict for set_plot_data(); both are None if plot creation fails.

Return type:

tuple[matplotlib.figure.Figure | None, dict | None]

vipr_reflectometry.panpe.postprocess.data_collectors.visualizations.create_parameter_summary_table(inference_result, num_samples: int = 1000)

Create a summary table of posterior parameter statistics.

Parameters:
  • inference_result – PANPE InferenceResult object

  • num_samples – Number of samples to use for statistics

Returns:

Summary statistics for each parameter

Return type:

dict

Module contents

PANPE Data Collectors

This package provides data collection and visualization functionality for PANPE predictions.

class vipr_reflectometry.panpe.postprocess.data_collectors.PanpeDataCollector(app)

Bases: object

Data collector for PANPE inference results.

This collector hooks into the VIPR inference workflow to capture PANPE InferenceResult objects and create visualizations for the frontend.

collect_panpe_results(app, data=None, result=None)

Collect PANPE inference results for UI visualization.

This hook is called after the postprocessing step and checks if the result contains a PANPE InferenceResult object. If so, it creates visualizations and stores them via the DataCollector.

Parameters:
  • app – VIPR application instance

  • data – Original data passed to the hook

  • result – Result data from postprocessing step