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.2-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 965b51746b65081d10b0dfda117ffca637f961cae479f89feede83ce33ac0727 |
|
MD5 | 552380972a0e34d359ee5cf51b35c448 |
|
BLAKE2b-256 | 3f8d07b85d46c4c90d210d42ed05538e1ed2d58b4cf558833ab7918084cf3956 |
Hashes for dynareadout-24.2-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b6deb9fd05a9de76f7bc08d4e3cfdec69ceb0bcb5a1d03359514b40605a964d |
|
MD5 | 15a3e6c94fd1cf5db19052b6125b4458 |
|
BLAKE2b-256 | 353a5e2797085f1c42fcc965f93ff093358ceb46058548c4cf65f4dac4f7f34b |
Hashes for dynareadout-24.2-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd985b0b19e3cc49ea46d728ac852df53b95653adcc45681c29882f39fa0b60a |
|
MD5 | b94de8c9852deca16c0460d0d2c3d9da |
|
BLAKE2b-256 | dc29793f67f6bc7d69629165f4dda4a01c47c1a84c9e272af5d6425617e86be1 |
Hashes for dynareadout-24.2-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d959ddf3b2e449fca11ad9309016c45709eaf11d17b10be7085ed3904f61e499 |
|
MD5 | d62e2adf6b5165022541dae75546b2d8 |
|
BLAKE2b-256 | b80ebc693e77500afe94b7bd09952f2576b63c91aa503de8794ac3fc94ceea58 |
Hashes for dynareadout-24.2-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c6986aded8b7e0679b6e161ab76bd86d385eeda5805b2474c92c6831f25ff1c |
|
MD5 | 12e89aebe23af59bb10cf08472fba15f |
|
BLAKE2b-256 | 27f9d6560204732b5de26ecb1c041bca4c6e19a45b22a42bac09600e49eba3b4 |
Hashes for dynareadout-24.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 759d466b5af3594ffc15f6180b9bcfcdf42b3eddb8cbbf977d5175ab35cb38f4 |
|
MD5 | 88d873270b774401099d598196cb04c8 |
|
BLAKE2b-256 | 323108cc783f025836ad49a4ee3a06518e0e633c219c97f707cbe80fabdbf4a6 |
Hashes for dynareadout-24.2-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e44c294de9f547ec1e99b0f4fd968ab31f9c0b376259c6cdeb0d16025be17ed |
|
MD5 | 4f1bbd19ded062eec97074eda7cdf358 |
|
BLAKE2b-256 | 4743c3afb6296a4b46e1565cc03fc3b7497ad5c97d490c2404ca3f20523a978b |
Hashes for dynareadout-24.2-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27dc06f488a04788933ce7658724c569fdfd4c2f3432e30477f625b34ee39062 |
|
MD5 | 9396224d9a1f026f0c51ab7413359def |
|
BLAKE2b-256 | a205145b5042dcdef3eb7428daf382c17774514d532e40f1cb6d889f8aa98d11 |
Hashes for dynareadout-24.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ad1e61a561c795cb7f476304fee6ca2e79ddf93e0d7981dd15caead52817943 |
|
MD5 | 7dd5c7f38a2f5876c6a0c96c413b7cab |
|
BLAKE2b-256 | ed425177001c59b65920e497a2d805919f3f8c666ebf585fe59bc7e4b7fea05a |
Hashes for dynareadout-24.2-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d89dbc815b544f14ecb4685f9661657fa336040808750470ee7c4fa82045c4b5 |
|
MD5 | 1be19516fb64e992be5527f5328e2989 |
|
BLAKE2b-256 | ff90394dac3bab6fce78843eff874597dbc8574a38b64502342c2bf40618fcdc |
Hashes for dynareadout-24.2-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac2449a8622207c7e8aef336e9e5a4283d3e4d278d64cdea11ce9cec7b5a821e |
|
MD5 | 7be1cfa06c04420cc7589f5eeda2120c |
|
BLAKE2b-256 | 2f92dc173af8175223987781279de3e5307926e20d00be5c6de991f03a839eec |
Hashes for dynareadout-24.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ee741920f57fe49ee879023102b469869ec8d802adcb7def5c66e64cecccb65 |
|
MD5 | b88cf754eaedec1b94d166fb8f867525 |
|
BLAKE2b-256 | 4a103015c8dd2e3ff7ec476a057c44e0951b5abeeebb1682ff3dad6873feebe7 |
Hashes for dynareadout-24.2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8edb0d4b738d436983bc95439786058f3c221b004d50219a3f3e22d2296704c0 |
|
MD5 | baa6e656e50443fd2d0872dd1f3d5093 |
|
BLAKE2b-256 | b062873c8f684818033d6925d0c04c49cf6774f72dd5f1aa3740e22b559a8108 |
Hashes for dynareadout-24.2-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63f7a6d56c3642facf54dc10b0a7dd583e25f4f268c41395e4bbf7d30c62977c |
|
MD5 | abe4b5b93f67e487fe79d5e8770a7725 |
|
BLAKE2b-256 | 308e101094ff7d87e472108673cc96d218d24ebdb5ec9e0fc00f151713246694 |
Hashes for dynareadout-24.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5372e1713cac727845c6569eca539c175e7cc1d53df7ce45434e36e60104ee4e |
|
MD5 | 15f716f6dd11f967ff62ad360c12149e |
|
BLAKE2b-256 | 018cfd0060591c6c8f37d3f8e52afe20e5060fae147c7f7df4225918266b698c |
Hashes for dynareadout-24.2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e9a81257bc354334d87ffc53894905c63df3d1960d76c423b5c73bbc3d3b2fa |
|
MD5 | 5ab7fe2e2469bdf998a67ac5280f18fa |
|
BLAKE2b-256 | 8882e2cb26a3d5b2aa8cfa4dd25ba8edb1aa7cf141775a7113fbb7c2c6a7293e |
Hashes for dynareadout-24.2-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 71cf2203ffa72c015cbf04be01007c38d55c4d7cac702026ad4eae5a6f3358bc |
|
MD5 | 68bf9f9787d590cc39d71e0112662a5b |
|
BLAKE2b-256 | d5a175289ca3436a99355aa6cabb6e92e190ae5fb4bf5f04fbd48c6a4a4fa35c |
Hashes for dynareadout-24.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e49c584927dbdf42f3b6fa7332f5d876151a4136f2dab96b30c1a3a8466f4156 |
|
MD5 | c984ed7fc59d5309c34d07b02799fa73 |
|
BLAKE2b-256 | 799ec4606d28168b052957a51201e9fbe89e124fd2c834f9ce774581f5a50206 |
Hashes for dynareadout-24.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03fdfc2f8c84729944ed2a1264062168f791bf4f9234108af42a9bec4694cbdb |
|
MD5 | 7a18fbd6ecd2cc9311b08b8be7bdb329 |
|
BLAKE2b-256 | 7f8db233e2f5aaf623c1879de948bf028130da623ed2b9719a768973a2aa2c0d |
Hashes for dynareadout-24.2-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c41507e44e73e42c88ae6701372490748030f820b9ed470107d374f56e84ba1 |
|
MD5 | 077defbeabe3c7d138238e853e6dfc41 |
|
BLAKE2b-256 | 7804a716ca1a0ed57e28f5a56b5d9d76e537dc1f5114f483a82f02065cabe697 |
Hashes for dynareadout-24.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5b1d47bd3c212e35473870e9650e0acdb6ee795b87b2a30073c134d377a686b |
|
MD5 | 64878a9c58bfce8a5b043c2708bab98a |
|
BLAKE2b-256 | c79a47231f31a5289cb6afa03bbd40631b60aa372ac3bf63055ea68546d248c1 |
Hashes for dynareadout-24.2-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b7dd185cb436b82a1726ab35455a4ebb11e5fe7cd9fa1ccce831799e93b216c |
|
MD5 | 6b0f61cdf24ff087fa9f5693cd00d9ef |
|
BLAKE2b-256 | c80bf2808b49a2d543220aa2b5573f4098ab13c61b56cda79cc13b1e54628255 |
Hashes for dynareadout-24.2-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a9204e2d195e392e6164456593fed3ae669fcd961ee0870ed51b6078b555e476 |
|
MD5 | d8d9d9834bf8a62120c5ca14e5b7d302 |
|
BLAKE2b-256 | c54e38dac15d68cc3d7662d186e3f45d28541c7fc3522547df4a41b9ed5d5fca |
Hashes for dynareadout-24.2-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2bc1ede99d8c2d6b56c81162d79f5a57cdacddd0d37d2e271e7adf492d73150f |
|
MD5 | cf5bee1c5f41a249be1d958a12a5c9c5 |
|
BLAKE2b-256 | be51589162a5e76745342a153d7c22f1638876252901e49abc48ce4a72a46aa6 |
Hashes for dynareadout-24.2-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2dde7efafbfa0511a51cf908e81d3d145ddcf01a9e03fea0993c50aa0b71e089 |
|
MD5 | d6a7d844403d2342ad2c59e8f2dec044 |
|
BLAKE2b-256 | 3960d5d6dd99f64def7eb31336d53e56897d1ea950cb03f7c7ddced0bc4673c8 |