Skip to content

Commit

Permalink
Tests: Add DAQZerosDAC
Browse files Browse the repository at this point in the history
This verifies that we call HW_StopAcq with zeroDAC = 1.

Close #1965
  • Loading branch information
t-b committed Feb 6, 2024
1 parent f6280b1 commit b047c30
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions Packages/tests/HardwareBasic/UTF_BasicHardwareTests.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,50 @@ static Function ChangeStimSetDuringDAQ_REENTRY([str])
CheckDAQStopReason(str, DQ_STOP_REASON_FINISHED, sweepNo = 2)
End

// UTF_TD_GENERATOR DeviceNameGeneratorMD1
static Function DAQZerosDAC([string str])
STRUCT DAQSettings s
InitDAQSettingsFromString(s, "MD1_RA0_I0_L0_BKG1" + \
"__HS0_DA0_AD0_CM:IC:_ST:StimulusSetA_DA_0:")

AcquireData_NG(s, str)
End

static Function DAQZerosDAC_REENTRY([string str])

variable deviceID, hardwareType, sweepNo, DAC

CHECK_EQUAL_VAR(ROVar(GetDataAcqRunMode(str)), DAQ_NOT_RUNNING)
CHECK_EQUAL_VAR(ROVar(GetTestpulseRunMode(str)), TEST_PULSE_NOT_RUNNING)

sweepNo = AFH_GetLastSweepAcquired(str)
CHECK_EQUAL_VAR(sweepNo, 0)

WAVE numericalValues = GetLBNumericalValues(str)

WAVE/Z DACs = GetLastSetting(numericalValues, sweepNo, "DAC", DATA_ACQUISITION_MODE)
CHECK_WAVE(DACs, NUMERIC_WAVE)
WAVE/Z indizes = FindIndizes(DACs, prop = PROP_NON_EMPTY)
CHECK_WAVE(indizes, NUMERIC_WAVE)
CHECK_EQUAL_VAR(DimSize(indizes, ROWS), 1)

DAC = DACs[indizes[0]]
CHECK_GE_VAR(DAC, 0)

DFREF dataDFR = GetDeviceDataPath(str)
DFREF sweepDFR = GetSingleSweepFolder(dataDFR, sweepNo)

// we end the DAC data with high
WAVE/Z DACWave = GetDAQDataSingleColumnWave(sweepDFR, XOP_CHANNEL_TYPE_DAC, DAC)
CHECK_GE_VAR(DACWave[inf], 0.9)

deviceID = ROVar(GetDAQDeviceID(str))
hardwareType = GetHardwareType(str)

// but due to zeroDAC being on we end with around zero
CHECK_LE_VAR(HW_ReadADC(hardwareType, deviceID, DAC), 0.01)
End

// Using unassociated channels works
// UTF_TD_GENERATOR DeviceNameGeneratorMD1
static Function UnassociatedChannelsAndTTLs([str])
Expand Down

0 comments on commit b047c30

Please sign in to comment.