-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from hybridmachine/FFT_Filters
Fft filters
- Loading branch information
Showing
10 changed files
with
82 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
Signals And Transforms/View Models/FrequencyHistogramViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using SignalProcessor; | ||
using System; | ||
using OxyPlot; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using OxyPlot.Axes; | ||
using OxyPlot.Series; | ||
|
||
namespace SignalsAndTransforms.View_Models | ||
{ | ||
public class FrequencyHistogramViewModel : PlotModel | ||
{ | ||
public FrequencyHistogramViewModel(FrequencyDomain frequencyDomain) | ||
{ | ||
Title = Properties.Resources.PLOT_FREQUENCY_HISTOGRAM_TITLE; | ||
Axes.Add(new LinearAxis { Position = AxisPosition.Left, Title = Properties.Resources.PLOT_FREQUENCY_HISTOGRAM_LEFT_AXIS }); | ||
Axes.Add(new LinearAxis { Position = AxisPosition.Bottom, Title = Properties.Resources.PLOT_FREQUENCY_HISTOGRAM_BOTTOM_AXIS }); | ||
|
||
if (frequencyDomain != null) | ||
{ | ||
HistogramSeries chs = new HistogramSeries(); | ||
chs.Items.AddRange(GetFrequencyBins(frequencyDomain)); | ||
Series.Add(chs); | ||
} | ||
} | ||
|
||
private IList<HistogramItem> GetFrequencyBins(FrequencyDomain frequencyDomain) | ||
{ | ||
int binCount = (int)Math.Ceiling(frequencyDomain.SampleRateHz / 2); | ||
List<HistogramItem> histogramItems = new List<HistogramItem>(binCount); | ||
|
||
foreach (var amplitude in frequencyDomain.FrequencyAmplitudes) | ||
{ | ||
HistogramItem item = new HistogramItem(amplitude.Key - 0.25, amplitude.Key + 0.25, amplitude.Value, 1); | ||
histogramItems.Add(item); | ||
} | ||
|
||
return histogramItems; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters