Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
N
noise_python_scripts
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Python_Scripts_For_Embedded_Developer
noise_python_scripts
Commits
72c06705
Commit
72c06705
authored
Dec 15, 2023
by
aohui.li
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加入声级计,数据对比测试
parent
cbda2291
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
15 deletions
+45
-15
MotorExactNoise(jd).csv
Result_Cal/MotorExactNoise(jd).csv
+11
-0
MotorExactNoise(zt).csv
Result_Cal/MotorExactNoise(zt).csv
+11
-0
deal_data.py
Result_Cal/deal_data.py
+23
-15
No files found.
Result_Cal/MotorExactNoise(jd).csv
0 → 100644
View file @
72c06705
jd,rs
74.9,71.8
74.7,71.8
74.4,71.5
75.2,71.7
75.2,71.8
74.9,71.9
75.7,71.3
74.2,71.5
75.4,71.3
75.1,72.2
Result_Cal/MotorExactNoise(zt).csv
0 → 100644
View file @
72c06705
zt,rs
73.9,71.8
73.9,71.8
74.1,71.5
73.4,71.7
73.3,71.8
73.8,71.9
73.8,71.3
73.5,71.5
74.4,71.3
73.1,72.2
Result_Cal/deal_data.py
View file @
72c06705
...
...
@@ -2,39 +2,47 @@ import numpy as np
import
pandas
as
pd
# 传感器的数据
# data_zt = np.array([115.2, 114.6, 114.7, 114.4, 114.5, 114.1, 114.6, 113.6, 114.6, 114.6, 114.5, 114.5, 114.6, 114.6, 114.7, 114.7, 114.6, 114.7, 114.6, 114.6])
# data_jd = np.array([109.5, 117.3, 117.3, 117.1, 117.1, 117.1, 117.1, 117.1, 117.1, 117.1, 117.1, 117.1, 117.1, 117.1, 117.1, 117, 117.1, 117.1, 117.1, 116.7])
data_file_Motor_Long
=
'MotorLong.csv'
data_file_1KHz_High
=
'_1KHz_High.csv'
data_file_1KHz_Low
=
'_1KHz_Low.csv'
data_file_Motor_jd
=
'MotorExactNoise(jd).csv'
data_file_Motor_zt
=
'MotorExactNoise(zt).csv'
data_file
=
data_file_1KHz_Low
data_file
=
data_file_Motor_zt
data
=
pd
.
read_csv
(
data_file
)
data_zt
=
data
[
'zt'
]
.
values
data_jd
=
data
[
'jd'
]
.
values
# data_jd = data['jd'].values
data_rs
=
data
[
'rs'
]
.
values
string_left
=
'zt'
string_right
=
'rs'
data_left
=
data_zt
data_right
=
data_rs
# 计算均值
mean_zt
=
np
.
mean
(
data_
z
t
)
mean_jd
=
np
.
mean
(
data_
jd
)
mean_zt
=
np
.
mean
(
data_
lef
t
)
mean_jd
=
np
.
mean
(
data_
right
)
# 计算方差
variance_zt
=
np
.
var
(
data_
z
t
)
variance_jd
=
np
.
var
(
data_
jd
)
variance_between
=
np
.
var
(
data_
zt
-
data_jd
)
# 两者之间的方差
variance_zt
=
np
.
var
(
data_
lef
t
)
variance_jd
=
np
.
var
(
data_
right
)
variance_between
=
np
.
var
(
data_
left
-
data_right
)
# 两者之间的方差
# 计算百分比差异
percent_diff
=
np
.
abs
((
mean_zt
-
mean_jd
)
/
((
mean_zt
+
mean_jd
)
/
2
))
*
100
# 计算最大值和最小值的偏差
max_deviation
=
np
.
abs
(
np
.
max
(
data_
zt
)
-
np
.
max
(
data_jd
))
min_deviation
=
np
.
abs
(
np
.
min
(
data_
zt
)
-
np
.
min
(
data_jd
))
max_deviation
=
np
.
abs
(
np
.
max
(
data_
left
)
-
np
.
max
(
data_right
))
min_deviation
=
np
.
abs
(
np
.
min
(
data_
left
)
-
np
.
min
(
data_right
))
mean_zt
,
mean_jd
,
variance_zt
,
variance_jd
,
variance_between
,
percent_diff
,
max_deviation
,
min_deviation
print
(
f
"mean_
zt:
\t
{mean_zt:.2f}
"
)
print
(
f
"mean_
jd:
\t
{mean_jd:.2f}
"
)
print
(
f
"variance_
zt
:
\t
{variance_zt:.2f}"
)
print
(
f
"variance_
jd
:
\t
{variance_jd:.2f}"
)
print
(
f
"mean_
{string_left}:
\t
{mean_zt:.2f} dB
"
)
print
(
f
"mean_
{string_right}:
\t
{mean_jd:.2f} dB
"
)
print
(
f
"variance_
{string_left}
:
\t
{variance_zt:.2f}"
)
print
(
f
"variance_
{string_right}
:
\t
{variance_jd:.2f}"
)
print
(
f
"variance_between:
\t
{variance_between:.2f}"
)
print
(
f
"percent_diff:
\t
{percent_diff:.2f}"
)
print
(
f
"max_deviation:
\t
{max_deviation:.2f}"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment