Skip to content

Commit e80bd41

Browse files
Nanak Bandyopadhyaybessman
authored andcommitted
Change instanced of ID1/2/3/4 -> LA1/2/3/4 and SEN -> RES and AN8 -> VOL and CNTR -> FRQ and W1/2 -> SI1/2
1 parent a713a85 commit e80bd41

File tree

10 files changed

+152
-152
lines changed

10 files changed

+152
-152
lines changed

PSL/Peripherals.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ def capture(self, address, location, sample_length, total_samples, tg, *args):
463463
464464
>>> from pylab import *
465465
>>> I=sciencelab.ScienceLab()
466-
>>> x,y1,y2,y3,y4 = I.capture_multiple(800,1.75,'CH1','CH2','MIC','SEN')
466+
>>> x,y1,y2,y3,y4 = I.capture_multiple(800,1.75,'CH1','CH2','MIC','RES')
467467
>>> plot(x,y1)
468468
>>> plot(x,y2)
469469
>>> plot(x,y3)

PSL/README.md

Lines changed: 59 additions & 59 deletions
Large diffs are not rendered by default.

PSL/achan.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
"CH3",
2424
"MIC",
2525
"CAP",
26-
"SEN",
27-
"AN8",
26+
"RES",
27+
"VOL",
2828
)
2929

3030
INPUT_RANGES = {
@@ -33,8 +33,8 @@
3333
"CH3": (-3.3, 3.3), # external gain control analog input
3434
"MIC": (-3.3, 3.3), # connected to MIC amplifier
3535
"CAP": (0, 3.3),
36-
"SEN": (0, 3.3),
37-
"AN8": (0, 3.3),
36+
"RES": (0, 3.3),
37+
"VOL": (0, 3.3),
3838
}
3939

4040
PIC_ADC_MULTIPLEX = {
@@ -43,9 +43,9 @@
4343
"CH3": 1,
4444
"MIC": 2,
4545
"AN4": 4,
46-
"SEN": 7,
46+
"RES": 7,
4747
"CAP": 5,
48-
"AN8": 8,
48+
"VOL": 8,
4949
}
5050

5151

@@ -54,7 +54,7 @@ class AnalogInput:
5454
5555
Parameters
5656
----------
57-
name : {'CH1', 'CH2', 'CH3', 'MIC', 'CAP', 'SEN', 'AN8'}
57+
name : {'CH1', 'CH2', 'CH3', 'MIC', 'CAP', 'RES', 'VOL'}
5858
Name of the analog channel to model.
5959
device : :class:`Handler`
6060
Serial interface for communicating with the PSLab device.

PSL/commands_proto.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@
113113
GET_STATE = Byte.pack(1)
114114
GET_STATES = Byte.pack(2)
115115

116-
ID1 = Byte.pack(0)
117-
ID2 = Byte.pack(1)
118-
ID3 = Byte.pack(2)
119-
ID4 = Byte.pack(3)
116+
LA1 = Byte.pack(0)
117+
LA2 = Byte.pack(1)
118+
LA3 = Byte.pack(2)
119+
LA4 = Byte.pack(3)
120120
LMETER = Byte.pack(4)
121121

122122
# /*------TIMING FUNCTIONS-----*/

PSL/digital_channel.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import numpy as np
55

6-
DIGITAL_INPUTS = ("ID1", "ID2", "ID3", "ID4", "SEN", "EXT", "CNTR")
6+
DIGITAL_INPUTS = ("LA1", "LA2", "LA3", "LA4", "RES", "EXT", "FRQ")
77

