Name | pyuff JSON |
Version |
2.4.4
JSON |
| download |
home_page | None |
Summary | UFF (Universal File Format) read/write. |
upload_time | 2024-11-06 19:03:18 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.10 |
license | None |
keywords |
uff
unv
universal file format
read/write
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
|pytest| |documentation| |binder|
pyuff
=====
Universal File Format read and write
------------------------------------
This module defines an UFF class to manipulate with the UFF (Universal File Format) files.
Read from and write of data-set types **15, 55, 58, 58b, 82, 151, 164, 2411, 2412, 2414, 2420, 2429, 2467** are supported.
Check out the `documentation <https://pyuff.readthedocs.io/en/latest/index.html>`_.
To install the package, run:
.. code:: python
pip install pyuff
Showcase
---------
To analyse UFF file we first load the uff module and example file:
.. code:: python
import pyuff
uff_file = pyuff.UFF('data/beam.uff')
To check which datasets are written in the file use:
.. code:: python
uff_file.get_set_types()
Reading from the UFF file
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To load all datasets from the UFF file to data object use:
.. code:: python
data = uff_file.read_sets()
The first dataset 58 contains following keys:
.. code:: python
data[4].keys()
Most important keys are ``x``: x-axis and ``data``: y-axis that define the stored response:
.. code:: python
plt.semilogy(data[4]['x'], np.abs(data[4]['data']))
plt.xlabel('Frequency [Hz]')
plt.ylabel('FRF Magnitude [dB m/N]')
plt.xlim([0,1000])
plt.show()
Writing measurement data to UFF file
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Loading the accelerance data:
.. code:: python
measurement_point_1 = np.genfromtxt('data/meas_point_1.txt', dtype=complex)
measurement_point_2 = np.genfromtxt('data/meas_point_2.txt', dtype=complex)
measurement_point_3 = np.genfromtxt('data/meas_point_3.txt', dtype=complex)
.. code:: python
measurement_point_1[0] = np.nan*(1+1.j)
.. code:: python
measurement = [measurement_point_1, measurement_point_2, measurement_point_3]
Creating the UFF file where we add dataset 58 for measurement consisting of the dictionary-like keys containing the measurement data and the information about the measurement:
.. code:: python
for i in range(3):
print('Adding point {:}'.format(i + 1))
response_node = 1
response_direction = 1
reference_node = i + 1
reference_direction = 1
acceleration_complex = measurement[i]
frequency = np.arange(0, 1001)
name = 'TestCase'
data = {'type':58,
'func_type': 4,
'rsp_node': response_node,
'rsp_dir': response_direction,
'ref_dir': reference_direction,
'ref_node': reference_node,
'data': acceleration_complex,
'x': frequency,
'id1': 'id1',
'rsp_ent_name': name,
'ref_ent_name': name,
'abscissa_spacing':1,
'abscissa_spec_data_type':18,
'ordinate_spec_data_type':12,
'orddenom_spec_data_type':13}
uffwrite = pyuff.UFF('./data/measurement.uff')
uffwrite.write_set(data,'add')
Or we can use support function ``prepare_58`` to prepare the dictionary for creating the UFF file. Functions for other datasets can be found in `supported datasets <https://pyuff.readthedocs.io/en/latest/Supported_datasets.html>`_.
.. code:: python
for i in range(3):
print('Adding point {:}'.format(i + 1))
response_node = 1
response_direction = 1
reference_node = i + 1
reference_direction = 1
acceleration_complex = measurement[i]
frequency = np.arange(0, 1001)
name = 'TestCase'
pyuff.prepare_58(func_type=4,
rsp_node=response_node,
rsp_dir=response_direction,
ref_dir=reference_direction,
ref_node=reference_node,
data=acceleration_complex,
x=frequency,
id1='id1',
rsp_ent_name=name,
ref_ent_name=name,
abscissa_spacing=1,
abscissa_spec_data_type=18,
ordinate_spec_data_type=12,
orddenom_spec_data_type=13)
|binder| to test the *pyuff Showcase.ipynb* online.
.. |binder| image:: http://mybinder.org/badge.svg
:target: http://mybinder.org:/repo/ladisk/pyuff
.. |pytest| image:: https://github.com/ladisk/pyuff/actions/workflows/python-package.yml/badge.svg
:target: https://github.com/ladisk/pyuff/actions
.. |documentation| image:: https://readthedocs.org/projects/pyuff/badge/?version=latest
:target: https://pyuff.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status
Raw data
{
"_id": null,
"home_page": null,
"name": "pyuff",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "\"Janko Slavi\u010d et al.\" <janko.slavic@fs.uni-lj.si>",
"keywords": "UFF, UNV, Universal File Format, read/write",
"author": null,
"author_email": "\"Primo\u017e \u010cermelj, Janko Slavi\u010d\" <janko.slavic@fs.uni-lj.si>",
"download_url": "https://files.pythonhosted.org/packages/87/0a/7edb8344838511aadeddb78b566ad3411b29663612c2d58416b624486dee/pyuff-2.4.4.tar.gz",
"platform": null,
"description": "|pytest| |documentation| |binder|\n\npyuff\n=====\n\nUniversal File Format read and write\n------------------------------------\nThis module defines an UFF class to manipulate with the UFF (Universal File Format) files.\n\nRead from and write of data-set types **15, 55, 58, 58b, 82, 151, 164, 2411, 2412, 2414, 2420, 2429, 2467** are supported.\n\nCheck out the `documentation <https://pyuff.readthedocs.io/en/latest/index.html>`_.\n\nTo install the package, run:\n\n.. code:: python\n\n pip install pyuff\n\nShowcase\n---------\n\nTo analyse UFF file we first load the uff module and example file:\n\n.. code:: python\n\n import pyuff\n uff_file = pyuff.UFF('data/beam.uff')\n\nTo check which datasets are written in the file use:\n\n.. code:: python\n\n uff_file.get_set_types()\n\nReading from the UFF file\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nTo load all datasets from the UFF file to data object use:\n\n.. code:: python\n\n data = uff_file.read_sets()\n\n\nThe first dataset 58 contains following keys:\n\n.. code:: python\n\n data[4].keys()\n\nMost important keys are ``x``: x-axis and ``data``: y-axis that define the stored response:\n\n.. code:: python\n\n plt.semilogy(data[4]['x'], np.abs(data[4]['data']))\n plt.xlabel('Frequency [Hz]')\n plt.ylabel('FRF Magnitude [dB m/N]')\n plt.xlim([0,1000])\n plt.show()\n\n\nWriting measurement data to UFF file\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nLoading the accelerance data:\n\n.. code:: python\n\n measurement_point_1 = np.genfromtxt('data/meas_point_1.txt', dtype=complex)\n measurement_point_2 = np.genfromtxt('data/meas_point_2.txt', dtype=complex)\n measurement_point_3 = np.genfromtxt('data/meas_point_3.txt', dtype=complex)\n\n.. code:: python\n\n measurement_point_1[0] = np.nan*(1+1.j)\n\n.. code:: python\n\n measurement = [measurement_point_1, measurement_point_2, measurement_point_3]\n\nCreating the UFF file where we add dataset 58 for measurement consisting of the dictionary-like keys containing the measurement data and the information about the measurement:\n\n.. code:: python\n\n for i in range(3):\n print('Adding point {:}'.format(i + 1))\n response_node = 1\n response_direction = 1\n reference_node = i + 1\n reference_direction = 1\n acceleration_complex = measurement[i]\n frequency = np.arange(0, 1001)\n name = 'TestCase'\n data = {'type':58,\n 'func_type': 4,\n 'rsp_node': response_node,\n 'rsp_dir': response_direction,\n 'ref_dir': reference_direction,\n 'ref_node': reference_node,\n 'data': acceleration_complex,\n 'x': frequency,\n 'id1': 'id1',\n 'rsp_ent_name': name,\n 'ref_ent_name': name,\n 'abscissa_spacing':1,\n 'abscissa_spec_data_type':18,\n 'ordinate_spec_data_type':12,\n 'orddenom_spec_data_type':13}\n uffwrite = pyuff.UFF('./data/measurement.uff')\n uffwrite.write_set(data,'add')\n\nOr we can use support function ``prepare_58`` to prepare the dictionary for creating the UFF file. Functions for other datasets can be found in `supported datasets <https://pyuff.readthedocs.io/en/latest/Supported_datasets.html>`_.\n\n.. code:: python\n\n for i in range(3):\n print('Adding point {:}'.format(i + 1))\n response_node = 1\n response_direction = 1\n reference_node = i + 1\n reference_direction = 1\n acceleration_complex = measurement[i]\n frequency = np.arange(0, 1001)\n name = 'TestCase'\n pyuff.prepare_58(func_type=4,\n rsp_node=response_node,\n rsp_dir=response_direction,\n ref_dir=reference_direction,\n ref_node=reference_node,\n data=acceleration_complex,\n x=frequency,\n id1='id1',\n rsp_ent_name=name,\n ref_ent_name=name,\n abscissa_spacing=1,\n abscissa_spec_data_type=18,\n ordinate_spec_data_type=12,\n orddenom_spec_data_type=13)\n\n\n|binder| to test the *pyuff Showcase.ipynb* online.\n\n.. |binder| image:: http://mybinder.org/badge.svg\n :target: http://mybinder.org:/repo/ladisk/pyuff\n.. |pytest| image:: https://github.com/ladisk/pyuff/actions/workflows/python-package.yml/badge.svg\n :target: https://github.com/ladisk/pyuff/actions\n.. |documentation| image:: https://readthedocs.org/projects/pyuff/badge/?version=latest\n :target: https://pyuff.readthedocs.io/en/latest/?badge=latest\n :alt: Documentation Status",
"bugtrack_url": null,
"license": null,
"summary": "UFF (Universal File Format) read/write.",
"version": "2.4.4",
"project_urls": {
"documentation": "https://pyuff.readthedocs.io/en/latest/",
"homepage": "https://github.com/ladisk/pyuff",
"source": "https://github.com/ladisk/pyuff"
},
"split_keywords": [
"uff",
" unv",
" universal file format",
" read/write"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "dfaef820940f677ffcdbc40cc2b1d9448b6205a225d8ccebaa9e04920e335753",
"md5": "35f31b6bc23deb88dbad6333ac94f380",
"sha256": "ed9c71ea9566d67f63cde4622279a74eb1f0041880bf34b801978095cc5c0f7f"
},
"downloads": -1,
"filename": "pyuff-2.4.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "35f31b6bc23deb88dbad6333ac94f380",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 62823,
"upload_time": "2024-11-06T19:03:16",
"upload_time_iso_8601": "2024-11-06T19:03:16.189881Z",
"url": "https://files.pythonhosted.org/packages/df/ae/f820940f677ffcdbc40cc2b1d9448b6205a225d8ccebaa9e04920e335753/pyuff-2.4.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "870a7edb8344838511aadeddb78b566ad3411b29663612c2d58416b624486dee",
"md5": "1252ea9775b2a57d9092cf56b896ca06",
"sha256": "4634b7c2fac75ddd8155fb4c5bea01c2834c8f91b5f952116e7ac7d0cb94cdfa"
},
"downloads": -1,
"filename": "pyuff-2.4.4.tar.gz",
"has_sig": false,
"md5_digest": "1252ea9775b2a57d9092cf56b896ca06",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 51205,
"upload_time": "2024-11-06T19:03:18",
"upload_time_iso_8601": "2024-11-06T19:03:18.173212Z",
"url": "https://files.pythonhosted.org/packages/87/0a/7edb8344838511aadeddb78b566ad3411b29663612c2d58416b624486dee/pyuff-2.4.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-06 19:03:18",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ladisk",
"github_project": "pyuff",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "pyuff"
}