A Python-based application for automated analysis of mechanical testing data from biological tissues, providing standardized processing and reproducible results across experiments.
MechAnalyser manages the analysis of mechanical testing data using a modular, experiment-type-driven architecture. It provides:
- Automated analysis pipelines for three experiment types: compression-to-failure, stepwise compression, and microindentation
- Batch processing capabilities for consistent analysis across multiple samples
- Interactive visualization with real-time plotting for quality assessment
- Modular experiment architecture allowing easy extension to new test types
- Cross-platform compatibility with Windows and macOS support
The configuration philosophy emphasizes:
- Explicit parameter specification with user verification
- Declarative analysis workflows that are reproducible
- Clear separation between raw data processing and result generation
- Standardized output formats for downstream statistical analysis
.
├── datasets/ # Datasets for processing
│ └── example/ # Example dataset
│ ├── properties/ # Example sample physical properties
| | └ properties.csv # Example sample physical properties database
| |
│ ├── sample1.csv # Example sample 1 compression data
│ ├── sample2.csv # Example sample 2 compression data
│ └── sample3.csv # Example sample 3 compression data
│
├── doc/ # Documentation
├── mech_analyser/ # Main application package
│ ├── __init__.py
│ ├── config.py # Experiment module configuration
│ ├── mech_analyser.py # Main GUI application
│ ├── version.py # Version information
│ │
│ ├── experiment/ # Experiment analysis modules
│ │ ├── analyser.py # Base analyser classes
│ │ ├── collation.py # Base result collation logic
│ │ ├── data.py # Base data processing logic
│ │ ├── instron_68tm/ # Instron 68TM instrument support
│ │ │ ├── failure/ # Compression-to-failure analysis
│ │ │ └── stepwise/ # Stepwise compression analysis
│ │ ├── microtester_g2/ # Microtester G2 instrument support
│ │ │ └── microindentation/ # Microindentation analysis
│ │ ├── phase.py # Base phase detection logic
│ │ ├── registry.py # Experiment registration
│ │ └── ui.py # Base UI components for experiments
│ │
│ ├── study/ # Sample and study management
│ ├── ui/ # User interface components
│ └── util/ # Utility modules
│
├── tests/ # Unit tests
| ├── experiment/ # Experiment analysis unit tests
| ├── study/ # Sample and study unit tests
| └── util/ # Utility unit tests
│
├── README.md # This file
├── LICENSE # MIT license
├── Makefile # Build and test automation
└── requirements.txt # Python dependencies
See the Installation section below for complete setup instructions.
- Install dependencies:
pip install -r requirements.txt - Launch the GUI:
python -m mech_analyser.mech_analyser - Import CSV data files from your mechanical testing instrument
- Configure analysis parameters and sample properties
- Process samples and export results
For testing and demonstration purposes, example datasets are provided in
datasets/example/:
- Data Files:
sample1.csv- Baseline compression-to-failure test datasample2.csv- Stiffer material (higher forces for same displacement)sample3.csv- Softer material (lower forces for same displacement)
- Properties File:
properties/properties.csv- Contains sample properties for all three samples
Use these files to familiarize yourself with batch processing and comparing results across multiple samples.
- Create a new module directory under
mech_analyser/experiment/ - Implement analyser, data, phase, ui, and collation modules
- Add the module path to
EXPERIMENT_MODULESinconfig.py
Compression-to-failure experiments determine fundamental mechanical properties:
- Data Processing: Force-displacement to stress-strain conversion with tare removal
- Young's Modulus: Linear regression using fixed range, anchor point, or R²-maximization methods
- Ultimate Properties: Maximum stress/strain identification
- Toughness: Numerical integration under the stress-strain curve
- Output: Stress-strain plots with regression overlays and mechanical property summaries
Stepwise compression characterizes viscoelastic behavior:
- Phase Detection: Automatic identification of relaxation periods at target strains
- Relaxation Modeling: Exponential decay fitting (σ(t) = a·exp(-t/τ) + b)
- Time Constants: Quantification of relaxation rates via τ parameter
- Output: Stress-time curves with fitted models and goodness-of-fit metrics
Microindentation measures localized properties using contact mechanics:
- Hertzian Modeling: Nonlinear regression of force-displacement data
- Reduced Modulus: Extraction of E/(1-ν²) from F = (4/3)·E/(1-ν²)·√R·(δ-a)^1.5 + b
- Energy Dissipation: Calculation using Gauss's area formula on hysteresis loops
- Output: Force-displacement plots with modulus values and dissipation metrics
Each experiment type includes a complete analysis workflow:
- Raw data import with configurable column mapping
- Automatic unit conversion to SI units via Pint
- Parameter scaling for numerical stability in regressions
- Goodness-of-fit assessment with R² reporting
Multiple samples can be analyzed consistently:
- Identical parameter application across samples
- Automatic result aggregation into summary tables
- Excel export with multi-row headers and unit labels
- Group and specimen name tracking for statistical analysis
Real-time quality assessment capabilities:
- PyQtGraph-based plotting with hardware acceleration
- Visual indicators showing regression data ranges
- Interactive inspection of fitted models
- Automatic axis labeling with units
Extensible design for new experiment types:
- Independent modules for each experiment
- Shared base classes and utilities
- Declarative configuration via config.py
- GUI integration through registry system
Create distributable executables using PyInstaller:
Using Makefile (Recommended):
make distThe executable appears in dist/MechAnalyser/.
Run the complete test suite:
make testOr run individual test modules:
python -m unittest tests/experiment/test_data.py
python -m unittest tests/experiment/test_phase.py
python -m unittest tests/experiment/test_analyser.py
python -m unittest tests/study/test_sample.py
python -m unittest tests/study/test_study.py
python -m unittest tests/util/test_serialiser.py- Edit analysis parameters in experiment modules
- Update GUI components in ui/ directory
- Test changes:
make test - Rebuild application:
make dist
- Reproducible: Same input data and parameters produce identical results
- Modular: Experiment types are independent and easily extensible
- Validated: Numerical stability checks and goodness-of-fit reporting
- User-Centric: Interactive GUI with real-time feedback
- Standards-Based: Uses established scientific computing libraries
- Open-Source: MIT licensed for academic and commercial use
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit issues, feature requests, or pull requests. For major changes, please open an issue first to discuss the proposed modifications.