Batch Operations Module
Batch operations module for MMPP - enables serial computation across multiple simulation results.
This module provides the BatchOperations class that allows for executing FFT computations, mode analysis, and other operations across entire directories of simulation results using slice notation like op[:].fft.modes.compute_modes() (auto-selects optimal dataset).
- class mmpp.batch_operations.BatchFFT(results, mmpp_ref)[source]
Bases:
object
Batch FFT operations handler.
- __init__(results, mmpp_ref)[source]
Initialize batch FFT operations.
Parameters:
- resultsList[Any]
List of ZarrJobResult objects
- mmpp_refAny
Reference to MMPP instance
- property modes: BatchModeAnalyzer
Get batch mode analyzer.
- class mmpp.batch_operations.BatchModeAnalyzer(results, mmpp_ref)[source]
Bases:
object
Batch mode analysis operations handler.
- __init__(results, mmpp_ref)[source]
Initialize batch mode analyzer.
Parameters:
- resultsList[Any]
List of ZarrJobResult objects
- mmpp_refAny
Reference to MMPP instance
- compute_modes(dset=None, parallel=True, max_workers=None, **kwargs)[source]
Compute FMR modes for all results in batch.
Parameters:
- dsetstr, default=None
Dataset name to analyze (default: auto-select largest m dataset)
- parallelbool, default=True
Whether to use parallel processing
- max_workersOptional[int]
Maximum number of worker threads (None for auto)
- **kwargsdict
Additional arguments to pass to mode computation
Returns:
: Dict[str, Any]
Summary of batch mode computation results
- class mmpp.batch_operations.BatchOperations(results, mmpp_ref)[source]
Bases:
object
Main batch operations class that provides access to batch FFT and mode operations.
This class is returned when using slice notation on MMPP objects, e.g., op[:]. It provides access to batch operations like: - op[:].fft.modes.compute_modes() (auto-selects optimal dataset) - op[:].fft.compute_all()
- __init__(results, mmpp_ref)[source]
Initialize batch operations.
Parameters:
- resultsList[Any]
List of ZarrJobResult objects to operate on
- mmpp_refAny
Reference to parent MMPP instance
- process(dset=None, parallel=True, max_workers=None, **kwargs)[source]
Process all results in batch with comprehensive analysis.
This method performs complete analysis including FFT computation and mode analysis for all results in the batch.
Parameters:
- dsetstr, default=None
Dataset name to analyze (default: auto-select largest m dataset)
- parallelbool, default=True
Whether to use parallel processing
- max_workersOptional[int]
Maximum number of worker threads (None for auto)
- **kwargsdict
Additional arguments to pass to analysis
Returns:
: Dict[str, Any]
Comprehensive analysis results
- prepare_report(spectrum=True, modes=True, parallel=True, **kwargs)[source]
Prepare comprehensive report for all results (future functionality).
Parameters:
- spectrumbool, default=True
Whether to include spectrum analysis
- modesbool, default=True
Whether to include mode analysis
- parallelbool, default=True
Whether to use parallel processing
- **kwargsdict
Additional arguments for analysis
Returns:
: Dict[str, Any]
Comprehensive report summary
Batch Operations Classes
BatchOperations
- class mmpp.batch_operations.BatchOperations(results, mmpp_ref)[source]
Bases:
object
Main batch operations class that provides access to batch FFT and mode operations.
This class is returned when using slice notation on MMPP objects, e.g., op[:]. It provides access to batch operations like: - op[:].fft.modes.compute_modes() (auto-selects optimal dataset) - op[:].fft.compute_all()
- __init__(results, mmpp_ref)[source]
Initialize batch operations.
Parameters:
- resultsList[Any]
List of ZarrJobResult objects to operate on
- mmpp_refAny
Reference to parent MMPP instance
- process(dset=None, parallel=True, max_workers=None, **kwargs)[source]
Process all results in batch with comprehensive analysis.
This method performs complete analysis including FFT computation and mode analysis for all results in the batch.
Parameters:
- dsetstr, default=None
Dataset name to analyze (default: auto-select largest m dataset)
- parallelbool, default=True
Whether to use parallel processing
- max_workersOptional[int]
Maximum number of worker threads (None for auto)
- **kwargsdict
Additional arguments to pass to analysis
Returns:
: Dict[str, Any]
Comprehensive analysis results
- prepare_report(spectrum=True, modes=True, parallel=True, **kwargs)[source]
Prepare comprehensive report for all results (future functionality).
Parameters:
- spectrumbool, default=True
Whether to include spectrum analysis
- modesbool, default=True
Whether to include mode analysis
- parallelbool, default=True
Whether to use parallel processing
- **kwargsdict
Additional arguments for analysis
Returns:
: Dict[str, Any]
Comprehensive report summary
BatchFFT
- class mmpp.batch_operations.BatchFFT(results, mmpp_ref)[source]
Bases:
object
Batch FFT operations handler.
- __init__(results, mmpp_ref)[source]
Initialize batch FFT operations.
Parameters:
- resultsList[Any]
List of ZarrJobResult objects
- mmpp_refAny
Reference to MMPP instance
- property modes: BatchModeAnalyzer
Get batch mode analyzer.
BatchModeAnalyzer
- class mmpp.batch_operations.BatchModeAnalyzer(results, mmpp_ref)[source]
Bases:
object
Batch mode analysis operations handler.
- __init__(results, mmpp_ref)[source]
Initialize batch mode analyzer.
Parameters:
- resultsList[Any]
List of ZarrJobResult objects
- mmpp_refAny
Reference to MMPP instance
- compute_modes(dset=None, parallel=True, max_workers=None, **kwargs)[source]
Compute FMR modes for all results in batch.
Parameters:
- dsetstr, default=None
Dataset name to analyze (default: auto-select largest m dataset)
- parallelbool, default=True
Whether to use parallel processing
- max_workersOptional[int]
Maximum number of worker threads (None for auto)
- **kwargsdict
Additional arguments to pass to mode computation
Returns:
: Dict[str, Any]
Summary of batch mode computation results
Usage Examples
Basic Batch Operations
import mmpp as mp
# Load simulations
op = mp.open("/path/to/simulations")
# Get batch operations for all results
batch = op[:]
# Compute modes for all results
summary = batch.fft.modes.compute_modes(dset="m_z5-8")
print(f"Computed modes for {summary['successful']} results")
Parallel Processing
# Use parallel processing for faster computation
summary = batch.fft.modes.compute_modes(
dset="m_z5-8",
parallel=True,
max_workers=4
)
print(f"Total time: {summary['total_time']:.2f}s")
print(f"Average per result: {summary['average_time_per_result']:.2f}s")
Comprehensive Reports
# Generate comprehensive analysis report
report = batch.prepare_report(
spectrum=True,
modes=True,
parallel=True
)
print(f"Analyzed {report['total_results']} results")