-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DS1054 patch contributed by Marcus and a complete version by Kerr added
- Loading branch information
Showing
3 changed files
with
1,422 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
--- PyDSA.py 2015-09-20 08:04:00.000000000 +0200 | ||
+++ PyDSA_mod.py 2015-09-27 23:56:32.352446000 +0200 | ||
@@ -563,7 +563,7 @@ | ||
showerror("VISA Error","Cannot open scope") | ||
|
||
# get metadata | ||
- #sample_rate = float(scope.ask(':ACQ:SAMP?')) | ||
+ #sample_rate = float(scope.ask(':ACQ:SRAT?')) | ||
#timescale = float(scope.ask(":TIM:SCAL?")) | ||
#timeoffset = float(scope.ask(":TIM:OFFS?")) | ||
#voltscale = float(scope.ask(':CHAN1:SCAL?')) | ||
@@ -577,24 +577,26 @@ | ||
# Grab the raw data from channel 1 | ||
#try: | ||
# Set the scope the way we want it | ||
- if SAMPLEdepth == 0: | ||
- scope.write(':ACQ:MEMD NORM') # Long memory type | ||
- else: | ||
- scope.write(':ACQ:MEMD LONG') # normal memory type | ||
#scope.write(':CHAN1:COUP DC') # DC coupling | ||
#scope.write(':CHAN1:DISP ON') # Channel 1 on | ||
- #scope.write(':CHAN2:DISP ON') # Channel 2 off | ||
+ #scope.write(':CHAN2:DISP OFF') # Channel 2 off | ||
+ #scope.write(':CHAN3:DISP OFF') # Channel 3 off | ||
+ #scope.write(':CHAN4:DISP OFF') # Channel 4 off | ||
+ #scope.write(':ACQ:MDEP AUTO') # Long memory type | ||
+ #scope.write(':ACQ:MDEP 24000000') # Long memory type | ||
#scope.write(':CHAN1:SCAL 1') # Channel 1 vertical scale 1 volts | ||
#scope.write(':CHAN1:OFFS -2') # Channel 1 vertical offset 2 volts | ||
#scope.write(':TIM:SCAL 0.001') # time interval | ||
- #scope.write(':TIM:OFFS .05') # Offset time 50 ms | ||
+ #scope.write(':TIM:OFFS 0.05') # Offset time 50 ms | ||
|
||
#scope.write(':TRIG:EDGE:SOUR CHAN1') # Edge-trigger from channel 1 | ||
#scope.write(':TRIG:EDGE:SWE SING') # Single trigger | ||
#scope.write(':TRIG:EDGE:COUP AC') # trigger coupling | ||
#scope.write(':TRIG:EDGE:SLOP NEG') # Trigger on negative edge | ||
#scope.write(':TRIG:EDGE:LEV 0.01') # Trigger volts | ||
- scope.write(":RUN") | ||
+ scope.write(":TRIG:SWE SING") | ||
+ #scope.write(":RUN") | ||
+ scope.write(":SINGLE") | ||
|
||
#txt = "Trig" | ||
#x = X0L + 250 | ||
@@ -602,14 +604,17 @@ | ||
#IDtxt = ca.create_text (x, y, text=txt, anchor=W, fill=COLORyellow) | ||
#root.update() # update screen | ||
|
||
- while scope.ask(':TRIG:STAT?') != 'STOP': | ||
- sleep(0.1) | ||
+ scope.ask(':TRIG:STAT?') | ||
+ sleep(0.1) | ||
#sleep(0.1) | ||
# Grab the raw data from channel 1, which will take a few seconds for long buffer mode | ||
|
||
scope.write(":STOP") | ||
- scope.write(":WAV:POIN:MODE RAW") | ||
- | ||
+ scope.write(":WAV:SOUR CHAN1") | ||
+ scope.write(":WAV:MODE RAW") | ||
+ scope.write(":WAV:FORM ASC") | ||
+ scope.write(":WAV:START 1") | ||
+ scope.write(":WAV:STOP 131072") | ||
txt = "->Acquire" | ||
x = X0L + 275 | ||
y = Y0T+GRH+32 | ||
@@ -617,23 +622,26 @@ | ||
root.update() # update screen | ||
|
||
|
||
- signals= scope.ask(":WAV:DATA? CHAN1") #do this first | ||
+ signals= scope.ask(":WAV:DATA? CHAN1") #do this first | ||
+ signals = signals[11:] | ||
data_size = len(signals) | ||
- | ||
- SAMPLErate = scope.ask_for_values(':ACQ:SAMP?')[0] #do this second | ||
+ #print data_size | ||
+ #print signals | ||
+ SAMPLErate = scope.ask_for_values(':ACQ:SRAT?')[0] #do this second | ||
#print 'Data size:', SAMPLEsize, "Sample rate:", SAMPLErate | ||
|
||
|
||
|
||
- sleep(0.1) | ||
+ #sleep(0.1) | ||
|
||
# convert data from (inverted) bytes to an array of scaled floats | ||
# this magic from Matthew Mets | ||
- SIGNAL1 = numpy.frombuffer(signals, 'B') | ||
+ SIGNAL1 = numpy.fromstring(signals, sep=',') | ||
#print SIGNAL1 | ||
- SIGNAL1 = (SIGNAL1 * -1 + 255) -130 # invert | ||
+ #print len(SIGNAL1) | ||
+ #SIGNAL1 = (SIGNAL1 * -1 + 255) -130 # invert | ||
#print SIGNAL1 | ||
- SIGNAL1 = SIGNAL1/127.0 # scale 10 +-1, has a slight DC offset | ||
+ #SIGNAL1 = SIGNAL1/127.0 # scale 10 +-1, has a slight DC offset | ||
#print SIGNAL1 | ||
|
||
UpdateAll() # Update Data, trace and screen |
Oops, something went wrong.