Skip to content

Commit 7f42fb5

Browse files
committed
Updated spikesafe_python_lib_docs
1 parent d7d0793 commit 7f42fb5

File tree

12 files changed

+226
-4
lines changed
  • spikesafe_python_lib_docs
    • ChannelData
      • current_reading_amps_formatted_float
      • current_reading_amps_formatted_string
      • voltage_reading_volts_formatted_float
      • voltage_reading_volts_formatted_string
    • DigitizerData
    • MemoryTableReadData
    • ScpiFormatter
    • SpikeSafeEnums

12 files changed

+226
-4
lines changed

spikesafe_python_lib_docs/ChannelData/current_reading_amps_formatted_float/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,29 @@ Return the current reading formatted to matching hardware decimal places.
1010
Return the current reading formatted to matching hardware decimal places.
1111

1212
### Examples
13+
The following example demonstrates the current_reading attribute. It initiates the request for SpikeSafe Memory Table Read and extracts bulk voltage, Channel 1's data, and Heat Sink 1's Temperature data from a MemoryTableReadData object.
14+
```
15+
# request SpikeSafe memory table
16+
tcp_socket.send_scpi_command('MEM:TABL:READ')
17+
18+
# read SpikeSafe memory table
19+
data = tcp_socket.read_data()
20+
21+
# parse SpikeSafe memory table
22+
memory_table_read = MemoryTableReadData().parse_memory_table_read(data)
23+
24+
# extract Bulk Voltage data
25+
bulk_voltage = memory_table_read.bulk_voltage
26+
27+
# extract Channel 1's data
28+
channel_number = memory_table_read.channel_data[0].channel_number
29+
current_reading = memory_table_read.channel_data[0].current_reading_amps_formatted_float()
30+
is_on_state = memory_table_read.channel_data[0].is_on_state
31+
voltage_reading = memory_table_read.channel_data[0].voltage_reading_volts_formatted_float()
32+
33+
# extract Heatsink 1's Temperature Data
34+
heat_sink_number = memory_table_read.temperature_data[0].heat_sink_number
35+
temperature_reading = memory_table_read.temperature_data[0].temperature_reading
36+
```
1337

1438
### Examples In Action

spikesafe_python_lib_docs/ChannelData/current_reading_amps_formatted_string/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,29 @@ Return the current reading formatted to matching hardware decimal places.
1010
Return the current reading formatted to matching hardware decimal places.
1111

1212
### Examples
13+
The following example demonstrates the current_reading attribute. It initiates the request for SpikeSafe Memory Table Read and extracts bulk voltage, Channel 1's data, and Heat Sink 1's Temperature data from a MemoryTableReadData object.
14+
```
15+
# request SpikeSafe memory table
16+
tcp_socket.send_scpi_command('MEM:TABL:READ')
17+
18+
# read SpikeSafe memory table
19+
data = tcp_socket.read_data()
20+
21+
# parse SpikeSafe memory table
22+
memory_table_read = MemoryTableReadData().parse_memory_table_read(data)
23+
24+
# extract Bulk Voltage data
25+
bulk_voltage = memory_table_read.bulk_voltage
26+
27+
# extract Channel 1's data
28+
channel_number = memory_table_read.channel_data[0].channel_number
29+
current_reading = memory_table_read.channel_data[0].current_reading_amps_formatted_string()
30+
is_on_state = memory_table_read.channel_data[0].is_on_state
31+
voltage_reading = memory_table_read.channel_data[0].voltage_reading_volts_formatted_string()
32+
33+
# extract Heatsink 1's Temperature Data
34+
heat_sink_number = memory_table_read.temperature_data[0].heat_sink_number
35+
temperature_reading = memory_table_read.temperature_data[0].temperature_reading
36+
```
1337

1438
### Examples In Action

spikesafe_python_lib_docs/ChannelData/voltage_reading_volts_formatted_float/README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,32 @@ Return the voltage reading formatted to matching hardware decimal places.
77

