How dlr-wf/crackpy works
Project Type and Purpose
• CrackPy is a scientific Python library/pipeline (not a web or mobile app) for automated fatigue crack detection and fracture‐mechanical analysis.
• It ingests full‐field displacement/strain data (“nodemap” files) from DIC or simulation, detects crack paths/tips (via image‐based ML or line-intercept), then computes fracture parameters (J-integral, stress intensity factors, Williams and CJP fits).
File Structure
Top‐level:
• crackpy/ ← core Python package
– structure_elements/ ← domain model (Material, data file classes)
– crack_detection/ ← crack path & tip detection module
• data/ ← data preparation, preprocessing, interpolation
• deep_learning/ ← CNN architectures, training scripts (PyTorch)
• pipeline/ ← high-level orchestration of detection steps
• utils/ ← plotting, evaluation, generic helpers
– fracture_analysis/ ← fracture mechanics algorithms & pipelines
– tests/ ← extensive unit tests
• scripts/ ← ready-to-run CLI scripts for demos & pipelines
• test_data/ ← sample input files & expected outputs
• setup.py, requirements.txt, CI configs
README for Additional Insights
• Illustrates data flow: from nodemap input → crack detection → fracture analysis → plots/outputs
• Mentions external dependencies: GOM Aramis (DIC) and Ansys (simulation) as data sources
• Lists core modules: structure_elements, dic, simulation, crack_detection, fracture_analysis
Main Components and Their Interactions
A. Data Ingestion
• External Sources:
– DIC software (GOM Aramis)
– Finite‐element software (Ansys)
• “dic” & “simulation” submodules (not in code tree but referenced) transform raw outputs into standardized nodemap files (.txt)
B. Domain Model
• structure_elements.Material & .DataFile classes
• Nodemap class defines the schema for node coordinates, displacements, strains, metadata
C. Crack Detection Module
1. Data preprocessing (transforms, interpolation, normalization)
2. Two detection routes:
– Line‐intercept + iterative Williams‐based correction
– CNN‐based detection (attention, nets.py, train.py)
3. Pipeline orchestrator to sequence steps and save detected crack tip/path metadata
D. Fracture Analysis Module
• Takes nodemap + crack tip metadata → computes:
– J-integral (Rice’s path‐independent integral)
– Interaction integral (mixed mode SIFs)
– Conjugate‐work integral (Williams coefficients)
– Higher‐order term fits (HOST/HORT)
– CJP model fits
• Provides pipeline.py to run selected analysis methods over time‐series
E. Utilities & Output
• Plotting (matplotlib; plot.py)
• Evaluation metrics (evaluate.py)
• File I/O (read/write modules in fracture_analysis)
• Scripts folder wraps pipelines into CLI tools for batch processing
Architectural Patterns & Design Principles
• Domain modeling: structure_elements module encapsulates core types
• Plugin/extension: new detection methods or fracture‐analysis routines can drop into pipelines
• Test‐driven: comprehensive tests ensure each component’s correctness
• Data flow oriented: directional, stage‐by‐stage transformations
Technologies & Frameworks to Annotate
• Python 3.x
• PyTorch (deep_learning/nets.py, attention, train.py)
• NumPy/SciPy (numeric ops, interpolation, fitting)
• Matplotlib (plotting)
• pandas (results.csv reading)
• CLI scripts (entry points using Python scripts under scripts/)
Final Recommendations
• Be exhaustive but clear: capture every top-level package and script group
• Optional paths (e.g., if using DIC vs. simulation ingestion)
• File‐based interfaces (e.g., “.txt nodemap” passes between stages)
• Extension points (e.g., where new detection or analysis methods plug in)