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, 1858, 2400, 2411, 2412, 2414, 2420, 2429, 2467 are supported.
Check out the documentation.
To install the package, run:
pip install pyuff
Showcase
To analyse UFF file we first load the uff module and example file:
import pyuff
uff_file = pyuff.UFF('data/beam.uff')
To check which datasets are written in the file use:
uff_file.get_set_types()
Reading from the UFF file
To load all datasets from the UFF file to data object use:
data = uff_file.read_sets()
The first dataset 58 contains following keys:
data[4].keys()
Most important keys are x: x-axis and data: y-axis that define the stored response:
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:
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)
measurement_point_1[0] = np.nan*(1+1.j)
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:
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.
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)
Release files for pyuff 2.5.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyuff-2.5.7.tar.gz | 55.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyuff-2.5.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 125.4 kB
Release files / pyuff-2.5.7.tar.gz
| Download URL | pyuff-2.5.7.tar.gz |
|---|---|
| Size | 55.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e74e8a381f533e859596ef6c7364e29e1bd4ae1f2e87095264e647d3a1199765
|
|
BLAKE2b-256 checksum How to use checksums |
c6c94653ef1db7ee7f3b238c6355528d34ed0f3764c6032dbf13b73fd7dddc4d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / pyuff-2.5.7-py3-none-any.whl
| Download URL | pyuff-2.5.7-py3-none-any.whl |
|---|---|
| Size | 69.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
13cffc446f00f7a8c02bf5c74345ab7033c2bbe10dd4c959f06ee273d8f508f1
|
|
BLAKE2b-256 checksum How to use checksums |
3df51fc40a37e7ce86d06e13f3525270e6d3fbe245507dbf1b30a60783fb5582
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|