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.18.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.18-cp313-cp313-win_amd64.whl (4.2 MB view details)

Uploaded CPython 3.13Windows x86-64

parosol_py-0.1.18-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.18-cp313-cp313-macosx_15_0_x86_64.whl (10.5 MB view details)

Uploaded CPython 3.13macOS 15.0+ x86-64

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

Uploaded CPython 3.13macOS 15.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

parosol_py-0.1.18-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.18-cp312-cp312-macosx_15_0_x86_64.whl (10.5 MB view details)

Uploaded CPython 3.12macOS 15.0+ x86-64

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

Uploaded CPython 3.12macOS 15.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

parosol_py-0.1.18-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.18-cp311-cp311-macosx_15_0_x86_64.whl (10.5 MB view details)

Uploaded CPython 3.11macOS 15.0+ x86-64

parosol_py-0.1.18-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.18.tar.gz.

File metadata

  • Download URL: parosol_py-0.1.18.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.18.tar.gz
Algorithm Hash digest
SHA256 c5617f415dcd1eb9c3dddcf44e354aa8e4f8e16c8593b145fa3f3f849c716e19
MD5 ef5c523425c310d9f8d547a62bd95076
BLAKE2b-256 515d2902913e8fefe1679853799283d80f805812099f525911a69331a2f73683

See more details on using hashes here.

Provenance

The following attestation bundles were made for parosol_py-0.1.18.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.18-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for parosol_py-0.1.18-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 8a6c0c3e0543e51252385efe59e68deb39f7c94d5b805b9db15bee42b8406360
MD5 c873dcd03fdadcfb9259bf21760653d8
BLAKE2b-256 79907d53729512e84c0bd7f4d351ec66c91ccbfccba362f843a1dd266263270f

See more details on using hashes here.

Provenance

The following attestation bundles were made for parosol_py-0.1.18-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.18-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for parosol_py-0.1.18-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 cf99522ff82306a585c0a676efd1f9749b4860eaf9521fa6a154673652d85c45
MD5 92deb671e5972331186e2eb2bbfe34a0
BLAKE2b-256 d7361e572be8efcfb2594c0507c238d065b0417666176f394ca7977b05c41c8a

See more details on using hashes here.

Provenance

The following attestation bundles were made for parosol_py-0.1.18-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.18-cp313-cp313-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for parosol_py-0.1.18-cp313-cp313-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 42aaf2c2b5f85e4656576b44d6626fb0b4188863b8a915551c4148aee90b1f24
MD5 61979339750e5379f8af8adc93c07c6b
BLAKE2b-256 598d848715c1e3ae08e731189c6d6bed66764b4e3dc2c4d9f084c0b6d72d64d7

See more details on using hashes here.

Provenance

The following attestation bundles were made for parosol_py-0.1.18-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.18-cp313-cp313-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for parosol_py-0.1.18-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 bdd48190ee83d31960ce6c7af47be96dca313fc6b8e82ae8b14fe49a4ba88699
MD5 039e3e1e4b53e0425a696d68f94ae827
BLAKE2b-256 1ead38c8791018950860b2c2c043d3f44558110d45a19c3072793d5973b4783a

See more details on using hashes here.

Provenance

The following attestation bundles were made for parosol_py-0.1.18-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.18-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for parosol_py-0.1.18-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4cb9bb10148170abe0b42f22a5009de18a5200b4490a235e7bf9de2f90dcccb5
MD5 40145be9d20497917bebea3c54cd58da
BLAKE2b-256 6a84e9233fb21270a4a45fe927a371d104cbd4f0f30c3f28ad041a820c7ac291

See more details on using hashes here.

Provenance

The following attestation bundles were made for parosol_py-0.1.18-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.18-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for parosol_py-0.1.18-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 56f17d2d5054206b6b07c88bd4b70719231e4b39bbbc486edfc0c1f5485ec595
MD5 80edbfb73f3e55b20511ef9ab2f20239
BLAKE2b-256 f79935fc88a8615c9de9b8300e25bd740d610569ad1b6862915e20602d27f548

See more details on using hashes here.

Provenance

The following attestation bundles were made for parosol_py-0.1.18-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.18-cp312-cp312-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for parosol_py-0.1.18-cp312-cp312-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 2d846a7cb0edc5126ea7203b82b172a3e583491412adb92e1051ede624e68b3d
MD5 b8e2afe4f8398871e1fad69a5a90e2c5
BLAKE2b-256 1cfc85f10b8b90915971e48a67c98553f597f4ed42e804cd212e7f71e31f30ac

See more details on using hashes here.

Provenance

The following attestation bundles were made for parosol_py-0.1.18-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.18-cp312-cp312-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for parosol_py-0.1.18-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 c4dfaecf2ada85f93149989ed3b399ddf3ff74c6125158da3f6591e070b91f73
MD5 32c6d7e30eca0261afa664f0c99e9367
BLAKE2b-256 92cbffdd6e11ef44f2531db7ae4c76db595ca13582cc8454100826367538622c

See more details on using hashes here.

Provenance

The following attestation bundles were made for parosol_py-0.1.18-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.18-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for parosol_py-0.1.18-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 42cdeeea04181a7f25d6e159e5d81bfa6faef5ecd6d3b550cea76ae29152d81b
MD5 b6bcca95423df31361eeb64a11026b11
BLAKE2b-256 7260d03dc903c6fcc108ef8b7ed2b26ed315c84a0ffaf6ef1013bd3ee867e1a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for parosol_py-0.1.18-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.18-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for parosol_py-0.1.18-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6ea521473205e37633508800103981a53feb4cba5eb66f1105b7086c1ee3c808
MD5 20c0b5029dea52f874ff93ea37e20417
BLAKE2b-256 12add13ca3c07bcf8cc2459b24cd3d9e56a322248c7e50baa7ebf90631f33345

See more details on using hashes here.

Provenance

The following attestation bundles were made for parosol_py-0.1.18-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.18-cp311-cp311-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for parosol_py-0.1.18-cp311-cp311-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 6f45338fa33b2afb1102bf2ddb90f5efaa166839de21757568e3dce5a93786c0
MD5 33deff875876cd39b44b84a2e54bacce
BLAKE2b-256 0f4fc378da903dd0050e95eb3e80a733f37f2e037f674740656cf372ab238e35

See more details on using hashes here.

Provenance

The following attestation bundles were made for parosol_py-0.1.18-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.18-cp311-cp311-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for parosol_py-0.1.18-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 20c67323f6ff3bc7f7c47785d49ef7dfbdf017babdae10083dc62b8819138fb0
MD5 fa23172e0b3bd0dadb31203c812ff5f1
BLAKE2b-256 9760e4fba4e8e001a640f165cc67b1b291d08c4d8a761b46e8a7190a74a53eb2

See more details on using hashes here.

Provenance

The following attestation bundles were made for parosol_py-0.1.18-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