Beispiel #1
0
from CSVParser.Helper import Helper
import plotly.graph_objs as go
import plotly
from scipy.fftpack import fft
plotly.offline.init_notebook_mode()

# car_path = 'C:\\Users\Phatthanaphong\Desktop\City\PyCity\Data\Car.csv'
# motor_path = 'C:\\Users\Phatthanaphong\Desktop\City\PyCity\Data\Motorcycle.csv'

car_path = '/home/aaa/Desktop/City/PyCity/Data/Car.csv'
motor_path = '/home/aaa/Desktop/City/PyCity/Data/Motorcycle.csv'
Helper = Helper()

Car = Helper.reader(car_path)
car = Helper.preprocess(Car)
Motor = Helper.reader(motor_path)
motor = Helper.preprocess(Motor)
# print(car[0].get('speed'))

new_time = Helper.time_rescale(car[0].get('time'))

trace0 = go.Scatter(
    y = abs(fft(car[0].get('speed'))),
    mode = 'lines',
    name = 'lines'
)

trace1 = go.Scatter(
    y = abs(fft(motor[7].get('speed'))),
    mode = 'lines',
    name = 'lines'
Beispiel #2
0
from CSVParser.Helper import Helper
import plotly.graph_objs as go
import plotly
plotly.offline.init_notebook_mode()

# car_path = 'C:\\Users\Phatthanaphong\Desktop\City\PyCity\Data\Car.csv'
# motor_path = 'C:\\Users\Phatthanaphong\Desktop\City\PyCity\Data\Motorcycle.csv'

car_path = '/home/phatthanapong/Desktop/City/PyCity/Data/Car.csv'
motor_path = '/home/phatthanapong/Desktop/City/PyCity/Data/Motorcycle.csv'
Helper = Helper()

Car = Helper.reader(car_path)
car = Helper.preprocess(Car)
Motor = Helper.reader(motor_path)
motor = Helper.preprocess(Motor)
# print(car[0].get('speed'))

new_time = Helper.time_rescale(car[0].get('time'))
# print(new_time)

trace0 = go.Scatter(y=car[0].get('speed'),
                    x=new_time,
                    mode='lines',
                    name='lines')

trace1 = go.Scatter(y=motor[7].get('speed'),
                    x=Helper.time_rescale(motor[7].get('time')),
                    mode='lines',
                    name='lines')
Beispiel #3
0
import plotly.graph_objs as go
import plotly
plotly.offline.init_notebook_mode()
# car_path = 'C:\\Users\Phatthanaphong\Desktop\City\PyCity\Data\Car.csv'
# motor_path = 'C:\\Users\Phatthanaphong\Desktop\City\PyCity\Data\Motorcycle.csv'
# bike_path = 'C:\\Users\Phatthanaphong\Desktop\City\PyCity\Data\Bicycle.csv'
# run_path = 'C:\\Users\Phatthanaphong\Desktop\City\PyCity\Data\Run.csv'
# walk_path = 'C:\\Users\Phatthanaphong\Desktop\City\PyCity\Data\Walk.csv'
# Linux path
car_path = '/home/phatthanapong/Desktop/City/PyCity/Data/Car.csv'
motor_path = '/home/phatthanapong/Desktop/City/PyCity/Data/Motorcycle.csv'
bike_path = '/home/phatthanapong/Desktop/City/PyCity/Data/Bicycle.csv'
run_path = '/home/phatthanapong/Desktop/City/PyCity/Data/Run.csv'
walk_path = '/home/phatthanapong/Desktop/City/PyCity/Data/Walk.csv'

Helper = Helper()

Car = Helper.reader(car_path)
car = Helper.preprocess(Car)
avg_speed_car = Helper.avg_speed(car)
avg_speed_car_nz = Helper.avg_speed_nozero(car)
max_speed_car = Helper.max(car)

Motor = Helper.reader(motor_path)
motor = Helper.preprocess(Motor)
avg_speed_motor = Helper.avg_speed(motor)
avg_speed_motor_nz = Helper.avg_speed_nozero(motor)
max_speed_motor = Helper.max(motor)

# CAR
trace = go.Scatter(y=avg_speed_car_nz,
Beispiel #4
0
from sklearn.ensemble import RandomForestClassifier
from sklearn.naive_bayes import GaussianNB
# Wndows path
# car_path = 'C:\\Users\Phatthanaphong\Desktop\City\PyCity\Data\Car.csv'
# motor_path = 'C:\\Users\Phatthanaphong\Desktop\City\PyCity\Data\Motorcycle.csv'
# bike_path = 'C:\\Users\Phatthanaphong\Desktop\City\PyCity\Data\Bicycle.csv'
# run_path = 'C:\\Users\Phatthanaphong\Desktop\City\PyCity\Data\Run.csv'
# walk_path = 'C:\\Users\Phatthanaphong\Desktop\City\PyCity\Data\Walk.csv'
# Linux path
car_path = '/home/phatthanapong/Desktop/City/PyCity/Data/Car.csv'
motor_path = '/home/phatthanapong/Desktop/City/PyCity/Data/Motorcycle.csv'
bike_path = '/home/phatthanapong/Desktop/City/PyCity/Data/Bicycle.csv'
run_path = '/home/phatthanapong/Desktop/City/PyCity/Data/Run.csv'
walk_path = '/home/phatthanapong/Desktop/City/PyCity/Data/Walk.csv'

Helper = Helper()

Car = Helper.reader(car_path)
car = Helper.preprocess(Car)
avg_speed_car = Helper.avg_speed(car)
min_speed_car = Helper.min(car)
max_speed_car = Helper.max(car)
car_data = Helper.feature_list(max_speed_car, min_speed_car, avg_speed_car,
                               'car')

Motor = Helper.reader(motor_path)
motor = Helper.preprocess(Motor)
std_speed_m = Helper.std(motor)

trace0 = go.Scatter(y=std_speed,
                    mode='markers',
Beispiel #5
0
from CSVParser.Helper import Helper
car_path = 'C:\\Users\Phatthanaphong\Desktop\City\PyCity\Data\Car.csv'
# car_path = '/home/phatthanapong/Desktop/City/PyCity/Data/Car.csv'
motor_path = '/home/phatthanapong/Desktop/City/PyCity/Data/Motorcycle.csv'
bike_path = '/home/phatthanapong/Desktop/City/PyCity/Data/Bicycle.csv'
run_path = '/home/phatthanapong/Desktop/City/PyCity/Data/Run.csv'
walk_path = '/home/phatthanapong/Desktop/City/PyCity/Data/Walk.csv'

data = []
Helper = Helper()
Car = Helper.reader(car_path)
car_speed =[]
speed = []
zero = []
inn = []
temp = None
for car in Car:
    found = 0
    for idx, val in enumerate(car):
        if float(val['accuracy']) > 200:
            print('ok')
            print(val['accuracy'])
    break
Beispiel #6
0
plotly.offline.init_notebook_mode()
# car_path = 'C:\\Users\Phatthanaphong\Desktop\City\PyCity\Data\Car.csv'
# motor_path = 'C:\\Users\Phatthanaphong\Desktop\City\PyCity\Data\Motorcycle.csv'
# bike_path = 'C:\\Users\Phatthanaphong\Desktop\City\PyCity\Data\Bicycle.csv'
# run_path = 'C:\\Users\Phatthanaphong\Desktop\City\PyCity\Data\Run.csv'
# walk_path = 'C:\\Users\Phatthanaphong\Desktop\City\PyCity\Data\Walk.csv'
# Linux path
car_path = '/home/phatthanapong/Desktop/City/PyCity/Data/Car.csv'
motor_path = '/home/phatthanapong/Desktop/City/PyCity/Data/Motorcycle.csv'
bike_path = '/home/phatthanapong/Desktop/City/PyCity/Data/Bicycle.csv'
run_path = '/home/phatthanapong/Desktop/City/PyCity/Data/Run.csv'
walk_path = '/home/phatthanapong/Desktop/City/PyCity/Data/Walk.csv'

Helper = Helper()

Car = Helper.reader(car_path)
car = Helper.preprocess(Car)
avg_speed_car = Helper.avg_speed(car)
avg_speed_car_nz = Helper.avg_speed_nozero(car)
max_speed_car = Helper.max(car)

Motor = Helper.reader(motor_path)
motor = Helper.preprocess(Motor)
avg_speed_motor = Helper.avg_speed(motor)
avg_speed_motor_nz = Helper.avg_speed_nozero(motor)
max_speed_motor = Helper.max(motor)

# CAR
trace = go.Scatter(
    y = avg_speed_car_nz,
    name = 'remove stop point',
Beispiel #7
0
import csv
import numpy as np
import plotly.graph_objs as go
import plotly.plotly as py
import plotly
from CSVParser.Helper import Helper

plotly.offline.init_notebook_mode()
Helper = Helper()
# plotly.tools.set_credentials_file(username='******', api_key='p5gx4csvk1')



car_path = '/home/phatthanapong/Desktop/City/PyCity/Data/Car.csv'
motor_path = '/home/phatthanapong/Desktop/City/PyCity/Data/Motorcycle.csv'
bike_path = '/home/phatthanapong/Desktop/City/PyCity/Data/Bicycle.csv'
run_path = '/home/phatthanapong/Desktop/City/PyCity/Data/Run.csv'
walk_path = '/home/phatthanapong/Desktop/City/PyCity/Data/Walk.csv'
# path = 'C:\\Users\Phatthanaphong\Desktop\City\PyCity\Data\Car.csv'
data = []

Car = Helper.reader(car_path)
car_speed =[]
for car in Car:
    speed = [float(s['bering']) for s in car]
    car_speed.append(speed)


car_plot = go.Box(
    y=car_speed[4],
    name='Car'
Beispiel #8
0
from CSVParser.Helper import Helper
car_path = 'C:\\Users\Phatthanaphong\Desktop\City\PyCity\Data\Car.csv'
# car_path = '/home/phatthanapong/Desktop/City/PyCity/Data/Car.csv'
motor_path = '/home/phatthanapong/Desktop/City/PyCity/Data/Motorcycle.csv'
bike_path = '/home/phatthanapong/Desktop/City/PyCity/Data/Bicycle.csv'
run_path = '/home/phatthanapong/Desktop/City/PyCity/Data/Run.csv'
walk_path = '/home/phatthanapong/Desktop/City/PyCity/Data/Walk.csv'

data = []
Helper = Helper()
Car = Helper.reader(car_path)
car_speed = []
speed = []
zero = []
inn = []
temp = None
for car in Car:
    found = 0
    for idx, val in enumerate(car):
        if float(val['accuracy']) > 200:
            print('ok')
            print(val['accuracy'])
    break
Beispiel #9
0
from sklearn.naive_bayes import GaussianNB
from sklearn.neural_network import MLPClassifier
# Wndows path

car_path = 'C:\\Users\phatt\Desktop\City\PyCity\Data\Car.csv'
motor_path = 'C:\\Users\phatt\Desktop\City\PyCity\Data\Motorcycle.csv'
bike_path = 'C:\\Users\phatt\Desktop\City\PyCity\Data\Bicycle.csv'
run_path = 'C:\\Users\phatt\Desktop\City\PyCity\Data\Run.csv'
walk_path = 'C:\\Users\phatt\Desktop\City\PyCity\Data\Walk.csv'
# Linux path
# car_path = '/home/aaa/Desktop/City/PyCity/Data/Car.csv'
# motor_path = '/home/aaa/Desktop/City/PyCity/Data/Motorcycle.csv'
# bike_path = '/home/aaa/Desktop/City/PyCity/Data/Bicycle.csv'
# run_path = '/home/aaa/Desktop/City/PyCity/Data/Run.csv'
# walk_path = '/home/aaa/Desktop/City/PyCity/Data/Walk.csv'
Helper = Helper()

Car = Helper.reader(car_path)
car = Helper.preprocess(Car)
avg_speed_car = Helper.avg_speed(car)
std_speed_car = Helper.std(car)
avg_speed_car_nozero = Helper.avg_speed_nozero(car)
max_speed_car = Helper.max(car)

car_data = Helper.feature_list(max_speed_car,std_speed_car,avg_speed_car,avg_speed_car_nozero,'car')


Motor = Helper.reader(motor_path)
motor = Helper.preprocess(Motor)
avg_speed_motor = Helper.avg_speed(motor)
avg_speed_motor_nz = Helper.avg_speed_nozero(motor)