88
### Returns
99
[float](https://docs.python.org/3/library/functions.html#float)
10-
Return the voltage reading formatted to matching hardware decimal places.
10+
Return the voltage reading formatted to matching hardware decimal places.
11+
12+
### Examples
13+
The following example demonstrates the current_reading attribute. It initiates the request for SpikeSafe Memory Table Read and extracts bulk voltage, Channel 1's data, and Heat Sink 1's Temperature data from a MemoryTableReadData object.
14+
```
15+
# request SpikeSafe memory table
16+
tcp_socket.send_scpi_command('MEM:TABL:READ')
17+
18+
# read SpikeSafe memory table
19+
data = tcp_socket.read_data()
20+
21+
# parse SpikeSafe memory table
22+
memory_table_read = MemoryTableReadData().parse_memory_table_read(data)
23+
24+
# extract Bulk Voltage data
25+
bulk_voltage = memory_table_read.bulk_voltage
26+
27+
# extract Channel 1's data
28+
channel_number = memory_table_read.channel_data[0].channel_number
29+
current_reading = memory_table_read.channel_data[0].current_reading_amps_formatted_float()
30+
is_on_state = memory_table_read.channel_data[0].is_on_state
31+
voltage_reading = memory_table_read.channel_data[0].voltage_reading_volts_formatted_float()
32+
33+
# extract Heatsink 1's Temperature Data
34+
heat_sink_number = memory_table_read.temperature_data[0].heat_sink_number
35+
temperature_reading = memory_table_read.temperature_data[0].temperature_reading
36+
```
37+
38+
### Examples In Action

spikesafe_python_lib_docs/ChannelData/voltage_reading_volts_formatted_string/README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,32 @@ Return the voltage reading formatted to matching hardware decimal places.
77

88
### Returns
99
[string](https://docs.python.org/3/library/string.html)
10-
Return the voltage reading formatted to matching hardware decimal places.
10+
Return the voltage reading formatted to matching hardware decimal places.
11+
12+
### Examples
13+
The following example demonstrates the current_reading attribute. It initiates the request for SpikeSafe Memory Table Read and extracts bulk voltage, Channel 1's data, and Heat Sink 1's Temperature data from a MemoryTableReadData object.
14+
```
15+
# request SpikeSafe memory table
16+
tcp_socket.send_scpi_command('MEM:TABL:READ')
17+
18+
# read SpikeSafe memory table
19+
data = tcp_socket.read_data()
20+
21+
# parse SpikeSafe memory table
22+
memory_table_read = MemoryTableReadData().parse_memory_table_read(data)
23+
24+
# extract Bulk Voltage data
25+
bulk_voltage = memory_table_read.bulk_voltage
26+
27+
# extract Channel 1's data
28+
channel_number = memory_table_read.channel_data[0].channel_number
29+
current_reading = memory_table_read.channel_data[0].current_reading_amps_formatted_string()
30+
is_on_state = memory_table_read.channel_data[0].is_on_state
31+
voltage_reading = memory_table_read.channel_data[0].voltage_reading_volts_formatted_string()
32+
33+
# extract Heatsink 1's Temperature Data
34+
heat_sink_number = memory_table_read.temperature_data[0].heat_sink_number
35+
temperature_reading = memory_table_read.temperature_data[0].temperature_reading
36+
```
37+
38+
### Examples In Action

spikesafe_python_lib_docs/DigitizerData/voltage_reading_formatted_float/README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,24 @@ Return the voltage reading formatted to matching hardware decimal places.
77

88
### Returns
99
[float](https://docs.python.org/3/library/functions.html#float)
10-
Return the voltage reading formatted to matching hardware decimal places.
10+
Return the voltage reading formatted to matching hardware decimal places.
11+
12+
### Examples
13+
The following example demonstrates the voltage_reading attribute. It checks if the PSMU Digitizer has finished measuring voltage data every 500 milliseconds, fetches its measuremments, and store thems in sample and voltage arrays to be used for plotting in a graph.
14+
```
15+
# wait for the Digitizer measurements to complete
16+
wait_for_new_voltage_data(tcp_socket, 0.5)
17+
18+
# fetch the Digitizer voltage readings using VOLT:FETC? query
19+
digitizerData = []
20+
digitizerData = fetch_voltage_data(tcp_socket)
21+
22+
# prepare digitizer voltage data to plot
23+
samples = []
24+
voltage_readings = []
25+
for dd in digitizerData:
26+
samples.append(dd.sample_number)
27+
voltage_readings.append(dd.voltage_reading.voltage_reading_volts_formatted_float())
28+
```
29+
30+
### Examples In Action

spikesafe_python_lib_docs/DigitizerData/voltage_reading_formatted_string/README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,24 @@ Return the voltage reading formatted to matching hardware decimal places.
77

88
### Returns
99
[string](https://docs.python.org/3/library/string.html)
10-
Return the voltage reading formatted to matching hardware decimal places.
10+
Return the voltage reading formatted to matching hardware decimal places.
11+
12+
### Examples
13+
The following example demonstrates the voltage_reading attribute. It checks if the PSMU Digitizer has finished measuring voltage data every 500 milliseconds, fetches its measuremments, and store thems in sample and voltage arrays to be used for plotting in a graph.
14+
```
15+
# wait for the Digitizer measurements to complete
16+
wait_for_new_voltage_data(tcp_socket, 0.5)
17+
18+
# fetch the Digitizer voltage readings using VOLT:FETC? query
19+
digitizerData = []
20+
digitizerData = fetch_voltage_data(tcp_socket)
21+
22+
# prepare digitizer voltage data to plot
23+
samples = []
24+
voltage_readings = []
25+
for dd in digitizerData:
26+
samples.append(dd.sample_number)
27+
voltage_readings.append(dd.voltage_reading.voltage_reading_volts_formatted_string())
28+
```
29+
30+
### Examples In Action

spikesafe_python_lib_docs/MemoryTableReadData/bulk_voltage_volts_formatted_float/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,29 @@ Return the bulk voltage reading formatted to matching hardware decimal places.
1010
Return the bulk voltage reading formatted to matching hardware decimal places.
1111

1212
### Examples
13+
The following example demonstrates the bulk_voltage attribute. It initiates the request for SpikeSafe Memory Table Read and extracts bulk voltage, Channel 1's data, and Heat Sink 1's Temperature data from a MemoryTableReadData object.
14+
```
15+
# request SpikeSafe memory table
16+
tcp_socket.send_scpi_command('MEM:TABL:READ')
17+
18+
# read SpikeSafe memory table
19+
data = tcp_socket.read_data()
20+
21+
# parse SpikeSafe memory table
22+
memory_table_read = MemoryTableReadData().parse_memory_table_read(data)
23+
24+
# extract Bulk Voltage data
25+
bulk_voltage = memory_table_read.bulk_voltage_volts_formatted_float()
26+
27+
# extract Channel 1's data
28+
channel_number = memory_table_read.channel_data[0].channel_number
29+
current_reading = memory_table_read.channel_data[0].current_reading
30+
is_on_state = memory_table_read.channel_data[0].is_on_state
31+
voltage_reading = memory_table_read.channel_data[0].voltage_reading
32+
33+
# extract Heatsink 1's Temperature Data
34+
heat_sink_number = memory_table_read.temperature_data[0].heat_sink_number
35+
temperature_reading = memory_table_read.temperature_data[0].temperature_reading
36+
```
1337

1438
### Examples In Action

spikesafe_python_lib_docs/MemoryTableReadData/bulk_voltage_volts_formatted_string/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,29 @@ Return the bulk voltage reading formatted to matching hardware decimal places.
1010
Return the bulk voltage reading formatted to matching hardware decimal places.
1111

1212
### Examples
13+
The following example demonstrates the bulk_voltage attribute. It initiates the request for SpikeSafe Memory Table Read and extracts bulk voltage, Channel 1's data, and Heat Sink 1's Temperature data from a MemoryTableReadData object.
14+
```
15+
# request SpikeSafe memory table
16+
tcp_socket.send_scpi_command('MEM:TABL:READ')
17+
18+
# read SpikeSafe memory table
19+
data = tcp_socket.read_data()
20+
21+
# parse SpikeSafe memory table
22+
memory_table_read = MemoryTableReadData().parse_memory_table_read(data)
23+
24+
# extract Bulk Voltage data
25+
bulk_voltage = memory_table_read.bulk_voltage_volts_formatted_string()
26+
27+
# extract Channel 1's data
28+
channel_number = memory_table_read.channel_data[0].channel_number
29+
current_reading = memory_table_read.channel_data[0].current_reading
30+
is_on_state = memory_table_read.channel_data[0].is_on_state
31+
voltage_reading = memory_table_read.channel_data[0].voltage_reading
32+
33+
# extract Heatsink 1's Temperature Data
34+
heat_sink_number = memory_table_read.temperature_data[0].heat_sink_number
35+
temperature_reading = memory_table_read.temperature_data[0].temperature_reading
36+
```
1337

1438
### Examples In Action

spikesafe_python_lib_docs/ScpiFormatter/get_scpi_format_integer_for_bool/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,12 @@ Return the SCPI formatted value for a boolean value.
1010
Return the SCPI formatted value for a boolean value. 1 for True, 0 for False.
1111

1212
### Examples
13+
The following example demonstrates the `get_scpi_format_integer_for_bool()` function. It sends the SpikeSafe PSMU current range auto SCPI command.
14+
```
15+
# set the SpikeSafe Current Range to Auto
16+
set_current_range_auto = True
17+
tcp_socket.send_scpi_command(f'SOUR1:CURR:RANG:AUTO {get_scpi_format_integer_for_bool(set_current_range_auto)}')
18+
19+
```
1320

1421
### Examples In Action

spikesafe_python_lib_docs/ScpiFormatter/get_scpi_format_on_state_for_bool/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,12 @@ Return the SCPI formatted value for a boolean value
1010
Return the SCPI formatted value for a boolean value. 'ON' for True, 'OFF' for False.
1111

1212
### Examples
13+
The following example demonstrates the `get_scpi_format_on_state_for_bool()` function. It sends the SpikeSafe PSMU pulse width adjustment SCPI command.
14+
```
15+
# set the SpikeSafe Pulse Width Adjustment to on
16+
pulse_width_adjustment = True
17+
tcp_socket.send_scpi_command(f'SOUR1:PULS:AADJ {get_scpi_format_on_state_for_bool(pulse_width_adjustment)}')
18+
19+
```
1320

1421
### Examples In Action

0 commit comments

Comments
 (0)