Skip to main content

Python package and API wrapper for the ParOSol micro-FE solver

Project description

parosol-py

parosol-py is the Python package and runtime wrapper for the ParOSol micro-FE solver. It provides Python helpers for creating solver inputs, running the bundled native executable, reading outputs, and mapping label or density images to material stiffness.

The bundled native ParOSol solver was written by Cyril Flaig and is distributed under the GNU General Public License, version 2 or later. The Python package is therefore distributed as GPL-2.0-or-later.

Install

Prebuilt wheels include the native ParOSol executable and the platform MPI runtime needed to launch multi-process solves:

python -m pip install parosol-py

For local development:

python -m pip install -e .[dev]

Source installs require CMake, an MPI C++ compiler/runtime, HDF5 C++ libraries, and Eigen headers. Release wheels are built for Python 3.11, 3.12, and 3.13. macOS wheels currently target macOS 15 or newer.

Bundled MPI runtimes remain under their own upstream licenses and notices. Windows wheels bundle Microsoft MPI runtime files under Microsoft/MIT terms. macOS and Linux wheels bundle OpenMPI runtime files under OpenMPI's BSD-style terms. These MPI runtime files are not relicensed as GPL by parosol-py.

Local Check

Before relying on GitHub Actions, run the local verification gate from an environment that has the native build tools:

python scripts/local_check.py

Add --smoke-install to install the built wheel into a temporary virtual environment and import it.

Workflows And Cases

ParOSol-py separates reusable recipes from concrete runs:

  • A workflow/profile recipe is a reusable .parosol-workflow or future .parosol-profile file. SlicerParOSol creates and edits these recipes.
  • A ParOSol case is one materialized run. Shortcut commands write a parosol_case.yaml file with concrete input, output, solver, material, boundary-condition, and postprocessing settings.
  • A .parosol bundle is a portable case bundle for solving the same case on another machine.

Built-in reusable workflows are selected by name:

parosol distal-radius.AIM --profile XtremeCTII --output outputs/distal-radius

parosol 10001_QCT.nii.gz \
  --mask 10001_SEG.nii.gz \
  --profile spine-compression \
  --output outputs/10001_spine

parosol 10001_QCT.nii.gz \
  --mask 10001_SEG.nii.gz \
  --profile hip-sideways-fall-left \
  --output outputs/10001_hip_left

Slicer-authored workflows can be replayed headlessly:

parosol new_scan.nii.gz \
  --mask new_mask.nii.gz \
  --profile interactive_custom \
  --template my_workflow.parosol-workflow \
  --output outputs/new_scan

To run a fully materialized case directly:

parosol run outputs/10001_spine/parosol_case.yaml

Python API

import numpy as np

from parosol_py import solve

material = np.ones((10, 10, 10), dtype=np.float32) * 1000.0

result = solve(
    material=material,
    spacing=(0.061, 0.061, 0.061),
    material_unit="MPa",
    test="axial",
    test_axis="z",
    strain=-0.01,
    outputs=("sed",),
    export_dir="outputs/example",
)

print(result.summary)
print(result.exported)

Use dry_run=True to write the ParOSol HDF5 input and command without launching the solver:

result = solve(
    material=material,
    spacing=(0.061, 0.061, 0.061),
    material_unit="MPa",
    test="axial",
    test_axis="z",
    strain=-0.01,
    dry_run=True,
    export_dir="outputs/dry_run",
)

Material Mapping

Label images can be mapped through an explicit material table:

import numpy as np

from parosol_py import LinearIsotropicMaterials, labels_to_material_map

labels = np.array([[[100, 127]]], dtype=np.uint16)
table = LinearIsotropicMaterials(
    youngs_modulus_mpa={100: 8748.0, 127: 8748.0},
    poisson_ratio={100: 0.3, 127: 0.3},
)

mapped = labels_to_material_map(labels, table)

Continuous density images can be converted with one of the supported equations:

from parosol_py import density_to_material_map

mapped = density_to_material_map(
    density_image,
    equation="power",
    coefficient=10000.0,
    exponent=1.7,
    reference_density=1000.0,
    poisson_ratio=0.3,
)

The Mulder grayscale BMD law is available as mulder2007:

