Getting Started¶
This tutorial walks from installation to a first plot. It uses only the public surface that ships with v2.0.0: rddac.open_h5, rddac.inspect_h5, and the visualization helpers.
The companion notebook at notebooks/01_getting_started.ipynb reproduces every cell below; open it side by side to run as you read.
1. Install¶
The PyTorch adapter is optional. Install it explicitly if a model is to be trained:
For hardware specific PyTorch builds (CUDA, ROCm, MPS) see pytorch.org and install PyTorch before rddac.
Verify the install. From a Python REPL or notebook cell:
Or as a single shell command (handy on Linux servers where opening a REPL is overkill):
Output:
2. Download the data¶
This tutorial only needs the small bundle (~174 MB), metadata.json, process_parameters.csv and sample.zip with one experiment per category:
The full dataset (~87 GB, plus the matching DDACS simulations) downloads with plain rddac download; see the CLI reference for the other options (selected files, unattended runs, extraction).
All downloads write into ./data/ and keep the zips zipped; mlcroissant reads them in place. The rest of the tutorial uses:
from pathlib import Path
DATA_DIR = Path('./data') # repository root
# DATA_DIR = Path('../data') # uncomment instead when running from inside notebooks/
experiment_id = 0 # one bundled sample experiment (concave, 100 kN, coarse oil)
3. Inspect one experiment¶
rddac.open_h5(experiment_id, data_dir=...) resolves the manifest, finds the right zip, reads the HDF5 member into memory and returns an h5py.File. It is read only and supports the with idiom:
Output:
rddac.inspect_h5 prints the group and dataset hierarchy of an open file or a path on disk:
Output (truncated; the full tree is in HDF5 structure):
0000.h5
├── @blankholder_force = 100
├── @geometry = concave
├── @oil_type = coarse
├── @has_oil = True
├── @has_pointcloud = True
├── force/
│ ├── @columns = ['time' 'load_cell_1' ... 'total_force']
│ ├── @units = ['s' 'kN' ... 'kN']
│ └── data (1140, 8) float32
├── oil_thickness/
│ └── data (421, 2) float32
├── pointcloud/
│ ├── op10/ (z + luminescence, flat (6400000,) buffers)
│ └── op20/ (z + luminescence, flat (6400000,) buffers)
└── sheet_thickness/
└── data (208, 2) float32
Each line that starts with @ is an HDF5 attribute. Groups end in /; datasets show their shape and dtype. Note the table groups carry their own columns and units attributes.
4. First plot¶
The next cell renders the OP10 laser scan, the formed cup after deep drawing, as a 3D point cloud. Two buffers drive the plot:
z: the raw height buffer.pointcloud/op10/zis a flat(6400000,)array stored row-major over the 2000 x 3200 pixel grid declared by the group'sy_shape/x_shapeattributes.luminescence: the matching intensity buffer. Pixels where the scanner measured nothing carry0; passing the buffer toscan_to_pointclouddrops them, so only real measurements become points.
rddac.scan_to_pointcloud turns the buffers into an (N, 3) array of [x_px, y_px, z_raw]; stride=4 keeps every fourth pixel in both axes (~400k points instead of 6.4 million, plenty for a preview). The values are raw sensor units (uncalibrated), good enough for inspection; the mm calibration belongs to the optional preprocessing step (rddac preprocess pointcloud).
import matplotlib.pyplot as plt
import rddac
with rddac.open_h5(experiment_id, data_dir=DATA_DIR) as f:
z = f['pointcloud/op10/z'][:]
lumi = f['pointcloud/op10/luminescence'][:]
points = rddac.scan_to_pointcloud(z, lumi, stride=4) # (N, 3): x_px, y_px, z_raw
ax, cbar = rddac.plot_point_cloud(points, point_size=0.4, title='OP10 - after deep drawing')
cbar.set_label('z in sensor units')
plt.show()

plot_point_cloud returns (ax, cbar): the matplotlib 3D axis and the colorbar. Both can be customised afterwards (e.g. ax.view_init(...) for a different camera angle, cbar.set_label(...) to change the label). By default the points are colored by their z value; pass values=... to color by anything else per point.
Where to go next¶
- Build your own view introduces
rddac.load, the manifest's RecordSets, andrddac.add_viewfor custom field selections. - PyTorch training covers
RDDACDataset, multi workerDataLoader, DDP, and filtering. - Visualization covers scans, point clouds, force curves and traverses in depth.
- Loose HDF5 recipe shows the CSV plus
h5py.Fileiteration loop for users who runrddac download --extract --remove-zip.