High-Performance and Thread-Safe library for parsing binary output files and key files of LS Dyna (d3plot, binout, input deck)
Project description
dynareadout
High-Performance and Thread-Safe C/C++ library for parsing binary output files and key files of LS Dyna (d3plot, binout, input deck) with bindings for python.
Documentation
You can find a Wiki with API Documentation for python.
Examples
Binout
from dynareadout import Binout
bin_file = None
try:
# This library also supports opening multiple binout files at once by globing them
bin_file = Binout("path/to/your/binout*")
except RuntimeError as e:
print("Failed to open binout: {}".format(e))
exit(1)
# Print the children of the binout
children = bin_file.read()
for (i, child) in enumerate(children):
print("Child {}: {}".format(i, child))
# Read some data. This method can read variables of all different types
node_ids = bin_file.read("nodout/ids")
for i in range(len(node_ids)):
print("Node ID {}: {}".format(i, node_ids[i]))
# You can also find out if a variable exists
node_ids_exist = bin_file.variable_exists("nodout/ids")
# Get the number of time steps in the binout
nodout_timesteps = bin_file.get_num_timesteps("nodout")
# The time steps can vary inside the binout
rcforc_timesteps = bin_file.get_num_timesteps("rcforc")
# If you want to read "timed" data (x_displacement, x_force, etc.) you can do so also with the read method
x_displacement = bin_file.read("nodout/x_displacement")
for (t, time_step) in enumerate(x_displacement):
for (n, x_disp) in enumerate(time_step):
print("X Displacement time_step={}, node_id={}: {}".format(t, node_ids[n], x_displacement[t][n]))
D3plot
from dynareadout import D3plot
plot_file = None
try:
# Just give it the first d3plot file and it opens all of them
plot_file = D3plot("path/to/your/d3plot")
except RuntimeError as e:
print("Failed to open: {}".format(e))
exit(1)
# Read the title
title = plot_file.read_title()
print("Title: {}".format(title))
# Read node ids
node_ids = plot_file.read_node_ids()
print("Nodes: {}".format(len(node_ids)))
for (i, nid) in enumerate(node_ids):
print("Node {}: {}".format(i, nid))
# Read node coordinates of time step 10
node_coords = plot_file.read_node_coordinates(10)
for i in range(len(node_coords)):
print("Node Coords {}: ({:.2f}, {:.2f}, {:.2f})".format(i, node_coords[i][0], node_coords[i][1], node_coords[i][2]))
KeyFile
from dynareadout import key_file_parse
keywords = key_file_parse("path/to/your/input.k")
# Parse all nodes
node_keywords = keywords["NODE"]
# Loop over all *NODE keywords
for i in range(len(node_keywords)):
# Loop over all cards of each *NODE keyword
for j in range(len(node_keywords[i])):
node = node_keywords[i][j]
# Then you can parse the variables of each card as integers and floats
# The list of integers holds all the widths of each variable in the card in characters
nid, x, y, z = node.parse_whole([8, 16, 16, 16])
print(f"NODE {nid:d}: ({x:.3f}; {y:.3f}; {z:.3f})")
Other languages
This library is also available for C and C++ this version can be found here.
Installation
python -m pip install dynareadout
Uploading to PyPI
-
Make sure that the dynareadout submodule has the correct version
-
Update the version in
setup.py
andpyproject.toml
. Also check if new source files have been added -
Publish a new release
-
Create source distribution
python setup.py sdist
- Upload to
test.pypi.org
python -m twine upload --repository testpypi dist/*
Then insert __token__
as username and the token as password.
- Install package from
test.pypi.org
to test it
python -m pip install --upgrade --no-build-isolation --index-url https://test.pypi.org/simple/ dynareadout
-
If it works upload it to
pypi.org
-
Create windows wheel
python -m build
-
Upload windows wheel to
test.pypi.org
and test it. -
If it works upload it to
pypi.org
python -m twine upload dist/*
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for dynareadout-24.1.1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6183e4d53064c7c68165ec98ff1f935ad67aa42f8c462c0f64bb20fd014e03ec |
|
MD5 | b813a413305f424096a0bea2071baf81 |
|
BLAKE2b-256 | 385dd87cc5c4a2548c41ab218451c42675ea92343af89b87029feb5d6897535d |
Hashes for dynareadout-24.1.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f1eaefc279cc73730fc708aea62dffb896dce0993dc6b633a6cabbe48e73dc3 |
|
MD5 | 7e694f855b59e9352ff333f01a72969a |
|
BLAKE2b-256 | c8164fa4ce1ef8e967ee8ee312d380c38155daa92dbdd961c0f1ec50bd25f9b9 |
Hashes for dynareadout-24.1.1-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 528fa8bff7466a5808680c9c45da3dea2cb8cf4d862969dfeab541c8d9e2502b |
|
MD5 | a8afbf56659e37cb8f285071d0c72663 |
|
BLAKE2b-256 | c9e63f84b26be767f5b22fc10110396e2d0c102e814c66efc7050bb47572c853 |
Hashes for dynareadout-24.1.1-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65578d35b431fe20c6d42ed293ffbac7e45a5094011311da78873eaa813494ab |
|
MD5 | 36add999b04455b08520c3928f01b5b7 |
|
BLAKE2b-256 | d962d7ada609ac34ed4a7b19bbf6a7ac768f72ae2646ca26ed59d54e22f533d8 |
Hashes for dynareadout-24.1.1-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f67d3384f07309d9709f466d25a5ad615a6bb86cdf042f2451ad2ae0858a550 |
|
MD5 | f4fa6733a145977755b32df28dc82351 |
|
BLAKE2b-256 | 8221899449b463bb7c6980701633598a6280fe63cc3f0af0364e64325cd3221a |
Hashes for dynareadout-24.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a454839bf46999408325af4ddbe25d1ed6123ffb3c9620e046bf77aca49c74a8 |
|
MD5 | 3d1b02f1da33c1ece537dc5c95a9b77e |
|
BLAKE2b-256 | febd42f964d94ed58aa603bb07df95bb63cc75ade168154f747f55ee5d8bfb69 |
Hashes for dynareadout-24.1.1-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6aaae19909316d10b4d5fbd64d5e5c81ab161fca582e3d84e2ab3c1c7ba66b4b |
|
MD5 | 7ba536f339139e8596234f2213d167ba |
|
BLAKE2b-256 | f686deb55a16663e56aaba4395c18ab68c4adf5176ebf47b577544762af9bd99 |
Hashes for dynareadout-24.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3140dac9fac65383d95f7d3a571fb2aeae49322618ee1765c3b76430ab5d9cb1 |
|
MD5 | cd5d2717e4c21e594bc9a1e69210a654 |
|
BLAKE2b-256 | c90ca0e40969201d095434b948f04ea6712a2dc85c036cd1461a70aae41ad6e6 |
Hashes for dynareadout-24.1.1-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1755196d15199cb08c97a082cc2e3b6307528d86a6aed2d6d8d784fc37bc416d |
|
MD5 | 9e74c2ebfde77269bdb82fd550b6cd67 |
|
BLAKE2b-256 | 4a2da0f2421a06b6619b05667f39f950db93c539fa340a0d9b5472aa88059d1f |
Hashes for dynareadout-24.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ffd99ee93e3b80287919b5be4a35734c65159555b9101c6932202d97c683b28 |
|
MD5 | 2efba1a0912228ce51e8f376dd85bda8 |
|
BLAKE2b-256 | 8d75db69cefbaf293cbc0cd34fbb36b55bf53c8ec54ec7d14527cd2f2b36ff28 |
Hashes for dynareadout-24.1.1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 791a6e702ecab633bde3a51f744f03d1ab601e73b259e5316ea31a1acfdfe3a5 |
|
MD5 | ad75e4ec9314313835465742893c2001 |
|
BLAKE2b-256 | 2e2e8d023490988a825060a17711aeafdc8afd1d1eedc887d9ae6a53240f6c68 |
Hashes for dynareadout-24.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82277fbb42ff5562dbf5f3620c6180b232fdf192824f0a326c3cd99dbc876d42 |
|
MD5 | f31579be95e539f7b1253e605c493683 |
|
BLAKE2b-256 | e981615f60e4fbd75f4e5345ec5ca1dad1195c6975927e06560933ad058e6842 |
Hashes for dynareadout-24.1.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4fc59ade60da65fe904fd34c50c99f996b96800d92d04a0f7f2a010c8ade99d6 |
|
MD5 | 16f13a5244cbad35ee5c7689db58ab00 |
|
BLAKE2b-256 | 9f1c8dc0410615edcec4ecf79e1b33192bd47b5f65aaa84a6e087f77d909c9a0 |
Hashes for dynareadout-24.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68f1cd39e74eb4634be5d9b71be5806b3f0c3bd96f99eda6b125d254b2c803c4 |
|
MD5 | 3a4c40e6eda8f0736d22c864ef74c9d3 |
|
BLAKE2b-256 | 0d11929165667da3d0ed91bc8f531f80a6ae16f7726ed1171331110e9534fd8a |
Hashes for dynareadout-24.1.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8b23d3fdb97d580de05622d06fe7554ea02a22de55fa9d88612d710fbf121fe |
|
MD5 | b78ac4043e23601aa1061ce542dde4be |
|
BLAKE2b-256 | c5873620e5d938de1629ba9d4f2fc2141fad14bb95ad315712fd103b64a4e16a |
Hashes for dynareadout-24.1.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 184b009c0a234bb834fdb5c5f9d81287cac671f72199e3332d2404675f20e929 |
|
MD5 | f83a01dd60bb1fad739a66ff49a28aaa |
|
BLAKE2b-256 | 68e02c111958aa4954ce21b1faa4d27af9f545b32b62fae22aa727607fe16fe1 |
Hashes for dynareadout-24.1.1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 592e100d2d55d749eab62590aefe01e5c8f4ed63362e23e632b4127945d60ca0 |
|
MD5 | 8d2e78d5a54514e173b656a2bf489a42 |
|
BLAKE2b-256 | f4c20a363e44fd4e26dd6b16b6768edae1c9c4741279ee06a3bb211eadf1fdeb |
Hashes for dynareadout-24.1.1-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57ef638dc301cf040b089cb5ec2e3dc5c63ca0768984211bb53c5609fb367e4d |
|
MD5 | ee4b23b22f6aef9fe5a17a8fa039211f |
|
BLAKE2b-256 | c2c29210e69754ea864fdac323f7f578856ae9ff94cf84378a1d8620b866a227 |