private void BuildUsingKH(IList <TiltData> tilts) { FiltType = FilterType.KarousHjelt; ZAxisTitle = "KH"; ZUnit = "%"; var x = new List <float>(); var y = new List <float>(); var z = new List <float>(); foreach (var kh in tilts.Select(tilt => VlfFilter.KarousHjelt(tilt, 0, 1))) { for (var i = 0; i < kh.Npts; i++) { var xy = Displacement.NextPoint(kh.X, kh.Y, kh.Bearing, kh.Spacing * (i - 1)); x.Add(xy[0]); y.Add(xy[1]); z.Add(kh.Values[i]); } } Npts = x.Count; XValues = new float[x.Count]; YValues = new float[y.Count]; ZValues = new float[z.Count]; XValues = x.ToArray(); YValues = y.ToArray(); ZValues = z.ToArray(); CalcGridSize(); }
private void tsKarousHjelt_Click(object sender, EventArgs e) { var selectedNode = treeViewMain.SelectedNode; var tiltData = selectedNode.Tag as TiltData; if (tiltData == null) { return; } if (tiltData.Npts < 6) { MessageBox.Show(@"There should be minimum of 7 data for this filter to work."); return; } var uniqeName = FindUniqeName(selectedNode.Name, treeViewMain.Nodes["NodeKH"]); if (InputPrompt.InputStringBox("Karous Hjelt-Filter", "Enter a name.", ref uniqeName) != DialogResult.OK) { return; } var skin = 0f; if ( InputPrompt.InputNumberBox("Karous Hjelt-Filter", $"Skin depth normalization. Enter 0 to ignore skin depth", ref skin) != DialogResult.OK) { return; } var kh = VlfFilter.KarousHjelt(tiltData, skin); kh.Rename(uniqeName); AddNode(uniqeName, treeViewMain.Nodes["NodeKH"], kh); if (kh.RawLength > 150) { MessageBox.Show( @"Due to the limitation of gridding implementation in this version, the pseudosection could not be shown. However, you can still export the result into an external file.", @"Data Too Large To Grid", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } StartGriddingWorker(new Surface2D(kh)); }
private void tsbMovAvg_Click(object sender, EventArgs e) { var selectedNode = treeViewMain.SelectedNode; var parent = treeViewMain.Nodes["NodeTilt"]; var order = 3; if (InputPrompt.InputNumberBox("Moving Average Filter", "Filter Order", ref order) != DialogResult.OK) { return; } var data = selectedNode.Tag as TiltData; if (data != null && ((Math.Abs(order)) <= 1 || order > data.Npts)) { MessageBox.Show(@"Invalid filter order.", @"Error"); return; } if (data == null) { return; } var newname = FindUniqeName($"{selectedNode.Name}_MovAvg Order {Convert.ToInt32(order)}", parent); if (InputPrompt.InputStringBox("Moving Average Filter", "Enter a name.", ref newname) != DialogResult.OK) { return; } var smooth = VlfFilter.MovingAverage(data, Convert.ToInt32(order)); smooth.Rename(newname); AddNode(newname, parent, smooth); var form2 = new ChartPlot(newname, smooth) { MdiParent = this }; form2.Show(); }
private void tsFraserFilter_Click(object sender, EventArgs e) { var selectedNode = treeViewMain.SelectedNode; var tiltData = selectedNode.Tag as TiltData; if (tiltData == null) { return; } if (tiltData.Npts < 4) { MessageBox.Show(@"There should be minimum of 4 data for this filter to work."); return; } var uniqeName = FindUniqeName(selectedNode.Name, treeViewMain.Nodes["NodeFraser"]); if (InputPrompt.InputStringBox("Fraser Filter", "Enter a name.", ref uniqeName) != DialogResult.OK) { return; } // Do Fraser Filtering var fraser = VlfFilter.Fraser(tiltData); fraser.Rename(uniqeName); AddNode(uniqeName, treeViewMain.Nodes["NodeFraser"], fraser); // Plot the result var form2 = new ChartPlot(uniqeName, fraser) { MdiParent = this }; form2.Show(); }