Skip to content

Commit a5b955d

Browse files
fixes fossasia#72 . removed capture_multiple function since there is no equivalent responder in the firmware
1 parent 4a8eade commit a5b955d

File tree

1 file changed

+0
-87
lines changed

1 file changed

+0
-87
lines changed

PSL/sciencelab.py

Lines changed: 0 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -509,93 +509,6 @@ def capture4(self, ns, tg, TraceOneRemap='CH1'):
509509

510510
return x, y, y2, y3, y4
511511

512-
def capture_multiple(self, samples, tg, *args):
513-
"""
514-
Blocking call that fetches oscilloscope traces from a set of specified channels
515-
516-
.. tabularcolumns:: |p{3cm}|p{11cm}|
517-
518-
============== ============================================================================================
519-
**Arguments**
520-
============== ============================================================================================
521-
samples Number of samples to fetch. Maximum 10000/(total specified channels)
522-
tg Timegap between samples in microseconds.
523-
\*args channel names
524-
============== ============================================================================================
525-
526-
Example
527-
528-
>>> from pylab import *
529-
>>> I=sciencelab.ScienceLab()
530-
>>> x,y1,y2,y3,y4 = I.capture_multiple(800,1.75,'CH1','CH2','MIC','SEN')
531-
>>> plot(x,y1)
532-
>>> plot(x,y2)
533-
>>> plot(x,y3)
534-
>>> plot(x,y4)
535-
>>> show()
536-
537-
:return: Arrays X(timestamps),Y1,Y2 ...
538-
539-
"""
540-
if len(args) == 0:
541-
self.__print__('please specify channels to record')
542-
return
543-
tg = int(tg * 8) / 8. # Round off the timescale to 1/8uS units
544-
if (tg < 1.5): tg = int(1.5 * 8) / 8.
545-
total_chans = len(args)
546-
547-
total_samples = samples * total_chans
548-
if (total_samples > self.MAX_SAMPLES):
549-
self.__print__('Sample limit exceeded. 10,000 total')
550-
total_samples = self.MAX_SAMPLES
551-
samples = self.MAX_SAMPLES / total_chans
552-
553-
CHANNEL_SELECTION = 0
554-
for chan in args:
555-
C = self.analogInputSources[chan].CHOSA
556-
self.__print__(chan, C)
557-
CHANNEL_SELECTION |= (1 << C)
558-
self.__print__('selection', CHANNEL_SELECTION, len(args), hex(CHANNEL_SELECTION | ((total_chans - 1) << 12)))
559-
560-
try:
561-
self.H.__sendByte__(CP.ADC)
562-
self.H.__sendByte__(CP.CAPTURE_MULTIPLE)
563-
self.H.__sendInt__(CHANNEL_SELECTION | ((total_chans - 1) << 12))
564-
565-
self.H.__sendInt__(total_samples) # total number of samples to record
566-
self.H.__sendInt__(int(self.timebase * 8)) # Timegap between samples. 8MHz timer clock
567-
self.H.__get_ack__()
568-
self.__print__('wait')
569-
time.sleep(1e-6 * total_samples * tg + .01)
570-
self.__print__('done')
571-
data = b''
572-
for i in range(int(total_samples / self.data_splitting)):
573-
self.H.__sendByte__(CP.ADC)
574-
self.H.__sendByte__(CP.GET_CAPTURE_CHANNEL)
575-
self.H.__sendByte__(0) # channel number . starts with A0 on PIC
576-
self.H.__sendInt__(self.data_splitting)
577-
self.H.__sendInt__(i * self.data_splitting)
578-
data += self.H.fd.read(int(
579-
self.data_splitting * 2)) # reading int by int sometimes causes a communication error. this works better.
580-
self.H.__get_ack__()
581-
582-
if total_samples % self.data_splitting:
583-
self.H.__sendByte__(CP.ADC)
584-
self.H.__sendByte__(CP.GET_CAPTURE_CHANNEL)
585-
self.H.__sendByte__(0) # channel number starts with A0 on PIC
586-
self.H.__sendInt__(total_samples % self.data_splitting)
587-
self.H.__sendInt__(total_samples - total_samples % self.data_splitting)
588-
data += self.H.fd.read(int(2 * (
589-
total_samples % self.data_splitting))) # reading int by int may cause packets to be dropped. this works better.
590-
self.H.__get_ack__()
591-
592-
for a in range(int(total_samples)): self.buff[a] = CP.ShortInt.unpack(data[a * 2:a * 2 + 2])[0]
593-
# self.achans[channel_number-1].yaxis = self.achans[channel_number-1].fix_value(self.buff[:samples])
594-
yield np.linspace(0, tg * (samples - 1), samples)
595-
for a in range(int(total_chans)):
596-
yield self.buff[a:total_samples][::total_chans]
597-
except Exception as ex:
598-
self.raiseException(ex, "Communication Error , Function : " + inspect.currentframe().f_code.co_name)
599512

600513
def __capture_fullspeed__(self, chan, samples, tg, *args, **kwargs):
601514
tg = int(tg * 8) / 8. # Round off the timescale to 1/8uS units

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy