Metadata-Version: 2.4
Name: ddacs
Version: 2.0.0
Summary: Deep Drawing and Cutting Simulations (DDACS) Dataset - Python interface
Author-email: Sebastian Baum <Baum.Sebastian@protonmail.com>
License: MIT License
        
        Copyright (c) 2025 Sebastian Baum
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Repository, https://github.com/BaumSebastian/DDACS
Project-URL: Documentation, https://ddacs.readthedocs.io
Project-URL: Dataset, https://darus.uni-stuttgart.de/dataset.xhtml?persistentId=doi:10.18419/DARUS-4801
Project-URL: Paper, https://www.matec-conferences.org/articles/matecconf/abs/2025/02/matecconf_iddrg2025_01090/matecconf_iddrg2025_01090.html
Keywords: machine-learning,dataset,simulation,fem,sheet-metal-forming,deep-drawing,hdf5,materials-science
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: h5py>=3.8.0
Requires-Dist: numpy>=1.21.0
Requires-Dist: pandas>=1.3.0
Requires-Dist: requests>=2.28.0
Requires-Dist: humanfriendly>=10.0
Requires-Dist: rich>=13.0.0
Provides-Extra: torch
Requires-Dist: torch>=2.0.0; extra == "torch"
Provides-Extra: examples
Requires-Dist: torch>=2.0.0; extra == "examples"
Requires-Dist: jupyter>=1.0.0; extra == "examples"
Requires-Dist: matplotlib>=3.5.0; extra == "examples"
Requires-Dist: seaborn>=0.11.0; extra == "examples"
Requires-Dist: plotly>=5.0.0; extra == "examples"
Requires-Dist: pyvista>=0.46.5; extra == "examples"
Requires-Dist: imageio>=2.37.2; extra == "examples"
Requires-Dist: kaleido>=1.2.0; extra == "examples"
Requires-Dist: open3d>=0.19.0; extra == "examples"
Provides-Extra: dev
Requires-Dist: torch>=2.0.0; extra == "dev"
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: black>=24.0.0; extra == "dev"
Requires-Dist: ruff>=0.3.0; extra == "dev"
Requires-Dist: bumpver>=2023.1129; extra == "dev"
Requires-Dist: pre-commit>=3.6.0; extra == "dev"
Provides-Extra: docs
Requires-Dist: mkdocs>=1.5.0; extra == "docs"
Requires-Dist: mkdocs-material>=9.5.0; extra == "docs"
Requires-Dist: mkdocstrings[python]>=0.24.0; extra == "docs"
Dynamic: license-file

<div align="center">
  <img src="https://raw.githubusercontent.com/BaumSebastian/DDACS/main/docs/images/icon/DDACS_small.png" width="150"/>
  <h1>Deep Drawing and Cutting Simulations (DDACS) Dataset</h1>
</div>

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
[![DaRUS Repository](https://img.shields.io/badge/repository-DaRUS-green.svg)](https://darus.uni-stuttgart.de/dataset.xhtml?persistentId=doi:10.18419/DARUS-4801)
[![DOI](https://img.shields.io/badge/DOI-10.18419%2FDARUS--4801-blue.svg)](https://doi.org/10.18419/DARUS-4801)
[![Paper](https://img.shields.io/badge/paper-MATEC%20Web%20Conf.-red.svg)](https://www.matec-conferences.org/articles/matecconf/abs/2025/02/matecconf_iddrg2025_01090/matecconf_iddrg2025_01090.html)

A Python package for accessing and processing the [Deep Drawing and Cutting Simulations (DDACS) Dataset](https://darus.uni-stuttgart.de/dataset.xhtml?persistentId=doi:10.18419/DARUS-4801).
It includes a CLI for downloading datasets from DaRUS and a Python API for accessing simulation data with metadata.

<div align="center">

![Thickness Distribution Example](https://raw.githubusercontent.com/BaumSebastian/DDACS/main/docs/images/simulation_overview.gif)

*Simulation with the tool geometries and various additional information like sheet metal thinning, stress and strain. The gif has been interpolated for a more fluid display (the simulation contains 3 to 4 timesteps).*

</div>

## Table of Contents

- [Table of Contents](#table-of-contents)
- [Installation](#installation)
  - [Core Installation](#core-installation)
  - [PyTorch Installation](#pytorch-installation)
  - [Examples Installation](#examples-installation)
- [Download Dataset](#download-dataset)
  - [Versioning](#versioning)
- [Basic Usage](#basic-usage)
  - [Core Usage](#core-usage)
  - [PyTorch Usage](#pytorch-usage)
- [Citation](#citation)
  - [Dataset Citation](#dataset-citation)
  - [Paper Citation](#paper-citation)
- [Development Installation](#development-installation)

## Installation

**Note:** I recommend using [uv](https://docs.astral.sh/uv/) as a fast Python package installer and resolver. Simply replace `pip` with `uv pip` in the commands below.

### Core Installation

For basic dataset access without high weight module dependencies:

```bash
pip install git+https://github.com/BaumSebastian/Deep-Drawing-and-Cutting-Simulations-Dataset.git
```

### PyTorch Installation

For PyTorch integration without visualization dependencies:

```bash
pip install "git+https://github.com/BaumSebastian/Deep-Drawing-and-Cutting-Simulations-Dataset.git[torch]"
```

### Examples Installation

For examples with PyTorch, Jupyter, and visualization capabilities:

```bash
pip install "git+https://github.com/BaumSebastian/Deep-Drawing-and-Cutting-Simulations-Dataset.git[examples]"
```

## Download Dataset

Download the dataset using the `ddacs` CLI:

```bash
# Download full dataset (requires ~1TB storage)
ddacs download

# Download small test set for quick demos (requires ~50GB storage)
ddacs download --small

# Show dataset info and available versions
ddacs info
```

**Important:** The full dataset is approximately 1TB in size. Ensure you have sufficient storage space. The download may take several hours depending on your internet connection.

**Options:**
| Flag | Description |
| ------ | ------------- |
| `--small` | Download small test set for demos |
| `--out ./path` | Custom output directory (default: `./data`) |
| `--no-extract` | Skip extraction of zip files |
| `--keep-zip` | Keep zip files after extraction |
| `-y, --yes` | Skip confirmation prompt |

### Versioning

The package version aligns with the dataset version on DaRUS. Running `ddacs download` will download dataset version 2.0 by default.

```bash
# Check available versions
ddacs info
```

## Basic Usage

### Core Usage

For basic dataset iteration:

```python
import h5py
import numpy as np
from ddacs import iter_ddacs, count_available_simulations

# Count available simulations
count = count_available_simulations("./data")
print(f"Available simulations: {count}")

# Iterate over first few samples
for i, (sim_id, metadata, h5_file_path) in enumerate(iter_ddacs("./data")):
    print(f"Sample {i+1}: ID={sim_id}, Path={h5_file_path}")

    # Access simulation data
    with h5py.File(h5_file_path, "r") as f:
        data = np.array(f["OP10"]["blank"]["node_displacement"])
        print(f"Data shape: {data.shape}")

    if i >= 2:  # Show first 3 samples
        break
```

### PyTorch Usage

For PyTorch-compatible dataset with DataLoader support:

```python
from ddacs.pytorch import DDACSDataset
from torch.utils.data import DataLoader

# Create dataset
dataset = DDACSDataset("./data")
dataloader = DataLoader(dataset, batch_size=4, shuffle=True)

# Use in training loop
for batch_idx, (sim_ids, metadata_batch, h5_paths) in enumerate(dataloader):
    print(f"Batch {batch_idx}: {len(sim_ids)} samples")
    # Your training code here
    if batch_idx >= 2:  # Show first 3 batches
        break
```

See [`examples/dataset_demo.ipynb`](./examples/dataset_demo.ipynb) for a comprehensive tutorial including visualization and advanced usage patterns.

## Citation

If you use this dataset or code in your research, please cite both the dataset and the paper:

### Dataset Citation

```bibtex
@dataset{baum2025ddacs,
  title={Deep Drawing and Cutting Simulations Dataset},
  subtitle={FEM Simulations of a deep drawn and cut dual phase steel part},
  author={Baum, Sebastian and Heinzelmann, Pascal},
  year={2025},
  version={1.0},
  publisher={DaRUS},
  doi={10.18419/DARUS-4801},
  license={CC BY 4.0},
  url={https://doi.org/10.18419/DARUS-4801}
}
```

### Paper Citation

```bibtex
@article{heinzelmann2025benchmark,
  title={A Comprehensive Benchmark Dataset for Sheet Metal Forming: Advancing Machine Learning and Surrogate Modelling in Process Simulations},
  author={Heinzelmann, Pascal and Baum, Sebastian and Riedmüller, Kim Rouven and Liewald, Mathias and Weyrich, Michael},
  journal={MATEC Web of Conferences},
  volume={408},
  year={2025},
  pages={01090},
  doi={10.1051/matecconf/202540801090},
  url={https://www.matec-conferences.org/articles/matecconf/abs/2025/02/matecconf_iddrg2025_01090/matecconf_iddrg2025_01090.html}
}
```

## Development Installation

For developers who want to contribute to this project:

```bash
git clone https://github.com/BaumSebastian/Deep-Drawing-and-Cutting-Simulations-Dataset.git DDACS
cd DDACS

# Install in editable mode with development dependencies
pip install -e ".[dev]"
```

This installs the package with the `ddacs` CLI command and all development tools.
