You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+71-47Lines changed: 71 additions & 47 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,37 +16,41 @@ Use these code samples to start learning how to communicate with your SpikeSafe
16
16
## Usage
17
17
18
18
### Python
19
-
Download and install [Python](https://www.python.org/downloads/), which will install:
19
+
Download from the official [Python](https://www.python.org/downloads/) website.
20
+
21
+
During Python installation check the box Add Python to PATH when prompted.
22
+
- Confirm Python PATH is set in **Command Prompt** by typing `py --version` to verify the Python version
23
+
24
+
Installing Python will install:
20
25
- IDLE
21
26
- Python Launcher
22
27
- Python3 Interpreter
23
28
24
-
It is recommended to use a version of Python with the status key of bugfix or higher, see [Python Release Cycle](https://devguide.python.org/versions/#versions).
29
+
After Python installation is complete, restart the computer to ensure packages under the [Packages](#packages) Section can be successfully installed.
30
+
31
+
Vektrex targets working support for versions of Python with the status key of bugfix or higher, see [Python Release Cycle](https://devguide.python.org/versions/#versions).
25
32
26
33
#### Windows Setup
27
34
28
35
##### Use the Standard Console Command Prompt
29
36
To open Command Prompt press the key combination Windows + R to open a Run dialog, and then type cmd and hit Enter or click Ok.
30
37
31
38
##### Add Python to PATH
32
-
It is recommended that the path of Python Interpreter is added for easy usage. There are two ways to add Python to Windows PATH.
33
-
34
-
1. During Python installation check the box Add Python to PATH when prompted.
35
-
- Confirm Python PATH is set in **Command Prompt** by typing `py --version` to verify the Python version
36
-
37
-
2. Manually add Python to Windows Path:
38
-
- Press the key combination **Windows + R** to open a Run dialog
39
-
- Type `sysdm.cpl` to open the System Properties
40
-
- Press **Advanced** tab and then press on **Environment Variables…** to open Environment Variables dialog
41
-
- Under the **User variables** box, press on **New…** to add the `Path` variable (if your **Path** variable already exists, then press on **Edit…** instead):
42
-
- Set the Path **Variable value** to the 1) `Python application path` and 2) `Python Scripts path`. To find these paths and set the value:
43
-
- Type `Python` in the Windows Search Bar
44
-
- Right-click on the **Python App**, and then press **Open file location**
45
-
- Right-click on the **Python shortcut**, and then press **Open file location** (this is the `Python application path`)
46
-
- Navigate to the **scripts** folder (this is the `Python Scripts path`)
47
-
- Set the Path **Variable value** to `Python application path;Python Scripts path` (paths are separated by a semicolon)
48
-
- Press **OK**
49
-
- Confirm Python PATH is set in **Command Prompt** by typing `py --version` to verify the Python version
39
+
It is recommended that the path of Python Interpreter is added for easy usage. If this was not done in as part of the [Python](#python) section, it can be manually done afterwards.
40
+
41
+
Manually add Python to Windows Path:
42
+
- Press the key combination **Windows + R** to open a Run dialog
43
+
- Type `sysdm.cpl` to open the System Properties
44
+
- Press **Advanced** tab and then press on **Environment Variables…** to open Environment Variables dialog
45
+
- Under the **User variables** box, press on **New…** to add the `Path` variable (if your **Path** variable already exists, then press on **Edit…** instead):
46
+
- Set the Path **Variable value** to the 1) `Python application path` and 2) `Python Scripts path`. To find these paths and set the value:
47
+
- Type `Python` in the Windows Search Bar
48
+
- Right-click on the **Python App**, and then press **Open file location**
49
+
- Right-click on the **Python shortcut**, and then press **Open file location** (this is the `Python application path`)
50
+
- Navigate to the **scripts** folder (this is the `Python Scripts path`)
51
+
- Set the Path **Variable value** to `Python application path;Python Scripts path` (paths are separated by a semicolon)
52
+
- Press **OK**
53
+
- Confirm Python PATH is set in **Command Prompt** by typing `py --version` to verify the Python version
50
54
51
55
#### Mac OS X Setup
52
56
@@ -78,43 +82,43 @@ To run these sequences a light-weight IDE, or to target cross-platform developme
78
82
To run these sequences in a more feature rich IDE, use the free [Visual Studio Community](https://visualstudio.microsoft.com/vs/community/). See [Python In Visual Studio](https://docs.microsoft.com/en-us/visualstudio/python/tutorial-working-with-python-in-visual-studio-step-00-installation?view=vs-2022) to simply setup your IDE with Python. Optionall, using a [virtual environment](https://docs.microsoft.com/en-us/visualstudio/python/managing-python-environments-in-visual-studio?view=vs-2022) is recommended to successfully meet the installation requirements to run these sequences.
79
83
80
84
### Packages
85
+
SpikeSafePythonSamples requires packages to run all scripts.
81
86
82
-
#### Managing Packages
83
-
##### How to Install/Upgraded Packages
84
-
Installing packages use pip. It is recommended that pip be updated to latest version.
87
+
There are two ways to install these packages:
88
+
1. See Section [Automatically Install Packages](#automatically-install-packages)
89
+
2. See Section [Manually Install Packages](#manually-install-packages)
85
90
86
-
To install/upgrade pip, run command:
87
-
| OS | Command |
88
-
| - | - |
89
-
| Windows |`py -m pip install --upgrade pip`|
90
-
| macOS |`python3 -m pip install --upgrade pip`|
91
+
After all packages are installed, refer to section [Package Helpers](#package-helpers) to verify package details.
91
92
92
-
To display the version of pip, run command:
93
-
| OS | Command |
94
-
| - | - |
95
-
| Windows |`pip -V`|
96
-
| macOS |`pip3 -V`|
93
+
#### Automatically Install Packages
94
+
All necessary SpikeSafePythonSamples packages may be installed automatically. See [Install SpikeSafePythonSamples Packages](/getting_started/install_spikesafe_python_samples_packages/) and run the python .py script in this directory.
97
95
98
-
##### How to View All Installed Packages
99
-
A list of all installed packages can be displayed.
96
+
####Manually Install Packages
97
+
All necessary SpikeSafePythonSamples packages may be installed manually. Perform all of the subsections below.
100
98
101
-
To view all installed packages, run command:
99
+
##### Installing pip Package
100
+
Installing packages use [pip](https://pypi.org/project/pip/). It is recommended that pip be updated to latest version.
101
+
102
+
First, check if your environment has pip installed, run command:
102
103
| OS | Command |
103
104
| - | - |
104
-
| Windows |`pip freeze`|
105
-
| macOS |`pip3 freeze`|
105
+
| Windows |`py -m pip --version`|
106
+
| macOS |`python3 -m pip --version`|
106
107
107
-
##### How to View Details of an Installed Package
108
-
After a package is installed the details of a package can be displayed.
108
+
If your environment does not have pip installed, run command:
109
+
| OS | Command |
110
+
| - | - |
111
+
| Windows |`py -m ensurepip --upgrade`|
112
+
| macOS |`python3 -m ensurepip --upgrade`|
109
113
110
-
To view details of a package, run command:
114
+
To install/upgrade pip, run command:
111
115
| OS | Command |
112
116
| - | - |
113
-
| Windows |`pip show <package name>`|
114
-
| macOS |`pip3 show <package name>`|
117
+
| Windows |`py -m pip install --upgrade pip`|
118
+
| macOS |`python3 -m pip install --upgrade pip`|
115
119
116
120
##### Installing spikesafe-python Package
117
-
The [spikesafe-python](https://pypi.org/project/spikesafe-python/) library will need to be installed. Vektrex recommends always having the latest version of spikesafe-python when running these sequences; the current version is 1.4.5.
121
+
The [spikesafe-python](https://pypi.org/project/spikesafe-python/) library will need to be installed. Vektrex recommends always having the latest version of spikesafe-python when running these sequences; the current version is 1.5.15.
118
122
119
123
To install this package, run command:
120
124
| OS | Command |
@@ -126,7 +130,7 @@ Once the spikesafe-python package is installed, each script in this repository c
126
130
127
131
Complete class documentation is available for spikesafe-python in [spikesafe-python API Overview](spikesafe_python_lib_docs).
128
132
129
-
#### Installing matplotlib Package
133
+
#####Installing matplotlib Package
130
134
Some sequences involve graphing measurement results. To properly graph results, the [matplotlib](https://matplotlib.org/) library is required (version 3.2.1 or greater). Once the matplotlib library is installed, each sequence that involves graphing can be run as a standalone Python file.
131
135
132
136
To install this package, run command:
@@ -135,7 +139,7 @@ To install this package, run command:
135
139
| Windows |`py -m pip install matplotlib`|
136
140
| macOS |`python3 -m pip install matplotlib`|
137
141
138
-
#### Installing PyCLibrary Package
142
+
#####Installing PyCLibrary Package
139
143
Some sequences require external C resources, and requires the [PyCLibrary](https://pyclibrary.readthedocs.io/en/latest/) library. Once the PyCLibrary library is installed, each sequence that involves external C resources can be run as a standalone Python file.
140
144
141
145
To install this package, run command:
@@ -144,7 +148,7 @@ To install this package, run command:
144
148
| Windows |`py -m pip install pyclibrary`|
145
149
| macOS |`python3 -m pip install pyclibrary`|
146
150
147
-
#### Installing pyserial Package
151
+
#####Installing pyserial Package
148
152
Some sequences involve connecting to a serial interface instrument and requires the [pyserial](https://pypi.org/project/pyserial/) library (version 3.5 or greater). Once the pyserial library is installed, each sequence that involves a serial interface can be run as a standalone Python file.
149
153
150
154
To install this package, run command:
@@ -153,6 +157,26 @@ To install this package, run command:
153
157
| Windows |`py -m pip install pyserial`|
154
158
| macOS |`python3 -m pip install pyserial`|
155
159
160
+
#### Package Helpers
161
+
162
+
##### How to View All Installed Packages
163
+
A list of all installed packages can be displayed.
164
+
165
+
To view all installed packages, run command:
166
+
| OS | Command |
167
+
| - | - |
168
+
| Windows |`pip freeze`|
169
+
| macOS |`pip3 freeze`|
170
+
171
+
##### How to View Details of an Installed Package
172
+
After a package is installed the details of a package can be displayed.
173
+
174
+
To view details of a package, run command:
175
+
| OS | Command |
176
+
| - | - |
177
+
| Windows |`pip show <package name>`|
178
+
| macOS |`pip3 show <package name>`|
179
+
156
180
### General Usage
157
181
For most examples, you may need to modify the specified IP address within a sequence to match the IP address that is physically set on your SpikeSafe's DIP switch. In each sequence, the default IP address of 10.0.0.220 is set in the line `ip_address = '10.0.0.220'`.
Copy file name to clipboardExpand all lines: application_specific_examples/controlling_thermal_platform_temperature/ControllingThermalPlatformTemperature.py
Copy file name to clipboardExpand all lines: application_specific_examples/fixed_pulse_count_using_software_timing/FixedPulseCountUsingSoftwareTimingExample.py
# instantiate new TcpSocket to connect to SpikeSafe
91
98
tcp_socket=TcpSocket()
92
99
tcp_socket.open_socket(ip_address, port_number)
93
100
94
-
# reset to default state and check for all events,
101
+
# reset to default state and check for all events, this will automatically abort digitizer in order get it into a known state. This is good practice when connecting to a SpikeSafe PSMU
95
102
# it is best practice to check for errors after sending each command
96
103
tcp_socket.send_scpi_command('*RST')
97
104
log_all_events(tcp_socket)
98
-
99
-
# abort digitizer in order get it into a known state. This is good practice when connecting to a SpikeSafe PSMU
100
-
tcp_socket.send_scpi_command('VOLT:ABOR')
101
-
105
+
102
106
# set up Channel 1 for Bias Current output to determine the K-factor
0 commit comments