88
MODES = {
99
"sixteen rising": 5,
@@ -20,13 +20,13 @@ class DigitalInput:
2020
2121
Parameters
2222
----------
23-
name : {"ID1", "ID2", "ID3", "ID4", "SEN", "EXT", "CNTR"}
23+
name : {"LA1", "LA2", "LA3", "LA4", "RES", "EXT", "FRQ"}
2424
Name of the digital channel to model.
2525
2626
Attributes
2727
----------
2828
name : str
29-
One of {"ID1", "ID2", "ID3", "ID4", "SEN", "EXT", "CNTR"}.
29+
One of {"LA1", "LA2", "LA3", "LA4", "RES", "EXT", "FRQ"}.
3030
number : int
3131
Number used to refer to this channel in the firmware.
3232
datatype : str

PSL/logic_analyzer.py

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ def __init__(self, device: packet_handler.Handler = None):
5252
self._channels = {
5353
d: digital_channel.DigitalInput(d) for d in digital_channel.DIGITAL_INPUTS
5454
}
55-
self.trigger_channel = "ID1"
56-
self._trigger_channel = self._channels["ID1"]
55+
self.trigger_channel = "LA1"
56+
self._trigger_channel = self._channels["LA1"]
5757
self.trigger_mode = "disabled"
5858
self._trigger_mode = 0
5959
self._prescaler = 0
60-
self._channel_one_map = "ID1"
61-
self._channel_two_map = "ID2"
60+
self._channel_one_map = "LA1"
61+
self._channel_two_map = "LA2"
6262
self._trimmed = 0
6363

6464
def measure_frequency(
@@ -68,7 +68,7 @@ def measure_frequency(
6868
6969
Parameters
7070
----------
71-
channel : {"ID1", "ID2", "ID3", "ID4"}
71+
channel : {"LA1", "LA2", "LA3", "LA4"}
7272
Name of the digital input channel in which to measure the frequency.
7373
simultaneous_oscilloscope: bool, optional
7474
Set this to True if you need to use the oscilloscope at the same time.
@@ -145,7 +145,7 @@ def measure_interval(
145145
Parameters
146146
----------
147147
channels : List[str]
148-
A pair of digital inputs, ID1, ID2, ID3, or ID4. Both can be the same.
148+
A pair of digital inputs, LA1, LA2, LA3, or LA4. Both can be the same.
149149
modes : List[str]
150150
Type of logic event to listen for on each channel. See
151151
:class:`DigitalInput` for available modes.
@@ -209,7 +209,7 @@ def measure_duty_cycle(self, channel: str, timeout: float = 1) -> Tuple[float]:
209209
210210
Parameters
211211
----------
212-
channel : {"ID1", "ID2", "ID3", "ID4"}
212+
channel : {"LA1", "LA2", "LA3", "LA4"}
213213
Digital input on which to measure.
214214
timeout : float, optional
215215
Timeout in seconds before cancelling measurement. The default value is
@@ -251,8 +251,8 @@ def capture(
251251
Parameters
252252
----------
253253
channels : {1, 2, 3, 4}
254-
Number of channels to capture events on. Events will be captured on ID1,
255-
ID2, ID3, and ID4, in that order.
254+
Number of channels to capture events on. Events will be captured on LA1,
255+
LA2, LA3, and LA4, in that order.
256256
events : int, optional
257257
Number of logic events to capture on each channel. The default and maximum
258258
value is 2500.
@@ -302,7 +302,7 @@ def capture(
302302
start_time = time.time()
303303

304304
for e, c in enumerate(
305-
[self._channel_one_map, self._channel_two_map, "ID3", "ID4"][:channels]
305+
[self._channel_one_map, self._channel_two_map, "LA3", "LA4"][:channels]
306306
):
307307
c = self._channels[c]
308308
c.events_in_buffer = events
@@ -396,10 +396,10 @@ def _capture_four(self, e2e_time: float):
396396
self._device.send_byte(CP.START_FOUR_CHAN_LA)
397397
self._device.send_int(CP.MAX_SAMPLES // 4)
398398
self._device.send_int(
399-
self._channels["ID1"]._logic_mode
400-
| (self._channels["ID2"]._logic_mode << 4)
401-
| (self._channels["ID3"]._logic_mode << 8)
402-
| (self._channels["ID4"]._logic_mode << 12)
399+
self._channels["LA1"]._logic_mode
400+
| (self._channels["LA2"]._logic_mode << 4)
401+
| (self._channels["LA3"]._logic_mode << 8)
402+
| (self._channels["LA4"]._logic_mode << 12)
403403
)
404404
self._device.send_byte(self._prescaler)
405405

@@ -408,7 +408,7 @@ def _capture_four(self, e2e_time: float):
408408
self._trigger_channel.number
409409
] | self._trigger_mode
410410
except KeyError:
411-
e = "Triggering is only possible on ID1, ID2, or ID3."
411+
e = "Triggering is only possible on LA1, LA2, or LA3."
412412
raise NotImplementedError(e)
413413

414414
self._device.send_byte(trigger)
@@ -433,7 +433,7 @@ def fetch_data(self) -> List[np.ndarray]:
433433
counter_values = []
434434
channels = list(
435435
OrderedDict.fromkeys(
436-
[self._channel_one_map, self._channel_two_map, "ID3", "ID4"]
436+
[self._channel_one_map, self._channel_two_map, "LA3", "LA4"]
437437
)
438438
)
439439
for c in channels:
@@ -530,7 +530,7 @@ def get_initial_states(self) -> Dict[str, bool]:
530530
-------
531531
dict of four str: bool pairs
532532
Dictionary containing pairs of channel names and the corresponding initial
533-
state, e.g. {'ID1': True, 'ID2': True, 'ID3': True, 'ID4': False}.
533+
state, e.g. {'LA1': True, 'LA2': True, 'LA3': True, 'LA4': False}.
534534
True means HIGH, False means LOW.
535535
"""
536536
return self._get_initial_states_and_progress()[0]
@@ -552,7 +552,7 @@ def get_xy(self, timestamps: List[np.ndarray]) -> List[np.ndarray]:
552552
xy = []
553553

554554
for e, c in enumerate(
555-
[self._channel_one_map, self._channel_two_map, "ID3", "ID4"][
555+
[self._channel_one_map, self._channel_two_map, "LA3", "LA4"][
556556
: len(timestamps)
557557
]
558558
):
@@ -575,10 +575,10 @@ def _get_initial_states_and_progress(self) -> Tuple[Dict[str, bool], List[int]]:
575575
progress[3] = (self._device.get_int() - initial) // 2 - 3 * CP.MAX_SAMPLES // 4
576576
s = self._device.get_byte()
577577
initial_states = {
578-
"ID1": (s & 1 != 0),
579-
"ID2": (s & 2 != 0),
580-
"ID3": (s & 4 != 0),
581-
"ID4": (s & 8 != 0),
578+
"LA1": (s & 1 != 0),
579+
"LA2": (s & 2 != 0),
580+
"LA3": (s & 4 != 0),
581+
"LA4": (s & 8 != 0),
582582
}
583583
self._device.get_byte() # INITIAL_DIGITAL_STATES_ERR
584584
self._device.get_ack()
@@ -596,7 +596,7 @@ def configure_trigger(self, trigger_channel: str, trigger_mode: str):
596596
597597
Parameters
598598
----------
599-
trigger_channel : {"ID1", "ID2", "ID3", "ID4"}
599+
trigger_channel : {"LA1", "LA2", "LA3", "LA4"}
600600
The digital input on which to trigger.
601601
trigger_condition : {"disabled", "falling", "rising"}
602602
The type of logic level change on which to trigger.
@@ -640,18 +640,18 @@ def get_states(self) -> Dict[str, bool]:
640640
-------
641641
dict of four str: bool pairs
642642
Dictionary containing pairs of channel names and the corresponding current
643-
state, e.g. {'ID1': True, 'ID2': True, 'ID3': True, 'ID4': False}.
643+
state, e.g. {'LA1': True, 'LA2': True, 'LA3': True, 'LA4': False}.
644644
True means HIGH, False means LOW.
645645
"""
646646
self._device.send_byte(CP.DIN)
647647
self._device.send_byte(CP.GET_STATES)
648648
s = self._device.get_byte()
649649
self._device.get_ack()
650650
return {
651-
"ID1": (s & 1 != 0),
652-
"ID2": (s & 2 != 0),
653-
"ID3": (s & 4 != 0),
654-
"ID4": (s & 8 != 0),
651+
"LA1": (s & 1 != 0),
652+
"LA2": (s & 2 != 0),
653+
"LA3": (s & 4 != 0),
654+
"LA4": (s & 8 != 0),
655655
}
656656

657657
def count_pulses(
@@ -664,7 +664,7 @@ def count_pulses(
664664
665665
Parameters
666666
----------
667-
channel : {"ID1", "ID2", "ID3", "ID4"}
667+
channel : {"LA1", "LA2", "LA3", "LA4"}
668668
Digital input on which to count pulses.
669669
interval : float, optional
670670
Time in seconds during which to count pulses. The default value is

PSL/oscilloscope.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def capture(self, channels: int, samples: int, timegap: float,) -> np.ndarray:
5555
channels : {1, 2, 4}
5656
Number of channels to sample from simultaneously. By default, samples are
5757
captured from CH1, CH2, CH3 and MIC. CH1 can be remapped to any other
58-
channel (CH2, CH3, MIC, CAP, SEN, AN8) by setting the channel_one_map
58+
channel (CH2, CH3, MIC, CAP, RES, VOL) by setting the channel_one_map
5959
attribute of the Oscilloscope instance to the desired channel.
6060
samples : int
6161
Number of samples to fetch. Maximum 10000 divided by number of channels.
@@ -93,7 +93,7 @@ def capture(self, channels: int, samples: int, timegap: float,) -> np.ndarray:
9393
ValueError
9494
If :channels: is not 1, 2 or 4, or
9595
:samples: > 10000 / :channels:, or
96-
:channel_one_map: is not one of CH1, CH2, CH3, MIC, CAP, SEN, AN8, or
96+
:channel_one_map: is not one of CH1, CH2, CH3, MIC, CAP, RES, VOL, or
9797
:timegap: is too low.
9898
"""
9999
xy = np.zeros([channels + 1, samples])
@@ -227,7 +227,7 @@ def fetch_data(self, channel: str) -> np.ndarray:
227227
228228
Parameters
229229
----------
230-
channel : {'CH1', 'CH2', 'CH3', 'MIC', 'CAP', 'SEN', 'AN8'}
230+
channel : {'CH1', 'CH2', 'CH3', 'MIC', 'CAP', 'RES', 'VOL'}
231231
Name of the channel from which to fetch captured data.
232232
233233
Example
@@ -290,7 +290,7 @@ def configure_trigger(self, channel: str, voltage: float, prescaler: int = 0):
290290
291291
Parameters
292292
----------
293-
channel : {'CH1', 'CH2', 'CH3', 'MIC', 'CAP', 'SEN', 'AN8'}
293+
channel : {'CH1', 'CH2', 'CH3', 'MIC', 'CAP', 'RES', 'VOL'}
294294
The name of the trigger channel.
295295
voltage : float
296296
The trigger voltage in volts.

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