Scientific Data Format for Python
=================================
SDF is a Python package to read, write and interpolate multi-dimensional data.
The Scientific Data Format is an open file format based on HDF5_ to store
multi-dimensional data such as parameters, simulation results or measurements.
It supports...
- very large files
- up to 32 dimensions
- hierarchical structure
- units, comments and custom meta-information
For detailed information see the `SDF specification`_.
Installation
------------
To install the latest release from `PyPI <https://pypi.python.org/pypi/sdf/>`_ or update an existing installation::
python -m pip install --upgrade sdf
To install the latest development version::
python -m pip install --upgrade https://github.com/ScientificDataFormat/SDF-Python/archive/main.zip
Tutorial
--------
Import the ``SDF`` and ``NumPy`` packages:
>>> import sdf
>>> import numpy as np
Create the data arrays:
>>> t = np.linspace(0, 10, 51)
>>> v = np.sin(t)
Create the datasets:
>>> ds_t = sdf.Dataset('t', data=t, unit='s', is_scale=True, display_name='Time')
>>> ds_v = sdf.Dataset('v', data=v, unit='V', scales=[ds_t])
Create the root group and write the file:
>>> g = sdf.Group('/', comment='A sine voltage', datasets=[ds_t, ds_v])
>>> sdf.save('sine.sdf', g)
Read the dataset from the SDF file asserting the correct unit of the dataset and scale:
>>> ds_v2 = sdf.load('sine.sdf', '/v', unit='V', scale_units=['s'])
Get the meta info and data array from the dataset:
>>> ds_v2.unit
'V'
>>> ds_v2.data.shape
(51,)
Get the scale for the first dimension:
>>> ds_t2 = ds_v2.scales[0]
>>> ds_t2.unit
's'
-----------------------------
Copyright |copyright| 2024 |Dassault Systemes|
.. _SDF specification: https://github.com/ScientificDataFormat/SDF
.. _HDF5: https://www.hdfgroup.org/hdf5/
.. |copyright| unicode:: U+000A9
.. |Dassault Systemes| unicode:: Dassault U+0020 Syst U+00E8 mes
Raw data
{
"_id": null,
"home_page": "https://github.com/ScientificDataFormat/SDF-Python",
"name": "SDF",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "Torsten Sommer",
"author_email": "torsten.sommer@3ds.com",
"download_url": null,
"platform": "darwin64",
"description": "Scientific Data Format for Python\r\n=================================\r\n\r\nSDF is a Python package to read, write and interpolate multi-dimensional data.\r\nThe Scientific Data Format is an open file format based on HDF5_ to store\r\nmulti-dimensional data such as parameters, simulation results or measurements.\r\nIt supports...\r\n\r\n- very large files\r\n- up to 32 dimensions\r\n- hierarchical structure\r\n- units, comments and custom meta-information\r\n\r\nFor detailed information see the `SDF specification`_.\r\n\r\n\r\nInstallation\r\n------------\r\n\r\nTo install the latest release from `PyPI <https://pypi.python.org/pypi/sdf/>`_ or update an existing installation::\r\n\r\n python -m pip install --upgrade sdf\r\n\r\nTo install the latest development version::\r\n\r\n python -m pip install --upgrade https://github.com/ScientificDataFormat/SDF-Python/archive/main.zip\r\n\r\n\r\nTutorial\r\n--------\r\n\r\nImport the ``SDF`` and ``NumPy`` packages:\r\n\r\n >>> import sdf\r\n >>> import numpy as np\r\n\r\nCreate the data arrays:\r\n\r\n >>> t = np.linspace(0, 10, 51)\r\n >>> v = np.sin(t)\r\n\r\nCreate the datasets:\r\n\r\n >>> ds_t = sdf.Dataset('t', data=t, unit='s', is_scale=True, display_name='Time')\r\n >>> ds_v = sdf.Dataset('v', data=v, unit='V', scales=[ds_t])\r\n\r\nCreate the root group and write the file:\r\n\r\n >>> g = sdf.Group('/', comment='A sine voltage', datasets=[ds_t, ds_v])\r\n >>> sdf.save('sine.sdf', g)\r\n\r\nRead the dataset from the SDF file asserting the correct unit of the dataset and scale:\r\n\r\n >>> ds_v2 = sdf.load('sine.sdf', '/v', unit='V', scale_units=['s'])\r\n\r\nGet the meta info and data array from the dataset:\r\n\r\n >>> ds_v2.unit\r\n 'V'\r\n >>> ds_v2.data.shape\r\n (51,)\r\n\r\nGet the scale for the first dimension:\r\n\r\n >>> ds_t2 = ds_v2.scales[0]\r\n >>> ds_t2.unit\r\n 's'\r\n\r\n\r\n-----------------------------\r\n\r\nCopyright |copyright| 2024 |Dassault Systemes|\r\n\r\n.. _SDF specification: https://github.com/ScientificDataFormat/SDF\r\n.. _HDF5: https://www.hdfgroup.org/hdf5/\r\n.. |copyright| unicode:: U+000A9\r\n.. |Dassault Systemes| unicode:: Dassault U+0020 Syst U+00E8 mes\r\n",
"bugtrack_url": null,
"license": "Standard 3-clause BSD",
"summary": "Work with Scientific Data Format files in Python",
"version": "0.3.6",
"project_urls": {
"Homepage": "https://github.com/ScientificDataFormat/SDF-Python"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "aa22d7caebdec0d92bed8ca38cef79af36bfec859f6ab0f43368cfe1b3dc1214",
"md5": "3f8cdd13bee0a41d0c2e4d2bf482cf06",
"sha256": "28a171fffd74a3e4eaff033c8fc425eab1bfa7d4e359487d921c9373f05dd5a3"
},
"downloads": -1,
"filename": "SDF-0.3.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3f8cdd13bee0a41d0c2e4d2bf482cf06",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 141630,
"upload_time": "2024-07-11T14:24:10",
"upload_time_iso_8601": "2024-07-11T14:24:10.720465Z",
"url": "https://files.pythonhosted.org/packages/aa/22/d7caebdec0d92bed8ca38cef79af36bfec859f6ab0f43368cfe1b3dc1214/SDF-0.3.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-11 14:24:10",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ScientificDataFormat",
"github_project": "SDF-Python",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "h5py",
"specs": []
},
{
"name": "matplotlib",
"specs": []
},
{
"name": "numpy",
"specs": [
[
">=",
"2"
]
]
},
{
"name": "xlrd",
"specs": []
},
{
"name": "scipy",
"specs": []
}
],
"lcname": "sdf"
}