diff --git a/Testing/DSTestPulseBuilder.m b/Testing/DSTestPulseBuilder.m index d94a049..877a9dc 100644 --- a/Testing/DSTestPulseBuilder.m +++ b/Testing/DSTestPulseBuilder.m @@ -1,4 +1,12 @@ classdef DSTestPulseBuilder < TestPulseBuilder + % DSTestPulseBuilder Provides a pulse group for tests of the + % downsampling operation. + % + % Each call to addPulse constructs a new pulse that holds a voltage + % level between mask.begin and mask.end and holds the negative value of + % this voltage for the rest of the pulse. The expected data for each + % pulse is that voltage level. Each call to addPulse adds a value to + % the expected data. properties (Constant, GetAccess = public) meanErrorThreshold = 1e-4; diff --git a/Testing/IOTestDriver.m b/Testing/IOTestDriver.m index bbd0ceb..2ce118d 100644 --- a/Testing/IOTestDriver.m +++ b/Testing/IOTestDriver.m @@ -1,4 +1,12 @@ classdef IOTestDriver + % IOTestDriver A driver for a single hardware IO test configured by a + % TestConfigurationProvider (and thus a TestPulseBuilder) instance. + % + % IOTestDriver sets up a VAWG object and initializes a DAC instance + % using the given TestConfigurationProvider object. It then obtains the + % test pulse group from the TestConfigurationProvider instance, + % executes the test and compares mean and single errors to the + % thresholds given. properties (SetAccess = private, GetAccess = private) vawg; diff --git a/Testing/PeriodicMaskTestConfigurationProvider.m b/Testing/PeriodicMaskTestConfigurationProvider.m index 65bbc52..7f84e47 100644 --- a/Testing/PeriodicMaskTestConfigurationProvider.m +++ b/Testing/PeriodicMaskTestConfigurationProvider.m @@ -1,4 +1,13 @@ classdef PeriodicMaskTestConfigurationProvider < TestConfigurationProvider + % PeriodicMaskTestConfigurationProvider Provides a test configuration for + % a periodic mask. + % + % The default mask has a period of 1000 and a readout window from 400 + % to 600. It can be replaced by any other periodic mask in the + % constructor (optional). + % The test pulse group is constructed by creating a given number of + % pulses with the same mask. This number of iterations defaults to 100 + % but can be changed via the class constructor (optional). properties (GetAccess = protected) mask = struct( ... diff --git a/Testing/RSATestPulseBuilder.m b/Testing/RSATestPulseBuilder.m index 7060b77..4a3c690 100644 --- a/Testing/RSATestPulseBuilder.m +++ b/Testing/RSATestPulseBuilder.m @@ -1,4 +1,15 @@ classdef RSATestPulseBuilder < TestPulseBuilder + % RSATestPulseBuilder Provides a pulse group for tests of the + % repetitive signal averaging operation. + % + % Each call to addPulse constructs a new pulse that has a random + % pattern of voltage levels between mask.begin and mask.end and holds + % the negative of the first and the last of these values repectively + % before and after this time window. This random pattern is the same + % for all constructed pulses although the time window may vary (it must + % be of the same length for all calls). + % The expected data is this voltage pattern which is constructed in + % the first call to addPulse and not altered in subsequent calls. properties (Constant, GetAccess = public) meanErrorThreshold = 1e-4; diff --git a/Testing/RandomTestPulseBuilder.m b/Testing/RandomTestPulseBuilder.m index 57647d0..d6681e9 100644 --- a/Testing/RandomTestPulseBuilder.m +++ b/Testing/RandomTestPulseBuilder.m @@ -1,4 +1,10 @@ classdef RandomTestPulseBuilder < TestPulseBuilder + % RandomTestPulseBuilder Provides a pulse group for tests of the + % raw hardware IO functionality. + % + % Calls to addPulse create a pulse with a random pattern of voltage + % values disregarding mask.begin and mask.end. The expected data is + % exactly this pattern of values. properties (Constant, GetAccess = public) meanErrorThreshold = 1e-3; diff --git a/Testing/RawIOTestConfigurationProvider.m b/Testing/RawIOTestConfigurationProvider.m index f9992b0..e9be7c8 100644 --- a/Testing/RawIOTestConfigurationProvider.m +++ b/Testing/RawIOTestConfigurationProvider.m @@ -1,4 +1,10 @@ classdef RawIOTestConfigurationProvider < TestConfigurationProvider + % RawIOTestConfigurationProvider Provides a mask for raw IO input + % testing. + % + % The default mask has a period of 10000 and an equally long readout + % window. It can be changed via the constructor (optional). + properties (GetAccess = protected) mask = struct( ... @@ -6,7 +12,7 @@ 'end', 10000, ... 'period', 10000 ... ); - iterations = 1; + iterations = 1; end methods (Access = protected) diff --git a/Testing/TableMaskTestConfigurationProvider.m b/Testing/TableMaskTestConfigurationProvider.m index dc77589..47f25ff 100644 --- a/Testing/TableMaskTestConfigurationProvider.m +++ b/Testing/TableMaskTestConfigurationProvider.m @@ -1,4 +1,12 @@ classdef TableMaskTestConfigurationProvider < TestConfigurationProvider + % TableMaskTestConfigurationProvider Provides a test configuration for + % a table mask. + % + % The default mask has a period of 1000 and 100 readout windows: + % [400,600], [402, 602], .... [600, 800]. The default mask can be + % replaced by any other table mask in the constructor (optional). + % The constructed test pulse group is contains the according amount of + % pulses in sequence. properties (GetAccess = protected) mask = struct( ... diff --git a/Testing/TestConfigurationProvider.m b/Testing/TestConfigurationProvider.m index 905289f..f4f1bc3 100644 --- a/Testing/TestConfigurationProvider.m +++ b/Testing/TestConfigurationProvider.m @@ -1,9 +1,16 @@ classdef TestConfigurationProvider < handle + % TestConfigurationProvider An abstract base for classes that provide + % a readout mask for hardware IO Tests and construct a pulse group + % using a TestPulseBuilder instance accordingly. + % + % Subclasses need to implement the following properties/methods: + % - mask + % - computePulseGroup properties (SetAccess = private, GetAccess = public) inputChannel = 1; - meanErrorThreshold; - singleErrorThreshold; + meanErrorThreshold; % Value copied from pulseBuilder object in constructor + singleErrorThreshold; % Value copied from pulseBuilder object in constructor end properties (SetAccess = private, GetAccess = protected) @@ -11,10 +18,13 @@ end properties (Abstract, GetAccess = protected) + % The readout mask used in the DAC (periodic or table mask). mask; end methods (Abstract, Access = protected) + % Constructs the pulse group. Must not use plsdefgrp(..). Called by + % createPulseGroup(). computePulseGroup(self); end @@ -30,20 +40,29 @@ self.singleErrorThreshold = self.pulseBuilder.singleErrorThreshold; end + % Create the pulse group using the provider TestPulseBuilder + % instance with the internally implemented pulse group construction + % algorithm. function createPulseGroup(self) self.pulseBuilder.reset(); self.computePulseGroup(); plsdefgrp(self.pulseBuilder.pulseGroup); end + % Obtains the created pulse group. Make sure to call + % createPulseGroup first. function pulseGroup = getPulseGroup(self) pulseGroup = self.pulseBuilder.pulseGroup; end + % Obtains the expected data. Make sure to call createPulseGroup + % first. function expectedData = getExpectedData(self) expectedData = self.pulseBuilder.expectedData; end + % Constructs and returns the DAC object for the test initialized + % with the specific readout mask for the test. function dac = createDAC(self) switch (self.pulseBuilder.dacOperation) case 'raw' diff --git a/Testing/TestPulseBuilder.m b/Testing/TestPulseBuilder.m index 013c179..0a02a7d 100644 --- a/Testing/TestPulseBuilder.m +++ b/Testing/TestPulseBuilder.m @@ -1,4 +1,16 @@ classdef TestPulseBuilder < handle + % TestPulseBuilder An abstract base for classes that provide pulse + % groups for hardware IO tests. + % + % Subclasses provide functionality to construct a pulse group and the + % expected data to test a specific DAC operation according to provided + % readout masks. + % The following properties/methods need to be implemented: + % - meanErrorThreshold + % - singleErrrorThreshold + % - dacOperation ('raw', 'ds' or 'rsa') + % - pulseGroupPrototype + % - createPulse properties (Constant, Abstract, GetAccess = public) meanErrorThreshold; @@ -7,6 +19,8 @@ end properties (Constant, Abstract, GetAccess = protected) + % A prototype for an empty pulse group. Used in the reset + % operation. pulseGroupPrototype; end @@ -20,6 +34,9 @@ end methods (Abstract, Access = protected) + % Creates a single pulse and expected data according to the mask + % and the DAC operation and adds the created pulse to the pulse + % pulse group in construction. Called by addPulse(). createPulse(self, mask, repetitions); end @@ -33,11 +50,16 @@ methods (Access = public) + % addPulse adds a pulse to the constructed pulse group according to + % the mask and alters the expected data accordingly. The create + % pulse is guaranteed to be as long as mask.period. function addPulse(self, mask, repetitions) self.pulseCount = self.pulseCount + repetitions * mask.period; self.createPulse(mask, repetitions); end + % reset resets the currently constructed pulse group and expected + % data. function reset(self) self.pulseGroup = self.pulseGroupPrototype; self.pulseCount = 0;