analysis.compression_metrics.compression_analysis¶
Methods compression metric analysis and plotting.
Functions
|
Calculate compression metrics for a single simulation condition and seed. |
|
Load or create merged data with metrics for given conditions and seeds. |
|
Plot distribution of metric values for each velocity. |
|
Plot individual metric values over time for each velocity. |
|
Save combined compression metrics data. |
- get_compression_metric_data(bucket: str, series_name: str, condition_keys: list[str], random_seeds: list[int], metrics: list[CompressionMetric], recalculate: bool = False) DataFrame [source]¶
Load or create merged data with metrics for given conditions and seeds.
If merged data already exists, load the data. Otherwise, iterate through the conditions and seeds to merge the data.
- Parameters:
bucket – Name of S3 bucket for input and output files.
series_name – Name of simulation series.
condition_keys – List of condition keys.
random_seeds – Random seeds for simulations.
metrics – List of metrics to calculate.
recalculate – True if data should be recalculated, False otherwise.
- Returns:
Merged dataframe with one row per fiber with calculated metrics.
- calculate_compression_metrics(df: DataFrame, metrics: list[Any], **options: dict[str, Any]) DataFrame [source]¶
Calculate compression metrics for a single simulation condition and seed.
- Parameters:
df – Input data for a single simulator.
metrics – The list of metrics to calculate.
**options – Additional options for the calculation.
- Returns:
Dataframe with calculated metrics.
- save_compression_metrics(data: DataFrame, save_location: str, save_key: str) None [source]¶
Save combined compression metrics data.
- Parameters:
data – Compression metrics data.
save_location – Location for output file (local path or S3 bucket).
save_key – Name key for output file.
- plot_metrics_vs_time(df: DataFrame, metrics: list[CompressionMetric], compression_distance: float = 150.0, use_real_time: bool = False, save_location: str | None = None, save_key_template: str = 'compression_metrics_over_time_%s.png') None [source]¶
Plot individual metric values over time for each velocity.
- Parameters:
df – Input dataframe.
metrics – List of metrics to plot.
compression_distance – Compression distance in nm.
use_real_time – True to use real time for the x-axis, False otherwise.
save_location – Location for output file (local path or S3 bucket).
save_key_template – Name key template for output file.
- plot_metric_distribution(df: DataFrame, metrics: list[CompressionMetric], save_location: str | None = None, save_key_template: str = 'compression_metrics_histograms_%s.png') None [source]¶
Plot distribution of metric values for each velocity.
- Parameters:
df – Input dataframe.
metrics – List of metrics to plot.
save_location – Location for output file (local path or S3 bucket).
save_key_template – Name key template for output file.