public WaveDataSet(IWaveFile wavefile, int ch) { data = wavefile[ch]; dt = wavefile.dt(ch); is_acc = wavefile.name(ch).Contains("_Ya_") || wavefile.name(ch).Contains("_Za_"); init(); foreach (var tag in new string[] {"速度", "キロ程" }) { if (wavefile.name(ch).Contains(tag)) DisableBaselineShift = true; } }
private void open_file(string file_name) { file_path.Text = file_name; var ext = System.IO.Path.GetExtension(file_name).ToUpper(); if (ext == ".DAT") { if (Famos.is_famos(file_name)) { wavefile = new Famos(file_name); if (wavefile != null) AbsoluteTime.Enabled = true; } else { //throw new NotImplementedException("Only famos format file is supported."); MessageBox.Show("Only famos format file is supported for .DAT files."); return; } } if (ext == ".CSV") { if (DelimFile.IsKyowaCsv(file_name)) { wavefile = DelimFile.KyowaCsv(file_name); if (wavefile != null) AbsoluteTime.Enabled = true; } else { wavefile = DelimFile.GeneralCsv(file_name); if(wavefile != null) AbsoluteTime.Enabled = false; } } if (wavefile == null) { MessageBox.Show("DAT and CSV are supported format"); return; //throw new NotImplementedException("DAT and CSV are supported format"); } progressBar1.Value = 0; progressBar1.Visible = true; if (!wavefile.opened) return; progressBar1.Maximum = wavefile.cols + 2; progressBar1.Value = 1; var default_window_type = FIRFilter.WindowType.None; double a = 1.5; double.TryParse(alpha.Text, out a); if (rectangle_window.Checked) default_window_type = FIRFilter.WindowType.Rectangle; if (hann_window.Checked) default_window_type = FIRFilter.WindowType.Han; if (hamming_widow.Checked) default_window_type = FIRFilter.WindowType.Hamming; if (blackman_window.Checked) default_window_type = FIRFilter.WindowType.Blackman; if (kaiser_window.Checked) default_window_type = FIRFilter.WindowType.Kaiser; data = new List<WaveDataSet>(wavefile.cols); for (int i = 0; i < wavefile.cols; i++) { progressBar1.Value = i + 2; var wave = new WaveDataSet(wavefile, i); data.Add(wave); wave.tap = tap_track.Value; wave.lower = lower_fc_track.Value; wave.upper = upper_fc_track.Value; wave.alpha = a; wave.window_type = default_window_type; wave.gain = -80.0; } progressBar1.Value = progressBar1.Maximum; // reset combobox foreach (var item in targets) { item.Text = ""; item.Items.Clear(); for (int i = 0; i < wavefile.cols; i++) { item.Items.Add(i.ToString()); } } channel_track.Value = 0; channel_track.Maximum = wavefile.cols - 1; axes_ranges = new AxisRanges[wavefile.cols]; for(int i = 0; i < wavefile.cols; i++) { // NaN means automatic axes_ranges[i].wave.max = axes_ranges[i].wave.min = double.NaN; //axes_ranges[i].peak_P.max = axes_ranges[i].peak_P.min = double.NaN; //axes_ranges[i].peak_a.max = axes_ranges[i].peak_a.min = double.NaN; } update_tap_info(); channel_change(); progressBar1.Visible = false; umi.Enabled = true; yama.Enabled = true; len_0_1sec.Enabled = true; len_0_5sec.Enabled = true; len_1sec.Enabled = true; len_5sec.Enabled = true; freq_chart.ChartAreas[0].RecalculateAxesScale(); wave_chart.ChartAreas[0].RecalculateAxesScale(); filter_chart.ChartAreas[0].RecalculateAxesScale(); peak_chart.ChartAreas[0].RecalculateAxesScale(); }