mapped = density_to_material_map(
    density_image,
    equation="mulder2007",
    active_mask=outer_contour,
    floor_e_mpa=2.0,
    poisson_ratio=0.3,
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

parosol_py-0.1.17.tar.gz (26.3 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

parosol_py-0.1.17-cp313-cp313-win_amd64.whl (4.2 MB view details)

Uploaded CPython 3.13Windows x86-64

parosol_py-0.1.17-cp313-cp313-manylinux_2_28_x86_64.whl (20.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

parosol_py-0.1.17-cp313-cp313-macosx_15_0_x86_64.whl (11.5 MB view details)

Uploaded CPython 3.13macOS 15.0+ x86-64

parosol_py-0.1.17-cp313-cp313-macosx_15_0_arm64.whl (9.1 MB view details)

Uploaded CPython 3.13macOS 15.0+ ARM64

parosol_py-0.1.17-cp312-cp312-win_amd64.whl (4.2 MB view details)

Uploaded CPython 3.12Windows x86-64

parosol_py-0.1.17-cp312-cp312-manylinux_2_28_x86_64.whl (20.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

parosol_py-0.1.17-cp312-cp312-macosx_15_0_x86_64.whl (11.5 MB view details)

Uploaded CPython 3.12macOS 15.0+ x86-64

parosol_py-0.1.17-cp312-cp312-macosx_15_0_arm64.whl (9.1 MB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

parosol_py-0.1.17-cp311-cp311-win_amd64.whl (4.2 MB view details)

Uploaded CPython 3.11Windows x86-64

parosol_py-0.1.17-cp311-cp311-manylinux_2_28_x86_64.whl (20.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

parosol_py-0.1.17-cp311-cp311-macosx_15_0_x86_64.whl (11.5 MB view details)

Uploaded CPython 3.11macOS 15.0+ x86-64

parosol_py-0.1.17-cp311-cp311-macosx_15_0_arm64.whl (9.1 MB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

File details

Details for the file parosol_py-0.1.17.tar.gz.

File metadata

  • Download URL: parosol_py-0.1.17.tar.gz
  • Upload date:
  • Size: 26.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for parosol_py-0.1.17.tar.gz
Algorithm Hash digest
SHA256 c63c69fe7fd3645250d805de9d8c68ac788f3b14dc4183e8c6342f06d906b908
MD5 5e42288431cd72f11cd453c4a0a0d28c
BLAKE2b-256 f6bfcde5cc3ad50c4ee7a2b2519425d2ed55a05447116111201368e0a21f50d1

See more details on using hashes here.

Provenance

The following attestation bundles were made for parosol_py-0.1.17.tar.gz:

Publisher: build-wheels.yml on wallematthias/parosol-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file parosol_py-0.1.17-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for parosol_py-0.1.17-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 9a578d807e0fa87a65d26676c6aa9593ed14a0e9f3b7e0868e1177ab1c51b3c3
MD5 95531ab072ed6622ef4724732daa7794
BLAKE2b-256 d782aabc01132c689190d59bd0348a15763fc674924f4666734b4665558e29cf

See more details on using hashes here.

Provenance

The following attestation bundles were made for parosol_py-0.1.17-cp313-cp313-win_amd64.whl:

Publisher: build-wheels.yml on wallematthias/parosol-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file parosol_py-0.1.17-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for parosol_py-0.1.17-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7488f1232ede8a1863f346b7ad53b02bb353d977eb27f905f6ca5318e30550c3
MD5 e3b95307cf1b58d8da22818f60f8a26e
BLAKE2b-256 4bd0035150c0160c881e445b1c9635fbce24fb305a00100e99e7abaaa1900c01

See more details on using hashes here.

Provenance

The following attestation bundles were made for parosol_py-0.1.17-cp313-cp313-manylinux_2_28_x86_64.whl:

Publisher: build-wheels.yml on wallematthias/parosol-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file parosol_py-0.1.17-cp313-cp313-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for parosol_py-0.1.17-cp313-cp313-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 63d86e8a8e389c1996684e09ed5074698321149d4e4e6d6b76a2214c342b7d1e
MD5 7999537588547c4b5f2d502527d6304a
BLAKE2b-256 b52ba704dd35ee0f184320e82dbd9bf712de9a0a33d8722502957c8f7bcf13e1

See more details on using hashes here.

Provenance

The following attestation bundles were made for parosol_py-0.1.17-cp313-cp313-macosx_15_0_x86_64.whl:

Publisher: build-wheels.yml on wallematthias/parosol-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file parosol_py-0.1.17-cp313-cp313-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for parosol_py-0.1.17-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 bba7fb364aae2cf19390621399df890068e3283b5f3708a119c95a1140feef50
MD5 47eb0fc3d6e77ac20cbace72f568ef88
BLAKE2b-256 c092297499b1e587143570f18d84f240b67ed7bb955db00258d043d218b8088f

See more details on using hashes here.

Provenance

The following attestation bundles were made for parosol_py-0.1.17-cp313-cp313-macosx_15_0_arm64.whl:

Publisher: build-wheels.yml on wallematthias/parosol-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file parosol_py-0.1.17-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for parosol_py-0.1.17-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e4f8d27b1e3c2119aff42e4a1d3db5d8644af421bfef1d90706fb31b645cfa57
MD5 b05d2be6dd20ba45e8959d1be65d4617
BLAKE2b-256 3346a468ba6aa8ea3ce2cd730ef5bfeb7f3627cc71bf5cbd50f8e4c77a8df8fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for parosol_py-0.1.17-cp312-cp312-win_amd64.whl:

Publisher: build-wheels.yml on wallematthias/parosol-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file parosol_py-0.1.17-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for parosol_py-0.1.17-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 43eb54d761bc9c4221745f3f78925c4da62f3bd5cffd0ef65fa239a0e76e5e4a
MD5 5e571c8e4cf8de9da5e04af8a16dcb52
BLAKE2b-256 63714402f07b0daa5e63df23af30c8d23617c8a6624d263917d58b2f67c3c1d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for parosol_py-0.1.17-cp312-cp312-manylinux_2_28_x86_64.whl:

Publisher: build-wheels.yml on wallematthias/parosol-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file parosol_py-0.1.17-cp312-cp312-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for parosol_py-0.1.17-cp312-cp312-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 852d2661a5a87d6df76ca7cbe3582744eea3fd3e2aff43d4015fed2c339116dd
MD5 be4bde8ceea60b80521d235d1b70c090
BLAKE2b-256 db2b815d0df7594c946f00f59bcf2d7e892823ec76f56019d5290b69b57fd2ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for parosol_py-0.1.17-cp312-cp312-macosx_15_0_x86_64.whl:

Publisher: build-wheels.yml on wallematthias/parosol-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file parosol_py-0.1.17-cp312-cp312-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for parosol_py-0.1.17-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 0a561ec8faf6afb6f5b1edc43c81ee4bab42dcd5f11b128aad000a10ab5d672a
MD5 1afcdf155865a036ec856ab5555ef6ea
BLAKE2b-256 1cc59461558964150719c94693ffae0fd0eab4d6573ac17784b3ef17320277ab

See more details on using hashes here.

Provenance

The following attestation bundles were made for parosol_py-0.1.17-cp312-cp312-macosx_15_0_arm64.whl:

Publisher: build-wheels.yml on wallematthias/parosol-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file parosol_py-0.1.17-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for parosol_py-0.1.17-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 60be6168dae4431b2441e000bd09bff772977721e67db8d1d07cc6a44f3f9d28
MD5 9c96f0ade3e2e2f644ec56d6660ffc54
BLAKE2b-256 790823443c575eba96c512eb811f6f69280de66d5b37a7198a27376f5537ec9e

See more details on using hashes here.

Provenance

The following attestation bundles were made for parosol_py-0.1.17-cp311-cp311-win_amd64.whl:

Publisher: build-wheels.yml on wallematthias/parosol-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file parosol_py-0.1.17-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for parosol_py-0.1.17-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3b750a2051152ceaf82bb6b985206dd58bcbb9883bbc3ae609910ae383b466b5
MD5 169a6e5630e59a022975b4f4ca179c5e
BLAKE2b-256 a883165ba4d72ca97b3863dadabe6fb3b566679c8429d0d11c13c0f77de37188

See more details on using hashes here.

Provenance

The following attestation bundles were made for parosol_py-0.1.17-cp311-cp311-manylinux_2_28_x86_64.whl:

Publisher: build-wheels.yml on wallematthias/parosol-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file parosol_py-0.1.17-cp311-cp311-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for parosol_py-0.1.17-cp311-cp311-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 e48cbf4c352b09417ff9e4dea5d7888f86594851e531b9783c5ae348a0cbd1aa
MD5 8bb83f85776f6f11104041789695afea
BLAKE2b-256 a94a7769bf83578eb0d5f7cbc09e356e5c4aab8c52093f394bae2b8bf1ccefa8

See more details on using hashes here.

Provenance

The following attestation bundles were made for parosol_py-0.1.17-cp311-cp311-macosx_15_0_x86_64.whl:

Publisher: build-wheels.yml on wallematthias/parosol-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file parosol_py-0.1.17-cp311-cp311-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for parosol_py-0.1.17-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 a3f6a13487578cd07e8c333e426dfac4556073e85d4f04eae3d804d7d70de0e0
MD5 f14c70ad34a82f42d01120933dd3ead0
BLAKE2b-256 aa76ba86274b2c45d2d260d06cf56e21a3fcd8332b825cff45692fa2d0a8d4fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for parosol_py-0.1.17-cp311-cp311-macosx_15_0_arm64.whl:

Publisher: build-wheels.yml on wallematthias/parosol-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page