示例#1
0
        private static int NonZeroRight(AnalogFilter analog, double scale)
        {
            int right = Convert.ToInt32(Math.Floor(analog.Right * scale));

            while (analog[right / scale] == 0)
            {
                right--;
            }
            return(right);
        }
示例#2
0
 private static void AssertFiltersEqual(AnalogFilter actual, AnalogFilter expected, double granularity)
 {
     Assert.That(actual.Left, Is.EqualTo(expected.Left));
     Assert.That(actual.Right, Is.EqualTo(expected.Right));
     Assert.That(actual.Radius, Is.EqualTo(expected.Radius));
     for (double x = actual.Left - granularity; x <= actual.Right + granularity; x += granularity)
     {
         Assert.That(actual[x], Is.EqualTo(expected[x]).Within(1E-15));
     }
 }
示例#3
0
        private static int NonZeroLeft(AnalogFilter analog, double scale)
        {
            int left = Convert.ToInt32(Math.Ceiling(analog.Left * scale));

            while (analog[left / scale] == 0)
            {
                left++;
            }
            return(left);
        }
示例#4
0
 private static void AssertCoefficients(AnalogFilter filter, double scale, double[] coeffs)
 {
     Assert.That(new DigitalFilter(filter, scale).Coefficients, Is.EqualTo(coeffs).Within(1E-15));
 }
 /// <summary>
 /// Set the active analog filter
 /// </summary>
 /// <param name="filter">Analog Filter to use</param>
 public void SetAnalogFilter(AnalogFilter filter)
 {
     SendCommandWithErrorOnlyResponse("PM:ANALOGFILTER " + (int)filter);
 }
示例#6
0
 public DigitalFilter(AnalogFilter analog, double scale)
 {
     Left         = NonZeroLeft(analog, scale);
     Right        = NonZeroRight(analog, scale);
     Coefficients = Arrays.New(Right - Left + 1, i => analog[(i + Left) / scale]);
 }
示例#7
0
        private void cmbAnalogFilter_SelectedIndexChanged(object sender, EventArgs e)
        {
            AnalogFilter filter = (AnalogFilter)cmbAnalogFilter.SelectedIndex;

            Newport.SetAnalogFilter(filter);
        }