TensileTestBatch API

🔬 Tensile
v0.4.0
Automated Tensile Test Analysis

TensileTestBatch

class TensileTestBatch(config=None)

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

__init__(config=None)

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]

@classmethod from_folder(cls, folder_path, pattern='*.csv', recursive=False, config=None)

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
Returns: TensileTestBatch
batch = TensileTestBatch.from_folder("Raw data/316L_A/")

from_csv_list() [classmethod]

@classmethod from_csv_list(cls, filepaths, config=None)

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
Returns: TensileTestBatch

analyze_all()

analyze_all(parallel=False, n_jobs=None)

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
Returns: self
# Sequential
batch.analyze_all()

# Parallel (faster)
batch.analyze_all(parallel=True, n_jobs=4)

summary_statistics()

summary_statistics()

Calculate summary statistics across all tests.

Returns: pd.DataFrame - Summary with mean, std, CV%, min, max

Columns: Specimen, E_GPa, Rp02_MPa, Rm_MPa, At_percent, Analysis_OK

identify_outliers()

identify_outliers(method='zscore', threshold=2.5)

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
Returns: pd.DataFrame - Outlier flags

export_summary()

export_summary(filepath)

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()

plot_all(overlay=True, include_invalid=False, cols=3, width=900, height=600)

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)
Returns: plotly.graph_objects.Figure