TensileTestBatch
Container for multiple tensile tests with batch processing, summary statistics, and outlier detection.
Quick Start
from tensile import TensileTestBatch
# Load all tests from folder
batch = TensileTestBatch.from_folder("data/316L_A/")
# Analyze all (parallel processing)
batch.analyze_all(parallel=True)
# Get summary statistics
summary = batch.summary_statistics()
print(summary)
# Detect outliers
outliers = batch.identify_outliers(method='zscore', threshold=2.5)
# Export to Excel
batch.export_summary("batch_report.xlsx")
Common Methods
from_folder()
Load all CSV files from a folder
analyze_all()
Process all tests with optional parallelization
summary_statistics()
Calculate mean, std, CV% across tests
identify_outliers()
Statistical outlier detection
export_summary()
Export multi-sheet Excel report
plot_all()
Create batch comparison plot
Constructor
Initialize a TensileTestBatch instance.
Parameters:
- config : TensileTestConfig, optional
- Configuration applied to all tests. If None, uses default.
Attributes
| Attribute | Type | Description |
|---|---|---|
tests |
list[TensileTest] | List of all TensileTest instances |
summary |
pd.DataFrame | Cached summary statistics |
config |
TensileTestConfig | Shared configuration |
Methods
from_folder() [classmethod]
Create batch by loading all CSV files from a folder.
Parameters:
- folder_path : str
- Path to folder containing CSV files
- pattern : str, default='*.csv'
- Glob pattern for file matching
- recursive : bool, default=False
- If True, search subfolders recursively
- config : TensileTestConfig, optional
- Configuration for all tests
batch = TensileTestBatch.from_folder("Raw data/316L_A/")
from_csv_list() [classmethod]
Create batch from explicit list of CSV files.
Parameters:
- filepaths : list[str]
- List of paths to CSV files
- config : TensileTestConfig, optional
- Configuration for all tests
analyze_all()
Run complete analysis pipeline on all tests.
Parameters:
- parallel : bool, default=False
- If True, process tests in parallel
- n_jobs : int, optional
- Number of parallel workers. If None, uses CPU count
# Sequential
batch.analyze_all()
# Parallel (faster)
batch.analyze_all(parallel=True, n_jobs=4)
summary_statistics()
Calculate summary statistics across all tests.
Columns: Specimen, E_GPa, Rp02_MPa, Rm_MPa, At_percent, Analysis_OK
identify_outliers()
Identify statistical outliers in test results.
Parameters:
- method : str, default='zscore'
- 'zscore' or 'iqr'
- threshold : float, default=2.5
- For zscore: std deviations. For IQR: multiplier
export_summary()
Export comprehensive Excel workbook with multiple sheets.
Parameters:
- filepath : str
- Path where Excel file will be saved
Sheets: Summary, Individual_Results, Quality_Report, Outliers
plot_all()
Create visualization comparing all tests.
Parameters:
- overlay : bool, default=True
- If True, plot all curves on same axes
- include_invalid : bool, default=False
- Include failed tests
- cols : int, default=3
- Columns for subplots (when overlay=False)