Skip to content

Commit 8f2dcdf

Browse files
authored
Merge pull request #49 from VektrexElectronicSystems/development
Development 1.6.0
2 parents 415c277 + d7ffc4d commit 8f2dcdf

File tree

92 files changed

+34509
-23519
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+34509
-23519
lines changed

README.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,34 @@ Use these code samples to start learning how to communicate with your SpikeSafe
1111
- [Making Integrated Voltage Measurements](making_integrated_voltage_measurements) - These folders contain examples to measure voltage using the SpikeSafe PSMU's integrated voltage Digitizer. The SpikeSafe outputs current to an LED, Laser, or electrical equipment, and then voltage measurements are read and displayed onscreen.
1212
- [Using the Force Sense Selector Switch](using_force_sense_selector_switch) - These folders contain examples to operate the optional integrated switch within the SpikeSafe PSMU. The SpikeSafe outputs to an LED, Laser, or electrical equipment as in the previous examples, and the switch is used to either disconnect the SpikeSafe from the test circuit or to operate an auxiliary source to power the DUT.
1313
- [Application-Specific Examples](application_specific_examples) - These folders consist of more advanced sequences to address specific test scenarios, as well as some demonstrations to fine-tune your SpikeSafe current output. These sequences explain how to make light measurements using a SpikeSafe and a spectrometer, how to make in-situ junction temperature measurements on LEDs, and how to take full advantage of all SpikeSafe features.
14+
- [spikesafe-python API Overview](spikesafe_python_lib_docs). These folders contain complete class documentation for the spikesafe-python package used to power all of the aforementioned example directories.
1415

1516
## Usage
1617

