Esempio n. 1
0
        private void bPFilterButton_Click(object sender, EventArgs e)
        {
            try
            {
                int threshold0 = (int)bPFilterNnumericUpDown0.Value;
                int threshold1 = (int)bPFilterNumericUpDown1.Value;

                if (bPFilterComboBox.Text == "Гц")
                {
                    threshold0 = (int)(threshold0 / (signal.Hz / signal.Count));
                    threshold1 = (int)(threshold1 / (signal.Hz / signal.Count));
                }

                FilterType type         = GetFourierTransformType();
                double[]   preparedData = FiltersUtils.PrepareDataToFilter(signal.Data, type);

                var filteredData = FourierTransform.BPFilter(preparedData, threshold0, threshold1, type);

                if (saveToFileCheckBox.Checked)
                {
                    WriteDataToFile(filteredData);
                }

                var form = new ShowChartForm(filteredData, filePath + " полосовой фильтр", signal.Type, signal.Hz);
                form.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Построить по данным график и показать его
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void showBaseSignalButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (signal == null)
                {
                    throw new NullReferenceException("Данные не были загруженны!");
                }

                ShowChartForm form = new ShowChartForm(signal.Data, filePath.Split('/').Last(), signal.Type, signal.Hz);

                form.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 3
0
        private void hPFilterButton_Click(object sender, EventArgs e)
        {
            try
            {
                int    n         = (int)hPImpulceCharacteristicNNumericUpDown.Value;
                double threshold = (double)hPImpulceCharacteristicThresholdNumericUpDown.Value;

                double[] filteredData = FiniteImpulseResponse.FirFilter(signal.Data, signal.Hz, n, threshold, FirFilterType.HighPass);

                if (saveToFileCheckBox.Checked)
                {
                    WriteDataToFile(filteredData);
                }

                var form = new ShowChartForm(filteredData, filePath + " ВЧ фильтр", signal.Type, signal.Hz);
                form.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }