nisync 0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- nisync-0.1/LICENSE +23 -0
- nisync-0.1/PKG-INFO +143 -0
- nisync-0.1/README.md +111 -0
- nisync-0.1/nisync/__init__.py +6 -0
- nisync-0.1/nisync/_attributes.py +35 -0
- nisync-0.1/nisync/_errorcodes.py +636 -0
- nisync-0.1/nisync/_library.py +1302 -0
- nisync-0.1/nisync/_library_singleton.py +52 -0
- nisync-0.1/nisync/_visatype.py +20 -0
- nisync-0.1/nisync/constants.py +130 -0
- nisync-0.1/nisync/enums.py +147 -0
- nisync-0.1/nisync/errors.py +87 -0
- nisync-0.1/nisync/session.py +1274 -0
- nisync-0.1/pyproject.toml +62 -0
nisync-0.1/LICENSE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
This is the MIT license: http://www.opensource.org/licenses/mit-license.php
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024, National Instruments Corp. NI-Sync is a trademark of National
|
|
4
|
+
Instruments.
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
7
|
+
a copy of this software and associated documentation files (the
|
|
8
|
+
"Software"), to deal in the Software without restriction, including
|
|
9
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
10
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
11
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
12
|
+
the following conditions:
|
|
13
|
+
|
|
14
|
+
The above copyright notice and this permission notice shall be included
|
|
15
|
+
in all copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
18
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
19
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
20
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
21
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
22
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
23
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
nisync-0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: nisync
|
|
3
|
+
Version: 0.1
|
|
4
|
+
Summary: NI-Sync Python API
|
|
5
|
+
Home-page: https://github.com/ni/nisync-python
|
|
6
|
+
License: MIT
|
|
7
|
+
Author: NI
|
|
8
|
+
Author-email: opensource@ni.com
|
|
9
|
+
Maintainer: NI
|
|
10
|
+
Maintainer-email: opensource@ni.com
|
|
11
|
+
Requires-Python: >=3.8.1,<4.0.0
|
|
12
|
+
Classifier: Development Status :: 1 - Planning
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Manufacturing
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
18
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
25
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
26
|
+
Classifier: Topic :: Scientific/Engineering
|
|
27
|
+
Classifier: Topic :: System :: Hardware
|
|
28
|
+
Requires-Dist: hightime
|
|
29
|
+
Project-URL: Repository, https://github.com/ni/nisync-python
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
| **Info** | Contains a Python API for interacting with NI-Sync. See [GitHub](https://github.com/ni/nisync-python/) for the latest source. |
|
|
33
|
+
| :------------ | :---------------------|
|
|
34
|
+
| **Author** | National Instruments |
|
|
35
|
+
|
|
36
|
+
# Table of Contents
|
|
37
|
+
- [About](#about)
|
|
38
|
+
- [Documentation](#documentation)
|
|
39
|
+
- [Implementation](#implementation)
|
|
40
|
+
- [Supported NI-Sync Driver Versions](#supported-ni-sync-driver-versions)
|
|
41
|
+
- [Operating System Support](#operating-system-support)
|
|
42
|
+
- [Python Version Support](#python-version-support)
|
|
43
|
+
- [Installation](#installation)
|
|
44
|
+
- [Manual Driver Installation](#manual-driver-installation)
|
|
45
|
+
- [Getting Started](#getting-started)
|
|
46
|
+
- [Usage](#usage)
|
|
47
|
+
- [Python Examples](#python-examples)
|
|
48
|
+
- [License](#license)
|
|
49
|
+
|
|
50
|
+
# About
|
|
51
|
+
|
|
52
|
+
The **nisync** package allows you to develop timing and synchronization applications
|
|
53
|
+
for both time-based and signal-based synchronizations with NI-Sync devices in Python.
|
|
54
|
+
|
|
55
|
+
## Documentation
|
|
56
|
+
|
|
57
|
+
Refer to the [NI-Sync User Manual](https://www.ni.com/docs/en-US/bundle/ni-sync/page/user-manual-welcome.html)
|
|
58
|
+
for API-agnostic information about NI-Sync concepts.
|
|
59
|
+
|
|
60
|
+
## Implementation
|
|
61
|
+
|
|
62
|
+
The package is implemented in Python as an
|
|
63
|
+
object-oriented wrapper around the NI-Sync C API using the
|
|
64
|
+
[ctypes](https://docs.python.org/3/library/ctypes.html) Python library.
|
|
65
|
+
|
|
66
|
+
## Supported NI-Sync Driver Versions
|
|
67
|
+
|
|
68
|
+
**nisync** supports all versions of NI-Sync. Some functions in the **nisync**
|
|
69
|
+
package may be unavailable with earlier versions of NI-Sync driver. Refer to
|
|
70
|
+
the [Installation](#installation) section for details on how to install the latest version
|
|
71
|
+
of the NI-Sync driver.
|
|
72
|
+
|
|
73
|
+
## Operating System Support
|
|
74
|
+
|
|
75
|
+
**nisync** supports Windows and Linux operating systems where the NI-Sync
|
|
76
|
+
driver is supported. Refer to
|
|
77
|
+
[NI Hardware and Operating System Compatibility](https://www.ni.com/r/hw-support)
|
|
78
|
+
for which versions of the driver support your hardware on a given operating
|
|
79
|
+
system.
|
|
80
|
+
|
|
81
|
+
## Python Version Support
|
|
82
|
+
|
|
83
|
+
**nisync** supports CPython 3.8+ and PyPy3.
|
|
84
|
+
|
|
85
|
+
# Installation
|
|
86
|
+
|
|
87
|
+
Running **nisync** requires NI-Sync to be installed.
|
|
88
|
+
**nisync** can be installed with [pip](http://pypi.python.org/pypi/pip>):
|
|
89
|
+
|
|
90
|
+
```shell
|
|
91
|
+
python -m pip install nisync
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Manual Driver Installation
|
|
95
|
+
|
|
96
|
+
Visit [ni.com/downloads](http://www.ni.com/downloads/) to download the latest
|
|
97
|
+
version of NI-Sync. None of the recommended **Additional items** are required
|
|
98
|
+
for **nisync** to function, and they can be removed to minimize installation
|
|
99
|
+
size. It is recommended you continue to install the **NI Certificates** package
|
|
100
|
+
to allow your Operating System to trust NI built binaries, improving your
|
|
101
|
+
software and hardware installation experience.
|
|
102
|
+
|
|
103
|
+
# Getting Started
|
|
104
|
+
|
|
105
|
+
In order to use the **nisync** package, you must have at least one device that supports NI-Sync
|
|
106
|
+
installed on your system. Both physical and simulated devices are supported.
|
|
107
|
+
You can use **NI MAX** or **NI Hardware Configuration Utility** to verify and configure your devices.
|
|
108
|
+
|
|
109
|
+
Finding and configuring device name in **NI MAX**:
|
|
110
|
+

|
|
111
|
+
|
|
112
|
+
Finding and configuring device name in **NI Hardware Configuration Utility**:
|
|
113
|
+

|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
# Usage
|
|
117
|
+
The following is a basic example of using an **nisync.nisync.Session** object. This example illustrates how to connect and disconnect clock terminals to synchronize devices using the onboard oscillator as the clock source. This is particularly useful in applications requiring precise timing and synchronization across multiple devices.
|
|
118
|
+
|
|
119
|
+
## Python Examples
|
|
120
|
+
|
|
121
|
+
```python
|
|
122
|
+
import nisync
|
|
123
|
+
from nisync.constants import PXI_CLK10_IN, OSCILLATOR
|
|
124
|
+
|
|
125
|
+
# Create a new session with the nisync library
|
|
126
|
+
with nisync.Session(resource_name="PXI1Slot10") as session:
|
|
127
|
+
# Connect the onboard oscillator to the PXI_CLK10_IN terminal
|
|
128
|
+
# This setup is typically used for synchronizing measurements across devices
|
|
129
|
+
session.connect_clock_terminals(OSCILLATOR, PXI_CLK10_IN)
|
|
130
|
+
|
|
131
|
+
# Perform measurements or operations that require synchronization
|
|
132
|
+
|
|
133
|
+
# Once operations are complete, disconnect the terminals
|
|
134
|
+
session.disconnect_clock_terminals(OSCILLATOR, PXI_CLK10_IN)
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
# License
|
|
138
|
+
|
|
139
|
+
**nisync** is licensed under an MIT-style license (see
|
|
140
|
+
[LICENSE](https://github.com/ni/nisync-python/blob/main/LICENSE)).
|
|
141
|
+
Other incorporated projects may be licensed under different licenses. All
|
|
142
|
+
licenses allow for non-commercial and commercial use.
|
|
143
|
+
|
nisync-0.1/README.md
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
| **Info** | Contains a Python API for interacting with NI-Sync. See [GitHub](https://github.com/ni/nisync-python/) for the latest source. |
|
|
2
|
+
| :------------ | :---------------------|
|
|
3
|
+
| **Author** | National Instruments |
|
|
4
|
+
|
|
5
|
+
# Table of Contents
|
|
6
|
+
- [About](#about)
|
|
7
|
+
- [Documentation](#documentation)
|
|
8
|
+
- [Implementation](#implementation)
|
|
9
|
+
- [Supported NI-Sync Driver Versions](#supported-ni-sync-driver-versions)
|
|
10
|
+
- [Operating System Support](#operating-system-support)
|
|
11
|
+
- [Python Version Support](#python-version-support)
|
|
12
|
+
- [Installation](#installation)
|
|
13
|
+
- [Manual Driver Installation](#manual-driver-installation)
|
|
14
|
+
- [Getting Started](#getting-started)
|
|
15
|
+
- [Usage](#usage)
|
|
16
|
+
- [Python Examples](#python-examples)
|
|
17
|
+
- [License](#license)
|
|
18
|
+
|
|
19
|
+
# About
|
|
20
|
+
|
|
21
|
+
The **nisync** package allows you to develop timing and synchronization applications
|
|
22
|
+
for both time-based and signal-based synchronizations with NI-Sync devices in Python.
|
|
23
|
+
|
|
24
|
+
## Documentation
|
|
25
|
+
|
|
26
|
+
Refer to the [NI-Sync User Manual](https://www.ni.com/docs/en-US/bundle/ni-sync/page/user-manual-welcome.html)
|
|
27
|
+
for API-agnostic information about NI-Sync concepts.
|
|
28
|
+
|
|
29
|
+
## Implementation
|
|
30
|
+
|
|
31
|
+
The package is implemented in Python as an
|
|
32
|
+
object-oriented wrapper around the NI-Sync C API using the
|
|
33
|
+
[ctypes](https://docs.python.org/3/library/ctypes.html) Python library.
|
|
34
|
+
|
|
35
|
+
## Supported NI-Sync Driver Versions
|
|
36
|
+
|
|
37
|
+
**nisync** supports all versions of NI-Sync. Some functions in the **nisync**
|
|
38
|
+
package may be unavailable with earlier versions of NI-Sync driver. Refer to
|
|
39
|
+
the [Installation](#installation) section for details on how to install the latest version
|
|
40
|
+
of the NI-Sync driver.
|
|
41
|
+
|
|
42
|
+
## Operating System Support
|
|
43
|
+
|
|
44
|
+
**nisync** supports Windows and Linux operating systems where the NI-Sync
|
|
45
|
+
driver is supported. Refer to
|
|
46
|
+
[NI Hardware and Operating System Compatibility](https://www.ni.com/r/hw-support)
|
|
47
|
+
for which versions of the driver support your hardware on a given operating
|
|
48
|
+
system.
|
|
49
|
+
|
|
50
|
+
## Python Version Support
|
|
51
|
+
|
|
52
|
+
**nisync** supports CPython 3.8+ and PyPy3.
|
|
53
|
+
|
|
54
|
+
# Installation
|
|
55
|
+
|
|
56
|
+
Running **nisync** requires NI-Sync to be installed.
|
|
57
|
+
**nisync** can be installed with [pip](http://pypi.python.org/pypi/pip>):
|
|
58
|
+
|
|
59
|
+
```shell
|
|
60
|
+
python -m pip install nisync
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Manual Driver Installation
|
|
64
|
+
|
|
65
|
+
Visit [ni.com/downloads](http://www.ni.com/downloads/) to download the latest
|
|
66
|
+
version of NI-Sync. None of the recommended **Additional items** are required
|
|
67
|
+
for **nisync** to function, and they can be removed to minimize installation
|
|
68
|
+
size. It is recommended you continue to install the **NI Certificates** package
|
|
69
|
+
to allow your Operating System to trust NI built binaries, improving your
|
|
70
|
+
software and hardware installation experience.
|
|
71
|
+
|
|
72
|
+
# Getting Started
|
|
73
|
+
|
|
74
|
+
In order to use the **nisync** package, you must have at least one device that supports NI-Sync
|
|
75
|
+
installed on your system. Both physical and simulated devices are supported.
|
|
76
|
+
You can use **NI MAX** or **NI Hardware Configuration Utility** to verify and configure your devices.
|
|
77
|
+
|
|
78
|
+
Finding and configuring device name in **NI MAX**:
|
|
79
|
+

|
|
80
|
+
|
|
81
|
+
Finding and configuring device name in **NI Hardware Configuration Utility**:
|
|
82
|
+

|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
# Usage
|
|
86
|
+
The following is a basic example of using an **nisync.nisync.Session** object. This example illustrates how to connect and disconnect clock terminals to synchronize devices using the onboard oscillator as the clock source. This is particularly useful in applications requiring precise timing and synchronization across multiple devices.
|
|
87
|
+
|
|
88
|
+
## Python Examples
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
import nisync
|
|
92
|
+
from nisync.constants import PXI_CLK10_IN, OSCILLATOR
|
|
93
|
+
|
|
94
|
+
# Create a new session with the nisync library
|
|
95
|
+
with nisync.Session(resource_name="PXI1Slot10") as session:
|
|
96
|
+
# Connect the onboard oscillator to the PXI_CLK10_IN terminal
|
|
97
|
+
# This setup is typically used for synchronizing measurements across devices
|
|
98
|
+
session.connect_clock_terminals(OSCILLATOR, PXI_CLK10_IN)
|
|
99
|
+
|
|
100
|
+
# Perform measurements or operations that require synchronization
|
|
101
|
+
|
|
102
|
+
# Once operations are complete, disconnect the terminals
|
|
103
|
+
session.disconnect_clock_terminals(OSCILLATOR, PXI_CLK10_IN)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
# License
|
|
107
|
+
|
|
108
|
+
**nisync** is licensed under an MIT-style license (see
|
|
109
|
+
[LICENSE](https://github.com/ni/nisync-python/blob/main/LICENSE)).
|
|
110
|
+
Other incorporated projects may be licensed under different licenses. All
|
|
111
|
+
licenses allow for non-commercial and commercial use.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
class Attribute(object):
|
|
2
|
+
def __init__(self, attribute_id):
|
|
3
|
+
self._attribute_id = attribute_id
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class AttributeViInt32(Attribute):
|
|
7
|
+
def __get__(self, session, session_type):
|
|
8
|
+
return session._get_attribute_vi_int32(self._attribute_id)
|
|
9
|
+
|
|
10
|
+
def __set__(self, session, value):
|
|
11
|
+
session._set_attribute_vi_int32(self._attribute_id, value)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class AttributeViReal64(Attribute):
|
|
15
|
+
def __get__(self, session, session_type):
|
|
16
|
+
return session._get_attribute_vi_real64(self._attribute_id)
|
|
17
|
+
|
|
18
|
+
def __set__(self, session, value):
|
|
19
|
+
session._set_attribute_vi_real64(self._attribute_id, value)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class AttributeViBoolean(Attribute):
|
|
23
|
+
def __get__(self, session, session_type):
|
|
24
|
+
return session._get_attribute_vi_boolean(self._attribute_id)
|
|
25
|
+
|
|
26
|
+
def __set__(self, session, value):
|
|
27
|
+
session._set_attribute_vi_boolean(self._attribute_id, value)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class AttributeViString(Attribute):
|
|
31
|
+
def __get__(self, session, session_type):
|
|
32
|
+
return session._get_attribute_vi_string(self._attribute_id)
|
|
33
|
+
|
|
34
|
+
def __set__(self, session, value):
|
|
35
|
+
session._set_attribute_vi_string(self._attribute_id, value)
|