# HG changeset patch # User Alexis Jeandet # Date 2024-02-09 11:27:17 # Node ID 5e5e847ef40dbd9e1c8ec96cae47d7590cb9da8c # Parent 49dd84cc2a7719b11400bce66a96c464a853da83 last commit after R3.3 delivery in 2023 diff --git a/.hgignore b/.hgignore old mode 100644 new mode 100755 diff --git a/lppinstru/__init__.py b/lppinstru/__init__.py old mode 100644 new mode 100755 diff --git a/lppinstru/agilent3441xA.py b/lppinstru/agilent3441xA.py old mode 100644 new mode 100755 diff --git a/lppinstru/agilenttmc.py b/lppinstru/agilenttmc.py old mode 100644 new mode 100755 diff --git a/lppinstru/discovery.py b/lppinstru/discovery.py old mode 100644 new mode 100755 --- a/lppinstru/discovery.py +++ b/lppinstru/discovery.py @@ -21,7 +21,26 @@ import numpy as np nodev = c_int(0) -DwfStateDone = c_int(2) + +DwfStateReady = c_byte(0) +DwfStateConfig = c_byte(4) +DwfStatePrefill = c_byte(5) +DwfStateArmed = c_byte(1) +DwfStateWait = c_byte(7) +DwfStateTriggered = c_byte(3) +DwfStateRunning = c_byte(3) +DwfStateDone = c_byte(2) + +DwfStateDict={ + DwfStateReady.value:"Ready", + DwfStateConfig.value:"Config", + DwfStatePrefill.value:"Prefill", + DwfStateArmed.value:"Armed", + DwfStateWait.value:"Wait", + DwfStateTriggered.value:"Triggered", + DwfStateRunning.value:"Running", + DwfStateDone.value:"Done" + } DECIAnalogInChannelCount = c_int(1) DECIAnalogOutChannelCount = c_int(2) @@ -308,10 +327,11 @@ class Discovery(object): ############################################################# # AnalogOut ############################################################# - def analog_out_gen(self,frequency=1000, shape='Sine', channel=0, amplitude=1.0, offset=0.0,phase=0.0, syncOnTrigger=False, triggerFrq=1.0): + def analog_out_gen(self,frequency=1000, symmetry=50.0, shape='Sine', channel=0, amplitude=1.0, offset=0.0,phase=0.0, syncOnTrigger=False, triggerFrq=1.0, wait=0.0, runDuration=None): self.__libdwf.FDwfAnalogOutConfigure(self.__hdwf, c_int(channel), c_bool(False)) self.__libdwf.FDwfAnalogOutNodeEnableSet(self.__hdwf, c_int(channel), AnalogOutNodeCarrier, c_bool(True)) self.__libdwf.FDwfAnalogOutNodeFunctionSet(self.__hdwf, c_int(channel), AnalogOutNodeCarrier, c_int(shapes.get(shape))) + self.__libdwf.FDwfAnalogOutNodeSymmetrySet(self.__hdwf, c_int(channel), AnalogOutNodeCarrier, c_double(symmetry)) if shape!="DC": self.__libdwf.FDwfAnalogOutNodeFrequencySet(self.__hdwf, c_int(channel), AnalogOutNodeCarrier, c_double(self.__limits.genFreq(frequency))) self.__libdwf.FDwfAnalogOutNodeAmplitudeSet(self.__hdwf, c_int(channel), AnalogOutNodeCarrier, c_double(self.__limits.genAmplitude(amplitude))) @@ -320,12 +340,10 @@ class Discovery(object): if syncOnTrigger: self.analog_out_set_trigger(channel) self.__libdwf.FDwfAnalogOutRepeatSet(self.__hdwf, c_int(channel),c_int(0)) -# if frequency >= triggerFrq: - runDuration = triggerFrq -# Doesn't work! try with triggerFrq=1 and frequency=0.8 -# else: -# runDuration = triggerFrq/frequency + if runDuration is None: + runDuration = triggerFrq self.__libdwf.FDwfAnalogOutRunSet(self.__hdwf, c_int(channel),c_double(runDuration)) + self.__libdwf.FDwfAnalogOutWaitSet(self.__hdwf, c_int(channel), c_double(wait)) self.__libdwf.FDwfAnalogOutConfigure(self.__hdwf, c_int(channel), c_bool(True)) def analog_out_gen_arbit(self,samplesBuffer ,repeatingFrequency=100, channel=0, amplitude=1.0, offset=0.0): @@ -346,6 +364,45 @@ class Discovery(object): self.__libdwf.FDwfAnalogOutTriggerSourceSet(self.__hdwf, c_int(channel), trigSrc) self.__libdwf.FDwfAnalogOutRepeatTriggerSet(self.__hdwf, c_int(channel), c_bool(trigRepeat)) + + def analog_out_status(self, channel=0): + status = c_byte(DwfStateDone.value) + self.__libdwf.FDwfAnalogOutStatus(self.__hdwf, c_int(channel), byref(status)) + return status +# def analog_out_modulation(self, channel=0, +# carrier_frequency=10, carrier_shape='Sine', carrier_amplitude=1.0, carrier_offset=0.0, carrier_phase=0.0, carrier_symmetry=0.5, +# AM_frequency=0.2857, AM_shape='Square', AM_amplitude=100.0, AM_offset=0.0, AM_phase=0.0, AM_percentageSymmetry=0.2857, +# syncOnTrigger=trigsrcExternal1, triggerFrq=1.0, wait=0.0, runDuration=None): +# self.__libdwf.FDwfAnalogOutConfigure(self.__hdwf, c_int(channel), c_bool(False)) +# self.__libdwf.FDwfAnalogOutNodeEnableSet(self.__hdwf, c_int(channel), AnalogOutNodeCarrier, c_bool(True)) +# +# self.__libdwf.FDwfAnalogOutNodeFunctionSet(self.__hdwf, c_int(channel), AnalogOutNodeCarrier, c_int(shapes.get(carrier_shape))) +# self.__libdwf.FDwfAnalogOutNodeFrequencySet(self.__hdwf, c_int(channel), AnalogOutNodeCarrier, c_double(self.__limits.genFreq(carrier_frequency))) +# self.__libdwf.FDwfAnalogOutNodeAmplitudeSet(self.__hdwf, c_int(channel), AnalogOutNodeCarrier, c_double(self.__limits.genAmplitude(carrier_amplitude))) +# self.__libdwf.FDwfAnalogOutNodeOffsetSet(self.__hdwf, c_int(channel), AnalogOutNodeCarrier, c_double(self.__limits.genOffset(carrier_offset))) +# self.__libdwf.FDwfAnalogOutNodePhaseSet(self.__hdwf, c_int(channel), AnalogOutNodeCarrier, c_double(carrier_phase)) +# self.__libdwf.FDwfAnalogOutNodeSymmetrySet(self.__hdwf, c_int(channel), AnalogOutNodeCarrier, c_double(carrier_percentageSymmetry)) +# +# self.__libdwf.FDwfAnalogOutNodeEnableSet(self.__hdwf, c_int(channel), AnalogOutNodeAM, c_bool(True)) +# self.__libdwf.FDwfAnalogOutNodeFunctionSet(self.__hdwf, c_int(channel), AnalogOutNodeAM, c_int(shapes.get(AM_shape))) +# self.__libdwf.FDwfAnalogOutNodeFrequencySet(self.__hdwf, c_int(channel), AnalogOutNodeAM, c_double(self.__limits.genFreqAM_frequency))) +# self.__libdwf.FDwfAnalogOutNodeAmplitudeSet(self.__hdwf, c_int(channel), AnalogOutNodeAM, c_double(self.__limits.genAmplitude(AM_amplitude))) +# self.__libdwf.FDwfAnalogOutNodeOffsetSet(self.__hdwf, c_int(channel), AnalogOutNodeAM, c_double(self.__limits.genOffset(AM_offset))) +# self.__libdwf.FDwfAnalogOutNodePhaseSet(self.__hdwf, c_int(channel), AnalogOutNodeAM, c_double(AM_phase)) +# self.__libdwf.FDwfAnalogOutNodeSymmetrySet(self.__hdwf, c_int(channel), AnalogOutNodeAM, c_double(AM_percentageSymmetry)) +# +# if syncOnTrigger: +# self.analog_out_set_trigger(channel) +# self.__libdwf.FDwfAnalogOutRepeatSet(self.__hdwf, c_int(channel),c_int(0)) +# if runDuration is None: +# runDuration = triggerFrq +# self.__libdwf.FDwfAnalogOutRunSet(self.__hdwf, c_int(channel),c_double(runDuration)) +# self.__libdwf.FDwfAnalogOutWaitSet(self.__hdwf, c_int(channel), c_double(wait)) +# self.__libdwf.FDwfAnalogOutConfigure(self.__hdwf, c_int(channel), c_bool(True)) + + + + def __del__(self): if self.__opened: self.__libdwf.FDwfDeviceClose(self.__hdwf) diff --git a/lppinstru/dlp_temp.py b/lppinstru/dlp_temp.py old mode 100644 new mode 100755 diff --git a/lppinstru/gpd_xxx.py b/lppinstru/gpd_xxx.py old mode 100644 new mode 100755 diff --git a/lppinstru/prologix_usb_gpib.py b/lppinstru/prologix_usb_gpib.py old mode 100644 new mode 100755 diff --git a/lppinstru/transfertFunction.py b/lppinstru/transfertFunction.py old mode 100644 new mode 100755 diff --git a/lppinstru/usbtmc.py b/lppinstru/usbtmc.py old mode 100644 new mode 100755 diff --git a/python-lppinstru.spec b/python-lppinstru.spec old mode 100644 new mode 100755 diff --git a/setup.py b/setup.py old mode 100644 new mode 100755