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.20.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.20-cp314-cp314-win_amd64.whl (5.3 MB view details)

Uploaded CPython 3.14Windows x86-64

parosol_py-0.1.20-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.20-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.20-cp314-cp314-macosx_15_0_arm64.whl (10.0 MB view details)

Uploaded CPython 3.14macOS 15.0+ ARM64

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

Uploaded CPython 3.13Windows x86-64

parosol_py-0.1.20-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.20-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.20-cp313-cp313-macosx_15_0_arm64.whl (10.0 MB view details)

Uploaded CPython 3.13macOS 15.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

parosol_py-0.1.20-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.20-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.20-cp312-cp312-macosx_15_0_arm64.whl (10.0 MB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

parosol_py-0.1.20-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.20-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.20-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.20.tar.gz.

File metadata

  • Download URL: parosol_py-0.1.20.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.20.tar.gz
Algorithm Hash digest
SHA256 676382f708f9a805a06b86f4680d512dc1bf1d92a3f9ba392a2f5941adaa00c3
MD5 c46670e650d391e9e39ea8266c9c3a52
BLAKE2b-256 3184bf7e57a4e084a674fa7d063ea2f2c42b47eeefd35b7783708422b21a1f27

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for parosol_py-0.1.20-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 2f3d617a84f89de98d518e0d906ebed83f72529aafcd95a3b13ab6c691f004c4
MD5 b2b8649c78180266cb2948463287b486
BLAKE2b-256 18e142a6c70359bc14e754de0e5de76b8902a8f55d38d76b9b6f232f6fec5e12

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for parosol_py-0.1.20-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 76f159cf43c767344386ad99ea3ab3ae8adc1737d1bf0425480a96368a6c71c9
MD5 c9c95dabcc61d168754e2fa793e25dbb
BLAKE2b-256 d312131fc0dbda9cbbe2cd5b1174f17238a889cbc21a248955d37018f465d719

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for parosol_py-0.1.20-cp314-cp314-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 c8f9753db21134f5c7b58ca7cad3a1aecf05ed15943086362571a55130a4a63d
MD5 14c2363e0c30b2a184d0b5211c77b511
BLAKE2b-256 29a37e1a300b44fe8a9438843b6caf0ca4a768d0b4047b3ea196df11a8313c3f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for parosol_py-0.1.20-cp314-cp314-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 81b0df9f9b6fb457a675644ed8da822c5090587bacbcccfb6d21aba7bfe01907
MD5 01145cf13da4d795b9abc32feefa67ea
BLAKE2b-256 73e926c83b83b391eeb86f9f098c404a0f01ecd4c81ba5b622502221b1e852ca

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for parosol_py-0.1.20-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 4e98e3b47bbb82736a816bfdaa08e00338899adfd945d8e0f5f1bd5c5f943db9
MD5 ebb7d0e99365dee43f83be796c896dff
BLAKE2b-256 221746724a5266026f22cf072e8eb1aa1000b107dae4abc4f8892cc9d8c30dae

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for parosol_py-0.1.20-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 60adb60ca587c88685a1ec31203afadd0c1e6a64a7d78f1f370a3b90e5fad149
MD5 91c0f7a31330f7f4f0e8a9e9d5698ee1
BLAKE2b-256 a462863617b943fd4fff790e08e1518f57c847b0a0d099b543a073df7e6f4ae4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for parosol_py-0.1.20-cp313-cp313-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 6489fde614d896f50eadcf70d0af30855989ef9553a89c5166df1089522d1a3c
MD5 cd67f4a4c27206aff689de261e9f5506
BLAKE2b-256 5f1f05c21d3332b5d97d792c8b2c066df5b74571f8b515039f6e307998367a52

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for parosol_py-0.1.20-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 d85ffdee72e8ef2935f405f6d16be6b22de23846c36db37c453923cddde4ff48
MD5 c067766f51302c7592747840b0096915
BLAKE2b-256 83b1daf8feb6508a78841c82f635b35fdd8097efa29948bb0132dfdd38d6fea4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for parosol_py-0.1.20-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 29a6a9eada1cb08459eb259dc0593283a07e1416ea575a6d053a1f0e715fa6ef
MD5 c9480e3da1793ba0c73eb03e6c91ea0c
BLAKE2b-256 19ad3a0a77f509abf848f58a518b0216c78555aa7ebcc67370d5c644da7cbd09

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for parosol_py-0.1.20-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 cfd1688b801106fcbee7cff30651790cffbbce97d979e0ed0a229f72e7aa4fe1
MD5 d72da250a548b993ab7289486fd2b144
BLAKE2b-256 bb2c793b4f98980578ccbf4098724ca6f1f6e0f5e008dcfedc50f203ce88a80f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for parosol_py-0.1.20-cp312-cp312-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 576302304dbe081ad752003bee88b37755974da4f1cfa6a98cee02737bf5c49b
MD5 53c9d8f32f3b03765dd473eb981140c0
BLAKE2b-256 8d86202433019001fd354f443fdd7265bbe7194497cf02cdd40063de0b638f68

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for parosol_py-0.1.20-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 9a6f1ea22cf69f7b177c2d11a71a42b304db1bc320a04383a7cd974216c52a37
MD5 5d5b9c1a0fadc2696a7e80198422bf38
BLAKE2b-256 d4186fb90f883099c6a4e8c88bb6346570355a67f283deb652f535b356861833

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for parosol_py-0.1.20-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 8f50624f05f4881940c00a588cfdd42b3efeb963b02fce199cf6768ee70433de
MD5 6f93244141a95edd200d1b043b21c73a
BLAKE2b-256 5b8426e46eee0c25f8bef1900305b4027d3c0c7f5aafbf5194110b2a148bd77e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for parosol_py-0.1.20-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b5feb762619c1a9cec9cdc327a2ec936f361bcc7ecfb3846cc6eb3495ce478bb
MD5 04a35de5d9b736c17433a1428ae97c6d
BLAKE2b-256 f7066275381a4e5d19fbb0e4490e9e48aabbb9a3e62ad6ac33fa4b005cd8dd31

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for parosol_py-0.1.20-cp311-cp311-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 ec4594ede9970c4f6cf30f6583f94477a078a9b4a62dd3d1dc1bddfa0db8d935
MD5 3b61bea800d822a978f8e27dd5bf6532
BLAKE2b-256 9a26c81e16266c801a4c9b62429ff13c1cd89122e4ec994d09294d3208a8b165

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for parosol_py-0.1.20-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 31d4a24fd5b05561e08cb1e4732f3ed99198352dcbeb16b2d971af9b63c64ec2
MD5 7b9d5c82d8f68f7e357e16e68c5e7db3
BLAKE2b-256 4507fe69644d3f6307bb16616834cbf0cdda07b409244953e62cd8f0267f8ef0

See more details on using hashes here.

Provenance

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