Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

気圧中央値 #27

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions raspberry_pi/bme_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# -*- coding: utf-8 -*-
from lib import BME280 as BME

class median_filter:
"""
メジアンフィルター
"""
def __init__(self):
pass

def input_data(self,list):
"""
フィルターしたいリスト型変数を入力する。
Returns
-------
なし
"""
self.list_ = sorted(list)
self.size = len(list)

def get_data(self):
"""
フィルターの結果を出力する。
Returns
-------
フィルターの結果
"""
return float((self.list_[self.size/2] + self.list_[self.size/2 - 1]))/2


try:
data = []
while 1:
bmedata = BME.readData()
print(bmedata)
data += [bmedata[1]]

finally:
med = median_filter()
med.input_data()
print(med.get_data())
2 changes: 1 addition & 1 deletion raspberry_pi/lib/BME280/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def readData():
recover_P = compensate_P(pres_raw)
#recover_H = compensate_H(hum_raw)
mesure_high = ((((sea_pressure/recover_P)**(1/5.257)) - 1.) * (recover_T + 273.15)) / 0.0065
return mesure_high
return mesure_high, recover_P, recover_T


def compensate_P(adc_P):
Expand Down