-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #148 from charithjperera/charithjperera/ps4000a_bl…
…ock_mode Charithjperera/ps4000a block mode
- Loading branch information
Showing
4 changed files
with
172 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from picoscope import ps4000a | ||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
import time | ||
|
||
ps = ps4000a.PS4000a() | ||
|
||
# rapid block mode | ||
|
||
ps.setChannel(channel="A", coupling="DC", VRange=1) | ||
ps.setChannel(channel="B", enabled=False) | ||
ps.setChannel(channel="C", enabled=False) | ||
ps.setChannel(channel="D", enabled=False) | ||
|
||
n_captures = 100 | ||
sample_interval = 100e-9 # 100 ns | ||
sample_duration = 2e-3 # 1 ms | ||
ps.setResolution('12') # Resolution can only be set on the PS4444 | ||
ps.setSamplingInterval(sample_interval, sample_duration) | ||
ps.setSimpleTrigger("A", threshold_V=0.1, timeout_ms=1) | ||
|
||
samples_per_segment = ps.memorySegments(n_captures) | ||
ps.setNoOfCaptures(n_captures) | ||
|
||
data = np.zeros((n_captures, samples_per_segment), dtype=np.int16) | ||
|
||
t1 = time.time() | ||
|
||
ps.runBlock() | ||
ps.waitReady() | ||
|
||
t2 = time.time() | ||
print("Time to record data to scope: ", str(t2 - t1)) | ||
|
||
ps.getDataRawBulk(data=data) | ||
|
||
t3 = time.time() | ||
print("Time to copy to RAM: ", str(t3 - t2)) | ||
|
||
plt.imshow(data[:, 0:ps.noSamples], aspect='auto', interpolation='none', | ||
cmap=plt.cm.hot) | ||
plt.colorbar() | ||
plt.show() | ||
|
||
ps.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters