-
Notifications
You must be signed in to change notification settings - Fork 2
Description
@ksunden
0001-Updates-needed-for-new-pygage3_64.patch
Gage gave us a "new" version of the pygage library back in October.
Unlike past versions that they have given us, this at least imports on python 3.9.
However some of the config keys have changed... some in relatively innocuous capitalization changes, some in combining of keys
, some keys are just missing... (DiffInput and DirectADC for channels)
Perhaps these features are not important to us and can rightly just be removed, perhaps we need to request a 'what gives?' from gage.
Additionally configuration we had loaded which worked with the py37 version of pygage3 failed to work giving CS_INVALID_GAIN error message. Perhaps this is 'real' and we should be using other gains (it appeared to be complaining about the trigger, I believe, but not completely sure)
In any case, I have the changes to the code I did to make it at least run in the attached .patch (with a copy below for quicker reference, similar changes are included in the patch for the compuscope version of the daemon)
--- a/yaqd_gage/_chopping.py
+++ b/yaqd_gage/_chopping.py
@@ -12,6 +12,7 @@ from yaqd_core import HasMeasureTrigger, IsSensor, IsDaemon
from ._constants import acq_status_codes, transfer_modes
from ._pygage import PyGage
+from pprint import pprint
impedences = {"fifty": 50, "onemeg": 1_000_000}
@@ -30,11 +31,19 @@ class CompuScope(HasMeasureTrigger, IsSensor, IsDaemon):
config["SegmentSize"] = self._config["segment_size"]
config["TriggerDelay"] = self._config["trigger_delay"]
config["SegmentCount"] = self._state["segment_count"]
- config["TriggerTimeOut"] = self._config["trigger_time_out"]
- config["TriggerHoldOff"] = self._config["trigger_hold_off"]
- config["ExtClk"] = int(self._config["ext_clk"])
- config["TimeStampMode"] = self._config["time_stamp_mode"]
- config["TimeStampClock"] = self._config["time_stamp_clock"]
+ config["TriggerTimeout"] = self._config["trigger_time_out"]
+ config["TriggerHoldoff"] = self._config["trigger_hold_off"]
+ config["ExternalClock"] = int(self._config["ext_clk"])
+
+ timestamp_config = 0x00
+ if self._config["time_stamp_clock"] == "fixed":
+ timestamp_config |= 0x1
+ if self._config["time_stamp_mode"] == "free":
+ timestamp_config |= 0x10
+ config["TimeStampConfig"] = timestamp_config
+ pprint("Acquisition")
+ pprint(config)
+
self._pg.set_acquisition_config(config)
self._pg.set_multiple_rec_average_count(self._state["record_count"])
# channel config
@@ -44,10 +53,12 @@ class CompuScope(HasMeasureTrigger, IsSensor, IsDaemon):
couplings = {"DC": 1, "AC": 2}
config["Coupling"] = couplings[channel["coupling"]]
config["Impedance"] = impedences[channel["impedance"]]
- config["DiffInput"] = int(channel["diff_input"])
- config["DirectADC"] = int(channel["direct_adc"])
+ #config["DiffInput"] = int(channel["diff_input"])
+ #config["DirectADC"] = int(channel["direct_adc"])
config["Filter"] = int(channel["filter"])
config["DcOffset"] = channel["dc_offset"]
+ pprint("Channel")
+ pprint(config)
self._pg.set_channel_config(channel_index + 1, config)
# trigger config
for trigger_index, trigger in enumerate(self._config["triggers"]):
@@ -55,9 +66,11 @@ class CompuScope(HasMeasureTrigger, IsSensor, IsDaemon):
config["Condition"] = trigger["condition"]
config["Level"] = trigger["level"]
config["Source"] = trigger["source"]
- config["InputRange"] = trigger["range"]
- config["Impedance"] = impedences[channel["impedance"]]
+ config["ExtRange"] = trigger["range"]
+ config["ExtImpedance"] = impedences[channel["impedance"]]
config["Relation"] = 0
+ pprint("Trigger")
+ pprint(config)
self._pg.set_trigger_config(trigger_index + 1, config)
# finish
self._pg.commit()