RsWaveform


NameRsWaveform JSON
Version 0.3.0 PyPI version JSON
download
home_pageNone
SummaryLoad, manipulate and save R&S waveform files
upload_time2024-04-23 12:29:01
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords waveform signal load save
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # RsWaveform

[![Documentation Status](https://readthedocs.org/projects/rswaveform/badge/?version=latest)](https://rswaveform.readthedocs.io/en/latest/?badge=latest) [![Build Status](https://github.com/Rohde-Schwarz/RsWaveform/actions/workflows/tests.yml/badge.svg)](https://github.com/Rohde-Schwarz/RsWaveform/actions/) [![PyPI Versions](https://img.shields.io/pypi/pyversions/RsWaveform.svg)](https://pypi.python.org/pypi/RsWaveform) ![PyPI - Downloads](https://img.shields.io/pypi/dm/RsWaveform)  [![PyPI Status](https://img.shields.io/pypi/status/RsWaveform.svg)](https://pypi.python.org/pypi/RsWaveform) [![PyPI License](https://img.shields.io/badge/License-MIT-green)](LICENSE)

> Load, manipulate and save R&S waveform files

The RsWaveform package provides a convenient and easy-to-use software solution for creating and modifying waveform files that can be used with Rohde & Schwarz instruments, but it does not provide access to encrypted waveform files that require a license.

## Purpose

### What it does

The RsWaveform package is a software tool developed by Rohde & Schwarz that allows you to create waveform files that can be used with Rohde & Schwarz instruments. This tool can help you to easily create waveform files that match your specific needs, or to load existing waveform files in various formats such as wv, iqtar, and iqw, modify them, and store them again for future use.

### What it not does

The RsWaveform package does not have the capability to load encrypted waveform files that require a license. These waveform files can only be used with a licensed Rohde & Schwarz product, and cannot be modified or analyzed without the appropriate license.

## Installation

Install from pypi.org:

```sh
$ pip install RsWaveform
```

You need at least Python 3.8.

## Setup environment

To set up your environment, just run

```py 
pip install -r requirements-dev.txt
```

## Usage

```py
import RsWaveform
```

### Load waveform files

```py
import RsWaveform

filename = "tests/data/dummy.wv"
wv = RsWaveform.RsWaveform(file=filename)
# default loader + saver will be used which is currently a ".wv" type
# This is the same as wv = RsWaveform.RsWaveform(load=RsWaveform.wv.Load, save=RsWaveform.wv.Save, file=filename)
wv.data[0]
>> array([0.2 + 0.4j, 0.6 + 0.8j])
wv.meta[0]
>> {
    'type': 'SMU-WV',
    'copyright': 'Rohde & Schwarz',
    'comment': 'Test waveform file',
    'clock': 100000000.0,
    'marker': {'marker list 1': [[0, 1], [32, 0], [63, 0]],},
    'control_length': None,
    'control_list': {},
    'level offs': (2.220459, 0.0),
    'date': datetime.datetime(2023, 1, 5, 10, 3, 52),
    'control length': 2,
    'encryption_flag': False,
    'center_frequency': 1000000000.0,
    'scalingfactor': 1
}
```

### Save waveform files

```py
import RsWaveform
import numpy as np
import datetime

wv = RsWaveform.RsWaveform()  # default loader + saver will be used which is currently a ".wv" type
# This is the same as wv = RsWaveform.RsWaveform(load=RsWaveform.wv.Load, save=RsWaveform.wv.Save)
wv.data[0] = np.ones((2,)) + 1j * np.zeros((1,))
# Set values as dict
wv.meta[0].update({
    'type': 'SMU-WV',
    'copyright': 'Rohde & Schwarz',
    'level offs': (2.220459, 0.0),
    'date': datetime.datetime.now(),
    'clock': 100000000.0,
    'control length': 2,

})
# or use the meta data properties
wv.meta[0].comment = 'Test waveform file'
wv.meta[0].marker.update({'marker list 1': [[0, 1], [32, 0], [63, 0]]})
# save to file
wv.save(r"someFileName.wv")
```

### Load iqw files

```py
import RsWaveform

filename = "tests/data/dummy.iqw"
iqw = RsWaveform.Iqw(
    file=filename)  # default loader + saver will be used which is
# currently a ".iqw" type
# This is the same as iqw = RsWaveform.Iqw(load=RsWaveform.iqw.Load,
# save=RsWaveform.iqw.Save, file=filename)
iqw.data[0]
>> array([0.2 + 0.4j, 0.6 + 0.8j])
```

### Save iqw files

```py
import RsWaveform
import numpy as np

iqw = RsWaveform.Iqw()  # default loader + saver will be used which is
# currently a ".iqw" type
# This is the same as iqw = RsWaveform.Iqw(load=RsWaveform.iqw.Load,
# save=RsWaveform.iqw.Save)
iqw.data[0] = np.ones((2,)) + 1j * np.zeros((1,))
iqw.save(r"someFileName.iqw")  # save to file
```

### Load iqtar files

```py
import RsWaveform
import datetime

filename = "tests/data/dummy.iq.tar"
iqtar = RsWaveform.IqTar(file=filename)
# default loader + saver will be used which is
# currently a ".iqw" type
# This is the same as iqtar = RsWaveform.IqTar(load=RsWaveform.iqtar.Load,
# save=RsWaveform.iqtar.Save, file=filename)
iqtar.data[0]
>> array([0.2 + 0.4j, 0.6 + 0.8j])
iqtar.meta[0]
>> {
    'clock': 10000.0,
    'scalingfactor': 1.0,
    'datatype': 'float32',
    'format': 'complex',
    'name': 'Python iq.tar Writer (iqdata.py)',
    'comment': 'RS WaveForm, TheAE-RA',
    "datetime": datetime.datetime(2023, 3, 1, 10, 19, 37, 43312),
}

```

### Save iqtar files

```py
import RsWaveform
import datetime

iqtar = RsWaveform.IqTar()
# default loader + saver will be used which is
# currently a ".iqw" type
# This is the same as iqtar = RsWaveform.IqTar(load=RsWaveform.iqtar.Load,
# save=RsWaveform.iqtar.Save, file=filename)
iqtar.data[0] = np.ones((2,)) + 1j * np.zeros((1,))
# Set values as dict
iqtar.meta[0] = {
    'clock': 10000.0,
    'scalingfactor': 1.0,
    'datatype': 'float32',
    'format': 'complex',
    'name': 'Python iq.tar Writer (iqdata.py)',
    "datetime": datetime.datetime.now(),
}
# or use the meta data properties
iqtar.meta[0].comment = 'RS WaveForm, TheAE-RA'
# save to file
iqtar.save("somefilename.iq.tar")
```

### Digital signal processing utilites

The RsWaveform package provides also these convenience functions for digital
signal processing

- normalize
- calculate_peak - output as dB
- calculate_rms - output as dB
- calculate_par - output as dB
- convert_to_db - amplitude based

You can use them as following

```py
import RsWaveform
import numpy as np

data = RsWaveform.normalize(np.ones((2,)) + 1j * np.zeros((1,)))

RsWaveform.calculate_peak(data)
>> 0.0
RsWaveform.calculate_rms(data)
>> 0.0
RsWaveform.calculate_par(data)
>> 0.0
```

### Running the tests

To run the tests, run the following command:

```sh
$ pip install tox
$ tox -e test
```

This will run all the tests for the package and report any issues or failures. Make sure that you have installed the necessary dependencies before running the tests.

## Contributing

- Author: Carsten Sauerbrey (<carsten.sauerbrey@rohde-schwarz.com>)
- Author: Daniela Rossetto (<daniela.rossetto@rohde-schwarz.com>)

We welcome any contributions, enhancements, and bug-fixes. Open an [issue](https://github.com/Rohde-Schwarz/RsWaveform/issues) on [Github](https://github.com) and [submit a pull request](https://github.com/Rohde-Schwarz/RsWaveform/pulls).

### Code approval/review guidelines

In case you finished the work on your branch, create a pull request, describe (optionally) your changes in the pull request and set at least *one* of the authors mentioned above as code
reviewer. The closed branch should be deleted after merge.

Before approving a pull request, check for and discuss:

- Repetitive (copy & paste) code -> Could this be refactored/moved to a function?
- Stale / commented out functional code -> Could these artifacts be deleted?
- Duplication of existing functionality -> Could existing code already solve the adressed problem?
- Unused imports -> Could these imports be cleaned up?`
- File locations don't mirror their logical connection to a feature -> Could they be grouped within a logical unit (e.g. folder)?
- Outdated / needlessly complex python functionality -> Could this be solved by more modern python language features (e.g. itertools)?
- Is there a test for your functionality? -> add new test or modify an existing test.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "RsWaveform",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "Carsten Sauerbrey <Carsten.Sauerbrey@rohde-schwarz.com>, Daniela Rossetto <Daniela.Rossetto@rohde-schwarz.com>",
    "keywords": "waveform, signal, load, save",
    "author": null,
    "author_email": "\"Rohde & Schwarz GmbH & Co. KG\" <info@rohde-schwarz.com>",
    "download_url": "https://files.pythonhosted.org/packages/58/49/c270bc0292ae7ea75c3fd3a5a634ba1543664a98eb3407c4b816ebcb13e1/rswaveform-0.3.0.tar.gz",
    "platform": "Unix",
    "description": "# RsWaveform\n\n[![Documentation Status](https://readthedocs.org/projects/rswaveform/badge/?version=latest)](https://rswaveform.readthedocs.io/en/latest/?badge=latest) [![Build Status](https://github.com/Rohde-Schwarz/RsWaveform/actions/workflows/tests.yml/badge.svg)](https://github.com/Rohde-Schwarz/RsWaveform/actions/) [![PyPI Versions](https://img.shields.io/pypi/pyversions/RsWaveform.svg)](https://pypi.python.org/pypi/RsWaveform) ![PyPI - Downloads](https://img.shields.io/pypi/dm/RsWaveform)  [![PyPI Status](https://img.shields.io/pypi/status/RsWaveform.svg)](https://pypi.python.org/pypi/RsWaveform) [![PyPI License](https://img.shields.io/badge/License-MIT-green)](LICENSE)\n\n> Load, manipulate and save R&S waveform files\n\nThe RsWaveform package provides a convenient and easy-to-use software solution for creating and modifying waveform files that can be used with Rohde & Schwarz instruments, but it does not provide access to encrypted waveform files that require a license.\n\n## Purpose\n\n### What it does\n\nThe RsWaveform package is a software tool developed by Rohde & Schwarz that allows you to create waveform files that can be used with Rohde & Schwarz instruments. This tool can help you to easily create waveform files that match your specific needs, or to load existing waveform files in various formats such as wv, iqtar, and iqw, modify them, and store them again for future use.\n\n### What it not does\n\nThe RsWaveform package does not have the capability to load encrypted waveform files that require a license. These waveform files can only be used with a licensed Rohde & Schwarz product, and cannot be modified or analyzed without the appropriate license.\n\n## Installation\n\nInstall from pypi.org:\n\n```sh\n$ pip install RsWaveform\n```\n\nYou need at least Python 3.8.\n\n## Setup environment\n\nTo set up your environment, just run\n\n```py \npip install -r requirements-dev.txt\n```\n\n## Usage\n\n```py\nimport RsWaveform\n```\n\n### Load waveform files\n\n```py\nimport RsWaveform\n\nfilename = \"tests/data/dummy.wv\"\nwv = RsWaveform.RsWaveform(file=filename)\n# default loader + saver will be used which is currently a \".wv\" type\n# This is the same as wv = RsWaveform.RsWaveform(load=RsWaveform.wv.Load, save=RsWaveform.wv.Save, file=filename)\nwv.data[0]\n>> array([0.2 + 0.4j, 0.6 + 0.8j])\nwv.meta[0]\n>> {\n    'type': 'SMU-WV',\n    'copyright': 'Rohde & Schwarz',\n    'comment': 'Test waveform file',\n    'clock': 100000000.0,\n    'marker': {'marker list 1': [[0, 1], [32, 0], [63, 0]],},\n    'control_length': None,\n    'control_list': {},\n    'level offs': (2.220459, 0.0),\n    'date': datetime.datetime(2023, 1, 5, 10, 3, 52),\n    'control length': 2,\n    'encryption_flag': False,\n    'center_frequency': 1000000000.0,\n    'scalingfactor': 1\n}\n```\n\n### Save waveform files\n\n```py\nimport RsWaveform\nimport numpy as np\nimport datetime\n\nwv = RsWaveform.RsWaveform()  # default loader + saver will be used which is currently a \".wv\" type\n# This is the same as wv = RsWaveform.RsWaveform(load=RsWaveform.wv.Load, save=RsWaveform.wv.Save)\nwv.data[0] = np.ones((2,)) + 1j * np.zeros((1,))\n# Set values as dict\nwv.meta[0].update({\n    'type': 'SMU-WV',\n    'copyright': 'Rohde & Schwarz',\n    'level offs': (2.220459, 0.0),\n    'date': datetime.datetime.now(),\n    'clock': 100000000.0,\n    'control length': 2,\n\n})\n# or use the meta data properties\nwv.meta[0].comment = 'Test waveform file'\nwv.meta[0].marker.update({'marker list 1': [[0, 1], [32, 0], [63, 0]]})\n# save to file\nwv.save(r\"someFileName.wv\")\n```\n\n### Load iqw files\n\n```py\nimport RsWaveform\n\nfilename = \"tests/data/dummy.iqw\"\niqw = RsWaveform.Iqw(\n    file=filename)  # default loader + saver will be used which is\n# currently a \".iqw\" type\n# This is the same as iqw = RsWaveform.Iqw(load=RsWaveform.iqw.Load,\n# save=RsWaveform.iqw.Save, file=filename)\niqw.data[0]\n>> array([0.2 + 0.4j, 0.6 + 0.8j])\n```\n\n### Save iqw files\n\n```py\nimport RsWaveform\nimport numpy as np\n\niqw = RsWaveform.Iqw()  # default loader + saver will be used which is\n# currently a \".iqw\" type\n# This is the same as iqw = RsWaveform.Iqw(load=RsWaveform.iqw.Load,\n# save=RsWaveform.iqw.Save)\niqw.data[0] = np.ones((2,)) + 1j * np.zeros((1,))\niqw.save(r\"someFileName.iqw\")  # save to file\n```\n\n### Load iqtar files\n\n```py\nimport RsWaveform\nimport datetime\n\nfilename = \"tests/data/dummy.iq.tar\"\niqtar = RsWaveform.IqTar(file=filename)\n# default loader + saver will be used which is\n# currently a \".iqw\" type\n# This is the same as iqtar = RsWaveform.IqTar(load=RsWaveform.iqtar.Load,\n# save=RsWaveform.iqtar.Save, file=filename)\niqtar.data[0]\n>> array([0.2 + 0.4j, 0.6 + 0.8j])\niqtar.meta[0]\n>> {\n    'clock': 10000.0,\n    'scalingfactor': 1.0,\n    'datatype': 'float32',\n    'format': 'complex',\n    'name': 'Python iq.tar Writer (iqdata.py)',\n    'comment': 'RS WaveForm, TheAE-RA',\n    \"datetime\": datetime.datetime(2023, 3, 1, 10, 19, 37, 43312),\n}\n\n```\n\n### Save iqtar files\n\n```py\nimport RsWaveform\nimport datetime\n\niqtar = RsWaveform.IqTar()\n# default loader + saver will be used which is\n# currently a \".iqw\" type\n# This is the same as iqtar = RsWaveform.IqTar(load=RsWaveform.iqtar.Load,\n# save=RsWaveform.iqtar.Save, file=filename)\niqtar.data[0] = np.ones((2,)) + 1j * np.zeros((1,))\n# Set values as dict\niqtar.meta[0] = {\n    'clock': 10000.0,\n    'scalingfactor': 1.0,\n    'datatype': 'float32',\n    'format': 'complex',\n    'name': 'Python iq.tar Writer (iqdata.py)',\n    \"datetime\": datetime.datetime.now(),\n}\n# or use the meta data properties\niqtar.meta[0].comment = 'RS WaveForm, TheAE-RA'\n# save to file\niqtar.save(\"somefilename.iq.tar\")\n```\n\n### Digital signal processing utilites\n\nThe RsWaveform package provides also these convenience functions for digital\nsignal processing\n\n- normalize\n- calculate_peak - output as dB\n- calculate_rms - output as dB\n- calculate_par - output as dB\n- convert_to_db - amplitude based\n\nYou can use them as following\n\n```py\nimport RsWaveform\nimport numpy as np\n\ndata = RsWaveform.normalize(np.ones((2,)) + 1j * np.zeros((1,)))\n\nRsWaveform.calculate_peak(data)\n>> 0.0\nRsWaveform.calculate_rms(data)\n>> 0.0\nRsWaveform.calculate_par(data)\n>> 0.0\n```\n\n### Running the tests\n\nTo run the tests, run the following command:\n\n```sh\n$ pip install tox\n$ tox -e test\n```\n\nThis will run all the tests for the package and report any issues or failures. Make sure that you have installed the necessary dependencies before running the tests.\n\n## Contributing\n\n- Author: Carsten Sauerbrey (<carsten.sauerbrey@rohde-schwarz.com>)\n- Author: Daniela Rossetto (<daniela.rossetto@rohde-schwarz.com>)\n\nWe welcome any contributions, enhancements, and bug-fixes. Open an [issue](https://github.com/Rohde-Schwarz/RsWaveform/issues) on [Github](https://github.com) and [submit a pull request](https://github.com/Rohde-Schwarz/RsWaveform/pulls).\n\n### Code approval/review guidelines\n\nIn case you finished the work on your branch, create a pull request, describe (optionally) your changes in the pull request and set at least *one* of the authors mentioned above as code\nreviewer. The closed branch should be deleted after merge.\n\nBefore approving a pull request, check for and discuss:\n\n- Repetitive (copy & paste) code -> Could this be refactored/moved to a function?\n- Stale / commented out functional code -> Could these artifacts be deleted?\n- Duplication of existing functionality -> Could existing code already solve the adressed problem?\n- Unused imports -> Could these imports be cleaned up?`\n- File locations don't mirror their logical connection to a feature -> Could they be grouped within a logical unit (e.g. folder)?\n- Outdated / needlessly complex python functionality -> Could this be solved by more modern python language features (e.g. itertools)?\n- Is there a test for your functionality? -> add new test or modify an existing test.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Load, manipulate and save R&S waveform files",
    "version": "0.3.0",
    "project_urls": {
        "project": "https://github.com/Rohde-Schwarz/RsWaveform"
    },
    "split_keywords": [
        "waveform",
        " signal",
        " load",
        " save"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3f4a25f12d713a2eec274db696bcf22d8289d43372bbfa06dee1326059fcf126",
                "md5": "e5ac82fb45e855e2328d97e8a8566605",
                "sha256": "2a50a4d54247ad60b114c8bc3cb5f59f2908976a5d385b1845bae3c2eb65218d"
            },
            "downloads": -1,
            "filename": "RsWaveform-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e5ac82fb45e855e2328d97e8a8566605",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 33821,
            "upload_time": "2024-04-23T12:29:00",
            "upload_time_iso_8601": "2024-04-23T12:29:00.121150Z",
            "url": "https://files.pythonhosted.org/packages/3f/4a/25f12d713a2eec274db696bcf22d8289d43372bbfa06dee1326059fcf126/RsWaveform-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5849c270bc0292ae7ea75c3fd3a5a634ba1543664a98eb3407c4b816ebcb13e1",
                "md5": "f58048a95acf66a7609196cde4b1756b",
                "sha256": "35d9202e4f59163d4f245e3b2e27cb7e7c5d1eba836dcce01e91321b6850847b"
            },
            "downloads": -1,
            "filename": "rswaveform-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "f58048a95acf66a7609196cde4b1756b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 49334,
            "upload_time": "2024-04-23T12:29:01",
            "upload_time_iso_8601": "2024-04-23T12:29:01.647820Z",
            "url": "https://files.pythonhosted.org/packages/58/49/c270bc0292ae7ea75c3fd3a5a634ba1543664a98eb3407c4b816ebcb13e1/rswaveform-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-23 12:29:01",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Rohde-Schwarz",
    "github_project": "RsWaveform",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "rswaveform"
}
        
Elapsed time: 0.24873s