1 Commits

Autor SHA1 Mensagem Data
Alex Castillo 07fd17fda0 max frequency filter 2016-06-13 21:15:22 -04:00
5 arquivos alterados com 40 adições e 32 exclusões
+4
Ver Arquivo
@@ -63,4 +63,8 @@
.filters .disabled {
opacity: 0.2;
}
.filters .range input {
width: 100%;
}
+11 -2
Ver Arquivo
@@ -4,9 +4,9 @@
<article *ngFor="let filter of filters"
[ngClass]="{ disabled: !filter.enabled }">
<label>{{ filter.label }}</label>
<div class="select">
<div class="select" *ngIf="filter.type === 'select'">
<select
[multiple]="filter.type === 'multiple'"
[multiple]="filter.multiple"
[disabled]="!filter.enabled"
(change)="applyFilter($event.target.value)">
<option *ngFor="let option of filter.options"
@@ -15,6 +15,15 @@
</option>
</select>
</div>
<div class="range" *ngIf="filter.type === 'range'">
<input
type="range"
[disabled]="!filter.enabled"
[min]="filter.min"
[max]="filter.max"
[(ngModel)]="maxFrequency"
(change)="applyFilter(filter.id + ':' + $event.target.value)" />
</div>
</article>
</nav>
</aside>
+17 -30
Ver Arquivo
@@ -15,10 +15,20 @@ export class Constants {
};
filters: Array<any> = [
{
id: 'MAXFREQUENCY',
label: 'Max Frequency',
type: 'range',
modules: ['fft'],
enabled: true,
min: 0,
max: 125
},
{
id: 'NOTCH',
label: 'Notch',
type: 'single',
type: 'select',
modules: ['fft','time'],
enabled: true,
options: [
{
@@ -38,7 +48,8 @@ export class Constants {
{
id: 'BANDPASS',
label: 'Band Pass',
type: 'single',
type: 'select',
modules: ['fft'],
enabled: false,
options: [
{
@@ -66,7 +77,7 @@ export class Constants {
{
id: 'VERTSCALE',
label: 'Vert Scale',
type: 'single',
type: 'select',
enabled: false,
options: [
{
@@ -102,7 +113,7 @@ export class Constants {
{
id: 'VERTALGO',
label: 'Vert Algo',
type: 'single',
type: 'select',
enabled: false,
options: [
{
@@ -118,7 +129,7 @@ export class Constants {
{
id: 'SMOOTH',
label: 'Smooth',
type: 'single',
type: 'select',
enabled: false,
options: [
{
@@ -150,7 +161,7 @@ export class Constants {
{
id: 'POLARITY',
label: 'Polarity',
type: 'single',
type: 'select',
enabled: false,
options: [
{
@@ -162,30 +173,6 @@ export class Constants {
label: 'No'
}
]
},
{
id: 'MAXFREQUENCY',
label: 'Max Frequency',
type: 'single',
enabled: false,
options: [
{
id: 'MAXFREQUENCY:60',
label: '60 Hz'
},
{
id: 'MAXFREQUENCY:120',
label: '120 Hz'
},
{
id: 'MAXFREQUENCY:20',
label: '20 Hz'
},
{
id: 'MAXFREQUENCY:40',
label: '40 Hz'
}
]
}
];
+1
Ver Arquivo
@@ -35,6 +35,7 @@ module.exports = class FFT {
fft.forward(signal);
this.spectrums[index] = Utils.data.parseObjectAsArray(fft.spectrum);
this.spectrums[index] = Utils.signal.voltsToMicrovolts(this.spectrums[index], true);
this.spectrums[index] = Utils.filter.maxFrequency(this.spectrums[index]);
});
}
+7
Ver Arquivo
@@ -18,6 +18,7 @@ module.exports = {
if (!filter) return;
let [id, value] = filter.split(':');
this.state[id] = value;
console.log(filter, this.state.MAXFREQUENCY);
},
process (signal) {
@@ -75,6 +76,12 @@ module.exports = {
return notchFilter.multiStep(signal);
},
maxFrequency (signal) {
return signal.filter((frequency) => {
return frequency < this.state.MAXFREQUENCY;
});
},
bandpass (signal) {
// @TODO: Finish bandpass filter