public static PointPairList Waveform(this OpticalStimulationDevice device, int channel) { // Cache parameters to prevent redundant hardware access var stimulusCurrent = (device.MaxCurrent * (channel == 0 ? device.ChannelZeroCurrent : device.ChannelOneCurrent) / 100.0); var pulseDuration = device.PulseDuration; var pulsePeriod = device.PulsePeriod; var interBurstInterval = device.InterBurstInterval; var burstPulseCount = device.BurstPulseCount; var trainBurstCount = device.TrainBurstCount; // Initial delay var waveform = new PointPairList { new PointPair(0, 0), new PointPair(device.TrainDelay, 0) }; // Stimulus train for (int i = 0; i < trainBurstCount; i++) { for (int j = 0; j < burstPulseCount; j++) { waveform.Add(new PointPair(waveform.Last().X, stimulusCurrent)); waveform.Add(new PointPair(waveform.Last().X + pulseDuration, stimulusCurrent)); waveform.Add(new PointPair(waveform.Last().X, 0)); if (j != device.BurstPulseCount - 1) { waveform.Add(new PointPair(waveform.Last().X + pulsePeriod - pulseDuration, 0)); } } if (i != device.TrainBurstCount - 1) { waveform.Add(new PointPair(waveform.Last().X + interBurstInterval, 0)); } } return(waveform); }
public static int NumberOfChannels(this OpticalStimulationDevice _) { return(2); }
public static string[] WaveformAxisLabels(this OpticalStimulationDevice _) { return(new[] { "Time (msec)", "Current (mA)" }); }