17-
### IDE and Using a Virtual Environment
18-
To run these sequences an IDE such as [Visual Studio Code](https://code.visualstudio.com/) is required, see [Getting Started with Python in VS Code](https://code.visualstudio.com/docs/python/python-tutorial) to simply setup your IDE with Python. Optionally, using a [virtual environment](https://docs.python.org/3/tutorial/venv.html) is recommended to successfully meet the installation requirements to run these sequences. Using the commands `py -3 -m venv .venv` followed by `.venv\scripts\activate` is a simple way to setup your virtual environment. After your IDE and virtual environment is setup, continue to install the remaining Python packages below.
18+
### IDEs
1919

20-
### Installing spikesafe-python Package
21-
The [spikesafe-python](https://pypi.org/project/spikesafe-python/) library will need to be installed using the command `python -m pip install spikesafe-python`. Vektrex recommends always having the latest version of spikesafe-python when running these sequences; the current version is 1.1.0.
20+
#### Visual Studio Code and Using a Virtual Environment
21+
To run these sequences a light-weight IDE, or to target cross-platform development, use the free [Visual Studio Code](https://code.visualstudio.com/). See [Getting Started with Python in VS Code](https://code.visualstudio.com/docs/python/python-tutorial) to simply setup your IDE with Python. Optionally, using a [virtual environment](https://docs.python.org/3/tutorial/venv.html) is recommended to successfully meet the installation requirements to run these sequences. Using the commands `py -3 -m venv .venv` followed by `.venv\scripts\activate` is a simple way to setup your virtual environment. After your IDE and virtual environment is setup, continue to install the remaining Python packages below.
22+
23+
#### Visual Studio Community
24+
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.
25+
26+
### Packages
27+
28+
#### Installing spikesafe-python Package
29+
The [spikesafe-python](https://pypi.org/project/spikesafe-python/) library will need to be installed using the command `python -m pip install spikesafe-python`. Vektrex recommends always having the latest version of spikesafe-python when running these sequences; the current version is 1.2.3.
2230

2331
Once the spikesafe-python package is installed, each script in this repository can be run independently as a standalone Python file. Run a file in its current state and verify that the expected outputs are obtained, as specified by the file's markdown description.
2432

25-
### Installing matplotlib Package
33+
Complete class documentation is available for spikesafe-python in [spikesafe-python API Overview](spikesafe_python_lib_docs).
34+
35+
#### Installing matplotlib Package
2636
Some sequences involve graphing measurement results. To properly graph results, the [matplotlib](https://matplotlib.org/) library is required (version 3.2.1 or greater). Use the command `python -m pip install matplotlib` to install the latest version of matplotlib. Once the matplotlib library is installed, each sequence that involves graphing can be run as a standalone Python file.
2737

28-
### Installing PyCLibrary Package
38+
#### Installing PyCLibrary Package
2939
Some sequences require external C resources, and requires the [PyCLibrary](https://pyclibrary.readthedocs.io/en/latest/) library. To install this library, enter the command `python -m pip install pyclibrary`. Once the PyCLibrary library is installed, each sequence that involves external C resources can be run as a standalone Python file.
3040

31-
### Installing pyserial Package
41+
#### Installing pyserial Package
3242
Some sequences involve connecting to a serial interface instrument and requires the [pyserial](https://pypi.org/project/pyserial/) library (version 3.5 or greater). Use the command `python -m pip install pyserial` to install the latest version of pyserial. Once the pyserial library is installed, each sequence that involves a serial interface can be run as a standalone Python file.
3343

3444
### General Usage

application_specific_examples/controlling_thermal_platform_temperature/ControllingThermalPlatformTemperature.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
### setting up sequence log
1818
log = logging.getLogger(__name__)
19-
logging.basicConfig(filename='SpikeSafePythonSamples.log',format='%(asctime)s, %(levelname)s, %(message)s',datefmt='%m/%d/%Y %I:%M:%S',level=logging.INFO)
19+
logging.basicConfig(filename='SpikeSafePythonSamples.log',format='%(asctime)s.%(msecs)03d, %(levelname)s, %(message)s',datefmt='%m/%d/%Y %I:%M:%S',level=logging.INFO)
2020

2121
### start of main program
2222
try:

application_specific_examples/fixed_pulse_count_using_software_timing/FixedPulseCountUsingSoftwareTimingExample.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import logging
77
from spikesafe_python.ReadAllEvents import log_all_events
88
from spikesafe_python.ReadAllEvents import read_until_event
9+
from spikesafe_python.SpikeSafeEvents import SpikeSafeEvents
910
from spikesafe_python.SpikeSafeError import SpikeSafeError
1011
from spikesafe_python.TcpSocket import TcpSocket
1112

@@ -17,7 +18,7 @@
1718

1819
### setting up sequence log
1920
log = logging.getLogger(__name__)
20-
logging.basicConfig(filename='SpikeSafePythonSamples.log',format='%(asctime)s, %(levelname)s, %(message)s',datefmt='%m/%d/%Y %I:%M:%S',level=logging.INFO)
21+
logging.basicConfig(filename='SpikeSafePythonSamples.log',format='%(asctime)s.%(msecs)03d, %(levelname)s, %(message)s',datefmt='%m/%d/%Y %I:%M:%S',level=logging.INFO)
2122

2223
### start of main program
2324
try:
@@ -84,7 +85,7 @@
8485
tcp_socket.send_scpi_command('OUTP1 ON')
8586

8687
# wait until Channel 1 is ready
87-
read_until_event(tcp_socket, 100) # event 100 is "Channel Ready"
88+
read_until_event(tcp_socket, SpikeSafeEvents.CHANNEL_READY) # event 100 is "Channel Ready"
8889

8990
# pulsing starts before before getting Channel Ready message
9091
# wait 30ms for getting ~10000 pulses

application_specific_examples/fixed_pulse_count_using_software_timing/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ Making fixed pulsed count using software-based timing is simple when a rough num
2222

2323
## Considerations
2424
- See [Run Pulsed](../../run_spikesafe_operating_modes/run_pulsed) for further descriptions of when to Continuous and Continuous Dynamic operation modes.
25-
- SpikeSafe current pulse train starts when the SpikeSafe channel is turned on. To ensure expected current pulsing is supplied, the time to achieve pulse count is started after `Event 100, Channel Ready`, there's an expectation to in excess over the expected number of pulses.
26-
- `Event 100, Channel Ready` signals current pulses are outputting at the desired set current amperage. In this example prior to this event, the SpikeSafe current pulse train begins to ramp up from 0A to 100mA, once current stabilizes at 100mA the channel ready event is signaled. See the following timing diagram showing how the software timer, pulsed current output, and channel ready event are related:
25+
- SpikeSafe current pulse train starts when the SpikeSafe channel is turned on. To ensure expected current pulsing is supplied, the time to achieve pulse count is started after event `100, Channel Ready`, there's an expectation to in excess over the expected number of pulses.
26+
- Event `100, Channel Ready` signals current pulses are outputting at the desired set current amperage. In this example prior to this event, the SpikeSafe current pulse train begins to ramp up from 0A to 100mA, once current stabilizes at 100mA the channel ready event is signaled. See the following timing diagram showing how the software timer, pulsed current output, and channel ready event are related:
2727
![](timing_diagram.png)
2828
- Due to software-based timing there will be a difference between the number of actual pulses and the expected number of pulses.
2929

application_specific_examples/making_tj_measurements/TjMeasurement.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from spikesafe_python.MemoryTableReadData import log_memory_table_read
1818
from spikesafe_python.ReadAllEvents import log_all_events
1919
from spikesafe_python.ReadAllEvents import read_until_event
20+
from spikesafe_python.SpikeSafeEvents import SpikeSafeEvents
2021
from spikesafe_python.TcpSocket import TcpSocket
2122
from spikesafe_python.Threading import wait
2223
from spikesafe_python.SpikeSafeError import SpikeSafeError
@@ -72,7 +73,7 @@ def calculate_Vf0(start_point, end_point, digitizer_data_list):
7273

7374
### setting up sequence log
7475
log = logging.getLogger(__name__)
75-
logging.basicConfig(filename='SpikeSafePythonSamples.log',format='%(asctime)s, %(levelname)s, %(message)s',datefmt='%m/%d/%Y %I:%M:%S',level=logging.INFO)
76+
logging.basicConfig(filename='SpikeSafePythonSamples.log',format='%(asctime)s.%(msecs)03d, %(levelname)s, %(message)s',datefmt='%m/%d/%Y %I:%M:%S',level=logging.INFO)
7677

7778
### start of main program
7879
try:
@@ -103,7 +104,7 @@ def calculate_Vf0(start_point, end_point, digitizer_data_list):
103104
tcp_socket.send_scpi_command('OUTP1 1')
104105

105106
# wait until Channel 1 is ready to pulse
106-
read_until_event(tcp_socket, 100) # event 100 is "Channel Ready"
107+
read_until_event(tcp_socket, SpikeSafeEvents.CHANNEL_READY) # event 100 is "Channel Ready"
107108

108109
log_and_print_to_console('\nMeasurement Current is currently outputting to the DUT.\n\nPress \'Enter\' in the console once temperature has been stabilized at T1, then record V1 and T1.')
109110
input()
@@ -155,7 +156,7 @@ def calculate_Vf0(start_point, end_point, digitizer_data_list):
155156
tcp_socket.send_scpi_command('OUTP1 1')
156157

157158
# wait until Channel 1 is ready to pulse
158-
read_until_event(tcp_socket, 100) # event 100 is "Channel Ready"
159+
read_until_event(tcp_socket, SpikeSafeEvents.CHANNEL_READY) # event 100 is "Channel Ready"
159160

160161
log_and_print_to_console('\nHeating Current is being outputted.\n\nWait until temperature has stabilized, then press \'Enter\' in the console to take voltage measurements.')
161162
input()

application_specific_examples/measuring_dc_staircase_voltages/MeasuringDcStaircaseVoltages.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from spikesafe_python.MemoryTableReadData import MemoryTableReadData
1515
from spikesafe_python.ReadAllEvents import log_all_events
1616
from spikesafe_python.ReadAllEvents import read_until_event
17+
from spikesafe_python.SpikeSafeEvents import SpikeSafeEvents
1718
from spikesafe_python.SpikeSafeError import SpikeSafeError
1819
from spikesafe_python.TcpSocket import TcpSocket
1920
from matplotlib import pyplot as plt
@@ -33,7 +34,7 @@
3334

3435
### setting up sequence log
3536
log = logging.getLogger(__name__)
36-
logging.basicConfig(filename='SpikeSafePythonSamples.log',format='%(asctime)s, %(levelname)s, %(message)s',datefmt='%m/%d/%Y %I:%M:%S',level=logging.INFO)
37+
logging.basicConfig(filename='SpikeSafePythonSamples.log',format='%(asctime)s.%(msecs)03d, %(levelname)s, %(message)s',datefmt='%m/%d/%Y %I:%M:%S',level=logging.INFO)
3738

3839
### start of main program
3940
try:
@@ -72,7 +73,7 @@
7273
tcp_socket.send_scpi_command('OUTP1 ON')
7374

7475
# wait until Channel 1 is ready
75-
read_until_event(tcp_socket, 100) # event 100 is "Channel Ready"
76+
read_until_event(tcp_socket, SpikeSafeEvents.CHANNEL_READY) # event 100 is "Channel Ready"
7677

7778
# set Digitizer to abort any measurements
7879
tcp_socket.send_scpi_command('VOLT:ABOR')

application_specific_examples/measuring_wavelength_spectrum/WavelengthSpectrumExample.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from spikesafe_python.MemoryTableReadData import log_memory_table_read
1414
from spikesafe_python.ReadAllEvents import log_all_events
1515
from spikesafe_python.ReadAllEvents import read_until_event
16+
from spikesafe_python.SpikeSafeEvents import SpikeSafeEvents
1617
from spikesafe_python.TcpSocket import TcpSocket
1718
from spikesafe_python.Threading import wait
1819
from spikesafe_python.SpikeSafeError import SpikeSafeError
@@ -46,7 +47,7 @@
4647

4748
### setting up sequence log
4849
log = logging.getLogger(__name__)
49-
logging.basicConfig(filename='SpikeSafePythonSamples.log',format='%(asctime)s, %(levelname)s, %(message)s',datefmt='%m/%d/%Y %I:%M:%S',level=logging.INFO)
50+
logging.basicConfig(filename='SpikeSafePythonSamples.log',format='%(asctime)s.%(msecs)03d, %(levelname)s, %(message)s',datefmt='%m/%d/%Y %I:%M:%S',level=logging.INFO)
5051

5152
### start of main program
5253
try:
@@ -150,7 +151,7 @@
150151
log_all_events(tcp_socket)
151152

152153
# wait until the channel is fully ramped and output a single pulse
153-
read_until_event(tcp_socket, 100) # event 100 is "Channel Ready"
154+
read_until_event(tcp_socket, SpikeSafeEvents.CHANNEL_READY) # event 100 is "Channel Ready"
154155
tcp_socket.send_scpi_command('OUTP1:TRIG')
155156

156157
# take a CAS4 measurement

application_specific_examples/pulse_tuning/PulseTuningExample.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from spikesafe_python.MemoryTableReadData import log_memory_table_read
1313
from spikesafe_python.ReadAllEvents import log_all_events
1414
from spikesafe_python.ReadAllEvents import read_until_event
15+
from spikesafe_python.SpikeSafeEvents import SpikeSafeEvents
1516
from spikesafe_python.TcpSocket import TcpSocket
1617
from spikesafe_python.Threading import wait
1718
from tkinter import messagebox
@@ -22,7 +23,7 @@
2223

2324
### setting up sequence log
2425
log = logging.getLogger(__name__)
25-
logging.basicConfig(filename='SpikeSafePythonSamples.log',format='%(asctime)s, %(levelname)s, %(message)s',datefmt='%m/%d/%Y %I:%M:%S',level=logging.INFO)
26+
logging.basicConfig(filename='SpikeSafePythonSamples.log',format='%(asctime)s.%(msecs)03d, %(levelname)s, %(message)s',datefmt='%m/%d/%Y %I:%M:%S',level=logging.INFO)
2627

2728
### defining the action to take per test session
2829
def run_single_pulse_tuning_test(load_impedance, rise_time):
@@ -40,7 +41,7 @@ def run_single_pulse_tuning_test(load_impedance, rise_time):
4041
tcp_socket.send_scpi_command('OUTP1 1')
4142

4243
# Wait until channels are ready for a trigger command
43-
read_until_event(tcp_socket, 100) # event 100 is "Channel Ready"
44+
read_until_event(tcp_socket, SpikeSafeEvents.CHANNEL_READY) # event 100 is "Channel Ready"
4445

4546
# Output 1ms pulse for all channels
4647
tcp_socket.send_scpi_command('OUTP1:TRIG')
@@ -100,7 +101,7 @@ class RiseTime(Enum):
100101
# set channel 1's pulse width to 100µs. Of the pulse time settings, only Pulse On Time and Pulse Width [+Offset] are relevant in Single Pulse mode
101102
tcp_socket.send_scpi_command('SOUR1:PULS:TON 0.0001')
102103

103-
# set channel 1's output ramp to fast so that tests can be run in succession
104+
# set channel 1's output ramp to fast
104105
tcp_socket.send_scpi_command('OUTP1:RAMP FAST')
105106

106107
# Check for any errors with initializing commands

application_specific_examples/pulse_tuning/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Current pulse shape should be measured using an oscilloscope in conjunction with
1717
- **Set Current:** 100mA
1818
- **Compliance Voltage:** 20V
1919
- **On Time:** 100µs
20-
- **Ramp Rate:** Fast. Voltage will ramp as fast as 1000V/sec. Current will ramp as fast as 50A/sec.
20+
- **Ramp Rate:** Fast. Voltage will ramp as fast as 1000V/sec. Current will ramp as fast as 50A/sec. Fast ramp is almost always recommended to make the current pulse appear sooner. There may be cases where Fast ramp results in a small current through the load capacitance at startup due to the high dV/dt, in these cases Slow ramp is useful for devices that require a gentler turn-on.
2121
- **Rise Time:** Very Slow, Slow, Medium, and Fast. This is one of two primary factors that affects pulse shape.
2222
- **Load Impedance:** Very Low, Low, Medium, and High. This is the other primary factor that affects pulse shape.
2323

application_specific_examples/running_liv_sweeps/LIVSweepExample.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from spikesafe_python.MemoryTableReadData import log_memory_table_read
1818
from spikesafe_python.ReadAllEvents import log_all_events
1919
from spikesafe_python.ReadAllEvents import read_until_event
20+
from spikesafe_python.SpikeSafeEvents import SpikeSafeEvents
2021
from spikesafe_python.TcpSocket import TcpSocket
2122
from spikesafe_python.Threading import wait
2223
from spikesafe_python.SpikeSafeError import SpikeSafeError
@@ -55,7 +56,7 @@
5556

5657
### setting up sequence log
5758
log = logging.getLogger(__name__)
58-
logging.basicConfig(filename='SpikeSafePythonSamples.log',format='%(asctime)s, %(levelname)s, %(message)s',datefmt='%m/%d/%Y %I:%M:%S',level=logging.INFO)
59+
logging.basicConfig(filename='SpikeSafePythonSamples.log',format='%(asctime)s.%(msecs)03d, %(levelname)s, %(message)s',datefmt='%m/%d/%Y %I:%M:%S',level=logging.INFO)
5960

6061
### start of main program
6162
try:
@@ -180,7 +181,7 @@
180181
tcp_socket.send_scpi_command('VOLT:INIT')
181182

182183
# Wait until SpikeSafe Channel 1 is ready for a trigger command
183-
read_until_event(tcp_socket, 100) # event 100 is "Channel Ready"
184+
read_until_event(tcp_socket, SpikeSafeEvents.CHANNEL_READY) # event 100 is "Channel Ready"
184185

185186
# Output pulsed sweep for Channel 1
186187
tcp_socket.send_scpi_command('OUTP1:TRIG')

0 commit comments

Comments
 (0)