Skip to content

Commit 6f54daa

Browse files
committed
Added spikesafe_lib_docs for spikesafe_python.DigitizerFetch Middle/End of Time Sampling functions and related classes
1 parent 4069afd commit 6f54daa

File tree

10 files changed

+252
-0
lines changed

10 files changed

+252
-0
lines changed

spikesafe_python_lib_docs/DigitizerData/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ A class used to store data in a simple accessible object from a digitizer fetch
99
| Name | Description |
1010
| - | - |
1111
| [sample_number](/spikesafe_python_lib_docs/DigitizerData/sample_number/README.md) | Sample number of the voltage reading. |
12+
| [time_since_start_seconds](/spikesafe_python_lib_docs/DigitizerData/time_since_start_seconds/README.md) | Time since the start of the sampling in seconds. |
1213
| [voltage_reading](/spikesafe_python_lib_docs/DigitizerData/voltage_reading/README.md) | Digitizer voltage reading. |
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# [spikesafe-python API Overview](/spikesafe_python_lib_docs/README.md) | [DigitizerData](/spikesafe_python_lib_docs/DigitizerData/README.md) | time_since_start_seconds
2+
3+
## time_since_start_seconds
4+
5+
### Definition
6+
Time since the start of the sampling in seconds.
7+
8+
### Attribute Value
9+
[float](https://docs.python.org/3/library/functions.html#float)
10+
11+
### Examples
12+
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.
13+
```
14+
# wait for the Digitizer measurements to complete
15+
wait_for_new_voltage_data(tcp_socket, 0.5)
16+
17+
# fetch the Digitizer voltage readings using VOLT:FETC? query
18+
digitizerData = []
19+
digitizerData = fetch_voltage_data_sampling_mode_linear(
20+
spike_safe_socket=tcp_socket,
21+
time_sampling_mode=TimeSamplingMode.MIDDLE_OF_TIME,
22+
aperture_microseconds=2,
23+
reading_count=3,
24+
hardware_trigger_delay_microseconds=0,
25+
pulse_period_seconds=0
26+
)
27+
28+
# prepare digitizer voltage data to plot
29+
samples = []
30+
voltage_readings = []
31+
time_since_start_seconds = []
32+
for dd in digitizerData:
33+
samples.append(dd.sample_number)
34+
time_since_start_seconds.append(dd.time_since_start_seconds)
35+
voltage_readings.append(dd.voltage_reading)
36+
```
37+
38+
### Examples In Action
39+
[/making_integrated_voltage_measurements/measure_voltage_across_pulse/MeasureVoltageAcrossPulse.py](/making_integrated_voltage_measurements/measure_voltage_across_pulse/MeasureVoltageAcrossPulse.py)

spikesafe_python_lib_docs/DigitizerDataFetch/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,8 @@ Provides a collection of helper functions you can use to take PSMU Digitizer mea
99
| Name | Description |
1010
| - | - |
1111
| [fetch_voltage_data(spike_safe_socket, enable_logging = None)](/spikesafe_python_lib_docs/DigitizerDataFetch/fetch_voltage_data/README.md) | Returns an array of voltage readings from the digitizer obtained through a fetch query. |
12+
| [fetch_voltage_data_sampling_mode_custom(spike_safe_socket, time_sampling_mode, custom_sequence, hardware_trigger_delay_microseconds = 0, enable_logging = None)](/spikesafe_python_lib_docs/DigitizerDataFetch/fetch_voltage_data_sampling_mode_custom/README.md) | Returns an array of voltage readings using custom sampling mode from the digitizer obtained through a fetch query. |
13+
| [fetch_voltage_data_sampling_mode_linear(spike_safe_socket, time_sampling_mode, aperture_microseconds, reading_count, hardware_trigger_delay_microseconds = 0, pulse_period_seconds = 0, enable_logging = None)](/spikesafe_python_lib_docs/DigitizerDataFetch/fetch_voltage_data_sampling_mode_linear/README.md) | Returns an array of voltage readings using linear sampling mode from the digitizer obtained through a fetch query. |
14+
| [fetch_voltage_data_sampling_mode_logarithmic(spike_safe_socket, time_sampling_mode, sampling_mode, hardware_trigger_delay_microseconds = 0, enable_logging = None)](/spikesafe_python_lib_docs/DigitizerDataFetch/fetch_voltage_data_sampling_mode_logarithmic/README.md) | Returns an array of voltage readings using logarithmic sampling mode from the digitizer obtained through a fetch query. |
1215
| [get_new_voltage_data_estimated_complete_time(aperture_microseconds, reading_count, hardware_trigger_count=None, hardware_trigger_delay_microseconds=None)](/spikesafe_python_lib_docs/DigitizerDataFetch/get_new_voltage_data_estimated_complete_time/README.md) | Returns the estimated minimum possible time it will take for the SpikeSafe PSMU digitizer to acquire new voltage readings. If hardware triggering is used, this does not take into account the pulse period, so the actual time may be longer. |
1316
| [wait_for_new_voltage_data(spike_safe_socket, wait_time = 0.0, enable_logging = None)](/spikesafe_python_lib_docs/DigitizerDataFetch/wait_for_new_voltage_data/README.md) | Queries the SpikeSafe PSMU digitizer until it responds that it has acquired new data. |
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# [spikesafe-python API Overview](/spikesafe_python_lib_docs/README.md) | [DigitizerDataFetch](/spikesafe_python_lib_docs/DigitizerDataFetch/README.md) | fetch_voltage_data_sampling_mode_custom(spike_safe_socket, time_sampling_mode, custom_sequence, hardware_trigger_delay_microseconds = 0, enable_logging = None)
2+
3+
## fetch_voltage_data_sampling_mode_custom(spike_safe_socket, time_sampling_mode, custom_sequence, hardware_trigger_delay_microseconds = 0, enable_logging = None)
4+
5+
### Definition
6+
Returns an array of voltage readings using custom sampling mode from the digitizer obtained through a fetch query.
7+
8+
### Parameters
9+
spike_safe_socket [TcpSocket](/spikesafe_python_lib_docs/TcpSocket/README.md)
10+
Socket object used to communicate with SpikeSafe.
11+
12+
time_sampling_mode : [TimeSamplingMode](/spikesafe_python_lib_docs/DigitizerEnums/TimeSamplingMode/README.md)
13+
The time sampling mode to use for the voltage data. This should be an instance of the TimeSamplingMode enum from DigitizerEnums.
14+
15+
custom_sequence : [string](https://docs.python.org/3/library/string.html)
16+
The custom sequence to use for the voltage data
17+
18+
hardware_trigger_delay_microseconds : [int](https://docs.python.org/3/library/functions.html#int) [optional](https://docs.python.org/3/library/typing.html#typing.Optional)
19+
The hardware trigger delay in microseconds (default to 0us)
20+
21+
enable_logging : [bool](https://docs.python.org/3/library/stdtypes.html#boolean-values) [optional](https://docs.python.org/3/library/typing.html#typing.Optional)
22+
Overrides spike_safe_socket.enable_logging attribute (None by default, will use spike_safe_socket.enable_logging value).
23+
24+
### Returns
25+
[DigitizerData array](/spikesafe_python_lib_docs/DigitizerData/README.md)
26+
Contains an array of DigitizerData objects which have a defined voltage_reading, sample_number, and time_since_start_seconds attribute.
27+
28+
### Examples
29+
The following example demonstrates the fetch_voltage_data function. 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.
30+
```
31+
# wait for the Digitizer measurements to complete
32+
wait_for_new_voltage_data(tcp_socket, 0.5)
33+
34+
# fetch the Digitizer voltage readings using VOLT:FETC? query
35+
digitizerData = []
36+
digitizer_data = fetch_voltage_data_sampling_mode_custom(
37+
spike_safe_socket=tcp_socket,
38+
time_sampling_mode=TimeSamplingMode.MIDDLE_OF_TIME,
39+
custom_sequence="50@2,2@4,7@6,6@8,4@10,4@12,3@14,2@16,3@18,2@20,2@22,2@24,1@26,2@28,1@30,2@32,1@34,1@36,1@38,1@40,2@42,1@46,1@48,1@50,1@52,1@54,1@56,1@60,1@62,1@66,1@68,1@72,1@74,1@78,1@82,1@86,1@90,1@94,1@98,1@104,1@108,1@114,1@118,1@124,1@130,1@136,1@142,1@150,1@156,1@164,1@172,1@180,1@188,1@196,1@206,1@216,1@226,1@236,1@248,1@258,1@272,1@284,1@298,1@312,1@326,1@342,1@358,1@374,1@392,1@410,1@430,1@450"
40+
)
41+
42+
# prepare digitizer voltage data to plot
43+
samples = []
44+
voltage_readings = []
45+
time_since_start_seconds = []
46+
for dd in digitizerData:
47+
samples.append(dd.sample_number)
48+
time_since_start_seconds.append(dd.time_since_start_seconds)
49+
voltage_readings.append(dd.voltage_reading)
50+
```
51+
52+
### Examples In Action
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# [spikesafe-python API Overview](/spikesafe_python_lib_docs/README.md) | [DigitizerDataFetch](/spikesafe_python_lib_docs/DigitizerDataFetch/README.md) | fetch_voltage_data_sampling_mode_linear(spike_safe_socket, time_sampling_mode, aperture_microseconds, reading_count, hardware_trigger_delay_microseconds = 0, pulse_period_seconds = 0, enable_logging = None)
2+
3+
## fetch_voltage_data_sampling_mode_linear(spike_safe_socket, time_sampling_mode, aperture_microseconds, reading_count, hardware_trigger_delay_microseconds = 0, pulse_period_seconds = 0, enable_logging = None)
4+
5+
### Definition
6+
Returns an array of voltage readings using linear sampling mode from the digitizer obtained through a fetch query .
7+
8+
### Parameters
9+
spike_safe_socket [TcpSocket](/spikesafe_python_lib_docs/TcpSocket/README.md)
10+
Socket object used to communicate with SpikeSafe.
11+
12+
time_sampling_mode : [TimeSamplingMode](/spikesafe_python_lib_docs/DigitizerEnums/TimeSamplingMode/README.md)
13+
The time sampling mode to use for the voltage data. This should be an instance of the TimeSamplingMode enum from DigitizerEnums.
14+
15+
aperture_microseconds : [int](https://docs.python.org/3/library/functions.html#int)
16+
The aperture in microseconds for the voltage data
17+
18+
reading_count : [int](https://docs.python.org/3/library/functions.html#int)
19+
The number of readings to fetch
20+
21+
hardware_trigger_delay_microseconds : [int](https://docs.python.org/3/library/functions.html#int) [optional](https://docs.python.org/3/library/typing.html#typing.Optional)
22+
The hardware trigger delay in microseconds (default to 0us)
23+
24+
pulse_period_seconds : [float](https://docs.python.org/3/library/functions.html#float) [optional](https://docs.python.org/3/library/typing.html#typing.Optional)
25+
The pulse period in seconds (default to 0s)
26+
27+
enable_logging : [bool](https://docs.python.org/3/library/stdtypes.html#boolean-values) [optional](https://docs.python.org/3/library/typing.html#typing.Optional)
28+
Overrides spike_safe_socket.enable_logging attribute (None by default, will use spike_safe_socket.enable_logging value).
29+
30+
### Returns
31+
[DigitizerData array](/spikesafe_python_lib_docs/DigitizerData/README.md)
32+
Contains an array of DigitizerData objects which have a defined voltage_reading, sample_number, and time_since_start_seconds attribute.
33+
34+
### Examples
35+
The following example demonstrates the fetch_voltage_data function. 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.
36+
```
37+
# wait for the Digitizer measurements to complete
38+
wait_for_new_voltage_data(tcp_socket, 0.5)
39+
40+
# fetch the Digitizer voltage readings using VOLT:FETC? query
41+
digitizerData = []
42+
digitizerData = fetch_voltage_data_sampling_mode_linear(
43+
spike_safe_socket=tcp_socket,
44+
time_sampling_mode=TimeSamplingMode.MIDDLE_OF_TIME,
45+
aperture_microseconds=2,
46+
reading_count=3,
47+
hardware_trigger_delay_microseconds=0,
48+
pulse_period_seconds=0
49+
)
50+
51+
# prepare digitizer voltage data to plot
52+
samples = []
53+
voltage_readings = []
54+
time_since_start_seconds = []
55+
for dd in digitizerData:
56+
samples.append(dd.sample_number)
57+
time_since_start_seconds.append(dd.time_since_start_seconds)
58+
voltage_readings.append(dd.voltage_reading)
59+
```
60+
61+
### Examples In Action
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# [spikesafe-python API Overview](/spikesafe_python_lib_docs/README.md) | [DigitizerDataFetch](/spikesafe_python_lib_docs/DigitizerDataFetch/README.md) | fetch_voltage_data_sampling_mode_logarithmic(spike_safe_socket, time_sampling_mode, sampling_mode, hardware_trigger_delay_microseconds = 0, enable_logging = None)
2+
3+
## fetch_voltage_data_sampling_mode_logarithmic(spike_safe_socket, time_sampling_mode, sampling_mode, hardware_trigger_delay_microseconds = 0, enable_logging = None)
4+
5+
### Definition
6+
Returns an array of voltage readings using logarithmic sampling mode from the digitizer obtained through a fetch query.
7+
8+
### Parameters
9+
spike_safe_socket [TcpSocket](/spikesafe_python_lib_docs/TcpSocket/README.md)
10+
Socket object used to communicate with SpikeSafe.
11+
12+
time_sampling_mode : [TimeSamplingMode](/spikesafe_python_lib_docs/DigitizerEnums/TimeSamplingMode/README.md)
13+
The time sampling mode to use for the voltage data. This should be an instance of the TimeSamplingMode enum from DigitizerEnums.
14+
15+
sampling_mode : [SamplingMode](/spikesafe_python_lib_docs/DigitizerEnums/SamplingMode//README.md)
16+
The sampling mode to use for the voltage data. This should be an instance of the SamplingMode enum from DigitizerEnums.
17+
18+
hardware_trigger_delay_microseconds : [int](https://docs.python.org/3/library/functions.html#int) [optional](https://docs.python.org/3/library/typing.html#typing.Optional)
19+
The hardware trigger delay in microseconds (default to 0us)
20+
21+
enable_logging : [bool](https://docs.python.org/3/library/stdtypes.html#boolean-values) [optional](https://docs.python.org/3/library/typing.html#typing.Optional)
22+
Overrides spike_safe_socket.enable_logging attribute (None by default, will use spike_safe_socket.enable_logging value).
23+
24+
### Returns
25+
[DigitizerData array](/spikesafe_python_lib_docs/DigitizerData/README.md)
26+
Contains an array of DigitizerData objects which have a defined voltage_reading, sample_number, and time_since_start_seconds attribute.
27+
28+
### Examples
29+
The following example demonstrates the fetch_voltage_data function. 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.
30+
```
31+
# wait for the Digitizer measurements to complete
32+
wait_for_new_voltage_data(tcp_socket, 0.5)
33+
34+
# fetch the Digitizer voltage readings using VOLT:FETC? query
35+
digitizerData = []
36+
digitizerData = fetch_voltage_data_sampling_mode_logarithmic(
37+
spike_safe_socket=tcp_socket,
38+
time_sampling_mode=TimeSamplingMode.MIDDLE_OF_TIME,
39+
sampling_mode=SamplingMode.FAST_LOG
40+
)
41+
42+
# prepare digitizer voltage data to plot
43+
samples = []
44+
voltage_readings = []
45+
time_since_start_seconds = []
46+
for dd in digitizerData:
47+
samples.append(dd.sample_number)
48+
time_since_start_seconds.append(dd.time_since_start_seconds)
49+
voltage_readings.append(dd.voltage_reading)
50+
```
51+
52+
### Examples In Action
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# [spikesafe-python API Overview](/spikesafe_python_lib_docs/README.md) | [DigitizerEnums](/spikesafe_python_lib_docs/DigitizerEnums/README.md)
2+
3+
## DigitizerEnums
4+
5+
### Definition
6+
A class for Digitizer acceptable values as enumerations
7+
8+
### Classes
9+
| Name | Description |
10+
| - | - |
11+
| [SamplingMode](/spikesafe_python_lib_docs/DigitizerEnums/SamplingMode/README.md) | Enum for time sampling mode for the Digitizer. |
12+
| [TimeSamplingMode](/spikesafe_python_lib_docs/DigitizerEnums/TimeSamplingMode/README.md) | Enum for sampling mode for the Digitizer. |
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# [spikesafe-python API Overview](/spikesafe_python_lib_docs/README.md) | [DigitizerEnums](/spikesafe_python_lib_docs/DigitizerEnums/README.md) | [TimeSamplingMode](/spikesafe_python_lib_docs/DigitizerEnums/TimeSamplingMode/README.md)
2+
3+
## TimeSamplingMode IntEnum
4+
5+
### Definition
6+
Enum for time sampling mode for the Digitizer.
7+
8+
### Enumerations
9+
| Name | value |
10+
| - | - |
11+
| LINEAR | "LINEAR"
12+
| FAST_LOG | "FASTLOG"
13+
| MEDIUM_LOG | "MEDIUMLOG"
14+
| SLOW_LOG | "SLOWLOG"
15+
| CUSTOM | "CUSTOM"
16+
17+
### Examples
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# [spikesafe-python API Overview](/spikesafe_python_lib_docs/README.md) | [DigitizerEnums](/spikesafe_python_lib_docs/DigitizerEnums/README.md) | [TimeSamplingMode](/spikesafe_python_lib_docs/DigitizerEnums/TimeSamplingMode/README.md)
2+
3+
## SamplingMode IntEnum
4+
5+
### Definition
6+
Enum for sampling mode for the Digitizer.
7+
8+
### Enumerations
9+
| Name |
10+
| - |
11+
| MIDDLE_OF_TIME |
12+
| END_OF_TIME |
13+
14+
### Examples

spikesafe_python_lib_docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Instructions to download and setup **spikesafe-python** can be found [here](http
2020
| [Compensation](/spikesafe_python_lib_docs/Compensation/README.md) | A helper class that provides a collection of helper functions you can use to help with SpikeSafe compensation settings.
2121
| [DigitizerData](/spikesafe_python_lib_docs/DigitizerData/README.md) | A class used to store data in a simple accessible object from a digitizer fetch response. |
2222
| [DigitizerDataFetch](/spikesafe_python_lib_docs/DigitizerDataFetch/README.md) | A helper class used to simplify collecting data from a PSMU Digitizer. |
23+
| [DigitizerEnums](/spikesafe_python_lib_docs/DigitizerEnums/README.md) | Defines the Digitizer acceptable values as enumerations. |
2324
| [Discharge](/spikesafe_python_lib_docs/Discharge/README.md) | A helper class that provides a collection of helper functions you can use to properly discharge the SpikeSafe channel. |
2425
| [EventData](/spikesafe_python_lib_docs/EventData/README.md) | A class used to store data in a simple accessible object from a SpikeSafe's event response. |
2526
| [MemoryTableReadData](/spikesafe_python_lib_docs/MemoryTableReadData/README.md) | A class used to store data in a simple accessible object from a SpikeSafe's Memory Table Read response. |

0 commit comments

Comments
 (0)