Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Proyecto Smart Watch
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Leonardo Martinez Hornak
Proyecto Smart Watch
Commits
7ce18321
Commit
7ce18321
authored
3 years ago
by
Leonardo Martinez Hornak
Browse files
Options
Downloads
Patches
Plain Diff
Getting same resuts FFT interpolated
parent
ca6d5bd9
Branches
Branches containing commit
Tags
test_v1
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
firmware/src/breath_algorithm.c
+15
-2
15 additions, 2 deletions
firmware/src/breath_algorithm.c
software/misc/verificacion_micro.py
+24
-10
24 additions, 10 deletions
software/misc/verificacion_micro.py
with
39 additions
and
12 deletions
firmware/src/breath_algorithm.c
+
15
−
2
View file @
7ce18321
...
...
@@ -508,13 +508,21 @@ void Decimate()
void
FFT
()
{
float32_t
aux_mean
;
float32_t
aux_array
[
HR_VARIABILITY_LENGTH
];
//RIFV
//Sets zero to padding vector
arm_fill_f32
(
0
,
fftInputPadded_f32
,
PADDING_SIZE_FFT
);
//Remuevo la media de la señal interpolada
arm_mean_f32
(
&
hr_variability
,
HR_VARIABILITY_LENGTH
,
&
aux_mean
);
arm_fill_f32
(
aux_mean
,
aux_array
,
HR_VARIABILITY_LENGTH
);
arm_sub_f32
(
&
hr_variability
,
&
aux_array
,
&
aux_array
,
HR_VARIABILITY_LENGTH
);
//Adds input vector to Padded vector
arm_copy_f32
(
&
hr_variabilit
y
,
&
fftInputPadded_f32
,
HR_VARIABILITY_LENGTH
);
arm_copy_f32
(
&
aux_arra
y
,
&
fftInputPadded_f32
,
HR_VARIABILITY_LENGTH
);
arm_rfft_fast_init_f32
(
&
S_rfftInstance
,
PADDING_SIZE_FFT
);
...
...
@@ -526,8 +534,13 @@ void FFT()
//Sets zero to padding vector
arm_fill_f32
(
0
,
fftInputPadded_f32
,
PADDING_SIZE_FFT
);
//Remuevo la media de la señal interpolada
arm_mean_f32
(
&
peaks_variability
,
HR_VARIABILITY_LENGTH
,
&
aux_mean
);
arm_fill_f32
(
aux_mean
,
aux_array
,
HR_VARIABILITY_LENGTH
);
arm_sub_f32
(
&
peaks_variability
,
&
aux_array
,
&
aux_array
,
HR_VARIABILITY_LENGTH
);
//Adds input vector to Padded vector
arm_copy_f32
(
&
peaks_variabilit
y
,
&
fftInputPadded_f32
,
HR_VARIABILITY_LENGTH
);
arm_copy_f32
(
&
aux_arra
y
,
&
fftInputPadded_f32
,
HR_VARIABILITY_LENGTH
);
arm_rfft_fast_f32
(
&
S_rfftInstance
,
fftInputPadded_f32
,
complexFFT
,
0
);
arm_cmplx_mag_squared_f32
(
complexFFT
,
testOutputFFT_riav
,
PADDING_SIZE_FFT_HALF
);
...
...
This diff is collapsed.
Click to expand it.
software/misc/verificacion_micro.py
+
24
−
10
View file @
7ce18321
...
...
@@ -12,10 +12,15 @@ DOWNSAMPLING_PERIOD = 1/DOWNSAMPLING_RATE
TIME_TO_SHOW
=
10
RR_FREQUENCY_LOW
=
7
RR_FREQUENCY_HIGH
=
30
def
fft
(
signal
,
sampleFrequency
):
signalLength
=
len
(
signal
)
PSD
=
abs
(
np
.
fft
.
fft
(
signal
-
np
.
mean
(
signal
),
n
=
512
))
signal_aux
=
signal
-
np
.
mean
(
signal
)
PSD
=
abs
(
np
.
fft
.
fft
(
signal_aux
,
n
=
512
))
PSDLength
=
len
(
PSD
)
...
...
@@ -65,7 +70,10 @@ if file_size_1 > 0 and file_size_2 > 0:
picos_tiempo
=
np
.
loadtxt
(
"
./misc/datos_micro/
"
+
SENAL_MOSTRAR
+
"
/hrArrayPeaksTimeUpdatedLong_32.txt
"
,
delimiter
=
'
\t
'
,
dtype
=
str
,
usecols
=
(
2
)).
astype
(
float
)
picos_valor
=
np
.
loadtxt
(
"
./misc/datos_micro/
"
+
SENAL_MOSTRAR
+
"
/hrArrayPeaksValueLong_32.txt
"
,
delimiter
=
'
\t
'
,
dtype
=
str
,
usecols
=
(
2
)).
astype
(
float
)
picos_tiempo
=
SAMPLING_PERIOD
*
picos_tiempo
#Si agarro señal al final
picos_tiempo
=
picos_tiempo
#Si agarro antes de interpolar
#picos_tiempo = SAMPLING_PERIOD * picos_tiempo
plt
.
figure
()
plt
.
plot
(
picos_tiempo
,
picos_valor
,
"
o
"
)
...
...
@@ -109,10 +117,13 @@ if file_size > 0:
frequency
=
60
*
(
DOWNSAMPLING_RATE
/
2
/
FFT_SAMPLES
)
*
(
np
.
array
(
np
.
arange
(
0
,
FFT_SAMPLES
,
1
)))
#Recorto a zona de interés
frequency
=
frequency
[
15
:
60
]
hr_fft
=
hr_fft
[
15
:
60
]
frequency_python
=
frequency_python
[
15
:
60
]
fft_python
=
fft_python
[
15
:
60
]
recorte_low
=
int
((
RR_FREQUENCY_LOW
*
FFT_SAMPLES
)
/
(
60
*
DOWNSAMPLING_RATE
/
2
))
recorte_high
=
int
((
RR_FREQUENCY_HIGH
*
FFT_SAMPLES
)
/
(
60
*
DOWNSAMPLING_RATE
/
2
))
frequency
=
frequency
[
recorte_low
:
recorte_high
]
hr_fft
=
hr_fft
[
recorte_low
:
recorte_high
]
frequency_python
=
frequency_python
[
recorte_low
:
recorte_high
]
fft_python
=
fft_python
[
recorte_low
:
recorte_high
]
plt
.
figure
()
plt
.
subplot
(
1
,
2
,
1
)
...
...
@@ -159,10 +170,13 @@ if file_size > 0:
frequency
=
60
*
(
DOWNSAMPLING_RATE
/
2
/
FFT_SAMPLES
)
*
(
np
.
array
(
np
.
arange
(
0
,
FFT_SAMPLES
,
1
)))
#Recorto a zona de interés
frequency
=
frequency
[
15
:
60
]
peaks_fft
=
peaks_fft
[
15
:
60
]
frequency_python
=
frequency_python
[
15
:
60
]
fft_python
=
fft_python
[
15
:
60
]
recorte_low
=
int
((
RR_FREQUENCY_LOW
*
FFT_SAMPLES
)
/
(
60
*
DOWNSAMPLING_RATE
/
2
))
recorte_high
=
int
((
RR_FREQUENCY_HIGH
*
FFT_SAMPLES
)
/
(
60
*
DOWNSAMPLING_RATE
/
2
))
frequency
=
frequency
[
recorte_low
:
recorte_high
]
peaks_fft
=
peaks_fft
[
recorte_low
:
recorte_high
]
frequency_python
=
frequency_python
[
recorte_low
:
recorte_high
]
fft_python
=
fft_python
[
recorte_low
:
recorte_high
]
plt
.
figure
()
plt
.
subplot
(
1
,
2
,
1
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment