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.21.tar.gz (27.2 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.21-cp314-cp314-win_amd64.whl (5.3 MB view details)

Uploaded CPython 3.14Windows x86-64

parosol_py-0.1.21-cp314-cp314-manylinux_2_28_x86_64.whl (21.0 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

parosol_py-0.1.21-cp314-cp314-macosx_15_0_x86_64.whl (11.4 MB view details)

Uploaded CPython 3.14macOS 15.0+ x86-64

parosol_py-0.1.21-cp314-cp314-macosx_15_0_arm64.whl (10.0 MB view details)

Uploaded CPython 3.14macOS 15.0+ ARM64

parosol_py-0.1.21-cp313-cp313-win_amd64.whl (5.2 MB view details)

Uploaded CPython 3.13Windows x86-64

parosol_py-0.1.21-cp313-cp313-manylinux_2_28_x86_64.whl (21.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

parosol_py-0.1.21-cp313-cp313-macosx_15_0_x86_64.whl (11.4 MB view details)

Uploaded CPython 3.13macOS 15.0+ x86-64

parosol_py-0.1.21-cp313-cp313-macosx_15_0_arm64.whl (10.0 MB view details)

Uploaded CPython 3.13macOS 15.0+ ARM64

parosol_py-0.1.21-cp312-cp312-win_amd64.whl (5.2 MB view details)

Uploaded CPython 3.12Windows x86-64

parosol_py-0.1.21-cp312-cp312-manylinux_2_28_x86_64.whl (21.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

parosol_py-0.1.21-cp312-cp312-macosx_15_0_x86_64.whl (11.4 MB view details)

Uploaded CPython 3.12macOS 15.0+ x86-64

parosol_py-0.1.21-cp312-cp312-macosx_15_0_arm64.whl (10.0 MB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

parosol_py-0.1.21-cp311-cp311-win_amd64.whl (5.2 MB view details)

Uploaded CPython 3.11Windows x86-64

parosol_py-0.1.21-cp311-cp311-manylinux_2_28_x86_64.whl (21.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

parosol_py-0.1.21-cp311-cp311-macosx_15_0_x86_64.whl (11.4 MB view details)

Uploaded CPython 3.11macOS 15.0+ x86-64

parosol_py-0.1.21-cp311-cp311-macosx_15_0_arm64.whl (10.0 MB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

File details

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

File metadata

  • Download URL: parosol_py-0.1.21.tar.gz
  • Upload date:
  • Size: 27.2 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.21.tar.gz
Algorithm Hash digest
SHA256 4e0b258f42eea7191cfcbf5a3226b46a4e0a5bb1730ab82df38be6438ae5f31b
MD5 1756e68a723eea3ba7510e5739b34f6a
BLAKE2b-256 89e9470846b99ae729e7700ac3e6f6b0a419d12453c6dc5e8a332ea2ac7b5cdb

See more details on using hashes here.

Provenance

The following attestation bundles were made for parosol_py-0.1.21.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.21-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for parosol_py-0.1.21-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 eae156c54fa2d4f1d17af4711f2e60e616181f2005b704fa2a5c3aee473d1d68
MD5 47f42730c2ffb7e5f89255970229dc71
BLAKE2b-256 e7eaa716558765d4bf98708685a2220e0892d8ffb30f8a9d8d6a6d919cf23681

See more details on using hashes here.

Provenance

The following attestation bundles were made for parosol_py-0.1.21-cp314-cp314-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.21-cp314-cp314-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for parosol_py-0.1.21-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ebd5329730836aa62141fc9a9bc5420207643f14121e58fe8060023d50162d9a
MD5 70f9783d684bc57d5638f9a4523779f9
BLAKE2b-256 8ab1f315ff0ff3efe9e67588d6691c69c69256cb30144a38ea8fa94229a2c72e

See more details on using hashes here.

Provenance

The following attestation bundles were made for parosol_py-0.1.21-cp314-cp314-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.21-cp314-cp314-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for parosol_py-0.1.21-cp314-cp314-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 1f49ff9901bbf8f8cf998b76a288819bd855a59da8d63b5f459926e9eac51a4b
MD5 881fb6cdb5b9ff263c18a2042d27a139
BLAKE2b-256 4ca4dc3e3a7976c0edcd5792c253432fcf19b3b4627df33f75b6d1a3e49e8c3e

See more details on using hashes here.

Provenance

The following attestation bundles were made for parosol_py-0.1.21-cp314-cp314-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.21-cp314-cp314-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for parosol_py-0.1.21-cp314-cp314-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 723b62b2a6cdd159d7c3e57b2c037ddf7321ac51419c5e59163c17a8d003be29
MD5 651b83cdc4c35514f413d8b446471166
BLAKE2b-256 3c2d4e1c7728f9ea06c30fe31721866dd47d927fc9c4d22cc18a7b33ce259597

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for parosol_py-0.1.21-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 18944fe75dea5c871fe1d44248ded04608ee987941616b0d7dac9929cd3034f3
MD5 26d4c857d3ccd1acb19b991e26ce69c8
BLAKE2b-256 53f4f3d2b3d50129c81caf14b2bfd29f18f9394c16f642b8a5ecd1c65d32132d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for parosol_py-0.1.21-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 074ec3c9cd722cd9ecbccda81ed63e39d730a868948f27d44baa5231ddccf3f6
MD5 0fe46fa03d4315c29116640b18784827
BLAKE2b-256 e90551123942b29d7fa8d2c60cad675b346f3018db7508ccea672ec4c9492c13

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for parosol_py-0.1.21-cp313-cp313-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 86fd3ffe8f70c7ec4d329f814d6f263b6fc649e2f5d4e69efea1105644ad0378
MD5 d3eeef395a6d0cc68979941529f3c7f2
BLAKE2b-256 0a57e9648093289d34f506d93601de424f64c261d6b9d63896413f66c21be77c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for parosol_py-0.1.21-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 8078fba537d7749f9cf2f428fa6463a56aeeb8bd947adcad8d1f255b8162fb01
MD5 afac802fcc82443e800b039f73ac0ba6
BLAKE2b-256 6054d88fbeda06f45a2bd5012a5451f7ffc532659238cbe5cdf77851c1baa470

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for parosol_py-0.1.21-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b29588408f91d61d67926d5e73350515214b67baa93b4b489c86aa66fc87e333
MD5 e90cbf37c13dbd4f376826a878f411d2
BLAKE2b-256 5602d1171d2838aa38ef86c0b839669eb76eb78e586ed6f1a3a7452471005ce5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for parosol_py-0.1.21-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d78c74c288f62dfe780ceaaa27787b1d9547f7adf85b69d200e8840b24cff6c1
MD5 63e1b76eb973b837b6761604d6e1968b
BLAKE2b-256 39b64d18ce878d66fe04b1004e805d79de020a7a187c6073105204668ef00f93

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for parosol_py-0.1.21-cp312-cp312-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 9f2f738c7374ec3ad18224dcdc10d7631ae998932c1f5992d47173c415308c40
MD5 803800c6f0bd6bec5bbc1b67bf030cb5
BLAKE2b-256 2da31986227a367db9d55cb1db896a21baf4a248213d1a42044d5002cfac5487

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for parosol_py-0.1.21-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 45c003a892c260ab3f8f5a6865802a72f96aaa2d7d41ea90225d8a60bca21647
MD5 e89d42c69d699ace1cde131239837bdd
BLAKE2b-256 35c61ccc81fe0375eebb0911f73a2e67ef120bbbafb077daf197b55ae7a03df7

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for parosol_py-0.1.21-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 4e8f755ea3c8fc5f2461d60cde6a0b2cebf5bc68270c5bf223b75325665001fd
MD5 b35e2f0f50d208a38961f5cc68356a9f
BLAKE2b-256 6e67e2bdebdeb6550434ffac07ffac0ee5597e9f714b2a44b319478e17ceb0f9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for parosol_py-0.1.21-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b58f8055746752f78536c7abd6ff1cd14b4c14709f50fe9ee3afc6dd0f0a67fb
MD5 1f449ffe396af721ce306b20ed91c235
BLAKE2b-256 d3bdd6da426856c4fd3b3259faa8153fa88481d4556db764636d0a4fb007726e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for parosol_py-0.1.21-cp311-cp311-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 37fcffcddc5633769a47f427332d2c251fc68199b8336056e728d96cb570f30d
MD5 aef17eb377246af07f078d26097b82c5
BLAKE2b-256 ef2b2c7e0634b865895ed1b4792e33d2c8938b65a5d5a8c7b0be831da268693f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for parosol_py-0.1.21-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 2ca246d09787d70dd786f300d1b0bf8a15515883e63425eea509b8a8c2464cbe
MD5 c7e80cbea14f11c236545f7e3b557f76
BLAKE2b-256 0be6f2f9dbc92e70e86aaae4a27f89c9af4c795afe3aaf341a77ecdf8b3303cc

See more details on using hashes here.

Provenance

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