erste Versuche Python / Plotly
This commit is contained in:
parent
cdb4f3f12c
commit
eef1b0bcba
13
ReadMe.md
Normal file
13
ReadMe.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Manöverdaten Auswertung
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
`pip install plotly`
|
||||||
|
|
||||||
|
## Dokumentation
|
||||||
|
|
||||||
|
https://www.geeksforgeeks.org/python-plotly-tutorial/
|
||||||
|
|
||||||
|
|
||||||
6250
example_data/CFD_103_90_21SBhZ.csv
Normal file
6250
example_data/CFD_103_90_21SBhZ.csv
Normal file
File diff suppressed because it is too large
Load Diff
BIN
example_data/Manöverversuche.pdf
Normal file
BIN
example_data/Manöverversuche.pdf
Normal file
Binary file not shown.
4899
example_data/OnBoardTable_103.csv
Normal file
4899
example_data/OnBoardTable_103.csv
Normal file
File diff suppressed because it is too large
Load Diff
4415
example_data/TachymeterTable_103.csv
Normal file
4415
example_data/TachymeterTable_103.csv
Normal file
File diff suppressed because it is too large
Load Diff
65
tachymeter.py
Normal file
65
tachymeter.py
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
import csv, sys
|
||||||
|
from lib2to3.pgen2.pgen import DFAState
|
||||||
|
import plotly.express as px
|
||||||
|
import plotly.io as pio
|
||||||
|
import plotly.graph_objects as go
|
||||||
|
|
||||||
|
filename = 'example_data/TachymeterTable_103.csv'
|
||||||
|
|
||||||
|
# einfaches Beispiel: CSV direkt ausgeben:
|
||||||
|
#with open(filename, newline='') as f:
|
||||||
|
# reader = csv.reader(f)
|
||||||
|
# try:
|
||||||
|
# for row in reader:
|
||||||
|
# print(row)
|
||||||
|
# except csv.Error as e:
|
||||||
|
# sys.exit('file {}, line {}: {}'.format(filename, reader.line_num, e))
|
||||||
|
|
||||||
|
|
||||||
|
# Time,x,y,z,d,deltaT,SOG,RelTime,Beschleunigung,BeschleunigungDeltaTFix,ABSBeschleunigung
|
||||||
|
class Tachymeter(object):
|
||||||
|
|
||||||
|
def __init__(self, i, x, y, z, d, deltaT, SOG, RelTime, Beschleunigung, BeschleunigungDeltaTFix, ABSBeschleunigung):
|
||||||
|
self.index = i
|
||||||
|
self.x = x
|
||||||
|
self.y = y
|
||||||
|
self.z = z
|
||||||
|
self.d = d
|
||||||
|
self.deltaT = deltaT
|
||||||
|
self.SOG = SOG
|
||||||
|
self.RelTime = RelTime
|
||||||
|
self.Beschleunigung = Beschleunigung
|
||||||
|
self.BeschleunigungDeltaTFix = BeschleunigungDeltaTFix
|
||||||
|
self.ABSBeschleunigung = ABSBeschleunigung
|
||||||
|
|
||||||
|
def __init__(self, row, header):
|
||||||
|
self.__dict__ = dict(zip(header, row))
|
||||||
|
self.index = row
|
||||||
|
|
||||||
|
|
||||||
|
data = list(csv.reader(open(filename, newline='')))
|
||||||
|
tachies = [Tachymeter(i, data[0]) for i in data[1:]]
|
||||||
|
|
||||||
|
# for tachy in tachies:
|
||||||
|
# print(tachy.x)
|
||||||
|
|
||||||
|
fig = dict({
|
||||||
|
"data": [{"type": "bar",
|
||||||
|
"x": [1, 2, 3],
|
||||||
|
"y": [1, 3, 2]}],
|
||||||
|
"layout": {"title": {"text": "A Figure Specified By Python Dictionary"}}
|
||||||
|
})
|
||||||
|
|
||||||
|
# pio.show(fig)
|
||||||
|
|
||||||
|
# fig = px.line(tachies, x="x", y="x", title="Tachymeter Daten x, y")
|
||||||
|
# fig.show()
|
||||||
|
|
||||||
|
df = dict( {
|
||||||
|
"x" : [ 1, 2, 3, 4, 5],
|
||||||
|
"y" : [0.4, 2.3, 2.4, 2.7, 1.3]
|
||||||
|
})
|
||||||
|
|
||||||
|
fig = go.Figure(go.Line(x = df['x'], y = df['y'],
|
||||||
|
name='Position (x/y)'))
|
||||||
|
fig.show()
|
||||||
Loading…
Reference in New Issue
Block a user