follow ft86club on our blog, twitter or facebook.
FT86CLUB
Ft86Club
Delicious Tuning
Register Garage Members List Calendar Search Today's Posts Mark Forums Read

Go Back   Toyota GR86, 86, FR-S and Subaru BRZ Forum & Owners Community - FT86CLUB > Technical Topics > Software Tuning

Software Tuning Discuss all software tuning topics.

Register and become an FT86Club.com member. You will see fewer ads

User Tag List

Reply
 
Thread Tools Search this Thread
Old 07-10-2015, 11:49 AM   #1
burdickjp
Senior Member
 
Join Date: Jan 2015
Drives: 2013 ultramarine Scion FR-S
Location: Royal Oak, MI
Posts: 293
Thanks: 140
Thanked 137 Times in 70 Posts
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Data analysis and modification with Python

I've seen a number of tools for doing data analysis on here. Most are done with spreadsheets, which aren't conducive to large amounts of data. Others are written in Java, or .NET, which isn't bad, but isn't conducive to the end user wanting to learn not just what the tool does but how it does it.
Python is, by its nature, a human readable language, so I'd like to share with you how to do some data analysis in Python.

If you're running Linux you probably already have Python. We need the libraries called pandas and bokeh. I assume, since you are running Linux, that you know how to get these. I prefer using Python3.
If you're running anything else you can get an all-inclusive package called Anaconda which pulls everything in for you. Anaconda includes several environments for playing with Python. I prefer Spyder, as it has a variable explorer similar to MatLab. Think of it as being a MatLab environment, but better, because it's not MatLab.

Once you've got everything up, fire up Spyder. Throw this into the left pane and hit the green arrow. You'll want to edit line 13 to point to the log you'd like to use. Line 15 is the X axis of the graph. Line 16 is the Y axis.

Code:
# -*- coding: utf-8 -*-
 """
 Created on Thu Jul  9 22:06:52 2015
 

 @author: jeff
 """
 

 import pandas as pd
 from bokeh.plotting import figure, HBox, output_file, show, VBox
 

 output_file("graph.html")
 

 logRaw = pd.read_csv('log.csv')
 

 p1x = logRaw['time']
 p1y = logRaw['RPM']
 

 p1 = figure(tools="pan,wheel_zoom,box_zoom,reset,save", plot_width=1024, plot_height=600)
 p1.scatter(p1x, p1y, size=1, color="red", alpha=0.5)
 

 show(VBox(HBox(p1)))
I'll be updating this to include more awesome things like 3d graphs, etc. I'd eventually like to get MAF scaling tools and others ported to Python.

Last edited by burdickjp; 07-10-2015 at 04:51 PM.
burdickjp is offline   Reply With Quote
The Following 4 Users Say Thank You to burdickjp For This Useful Post:
aagun (07-10-2015), DAEMANO (07-10-2015), GT86_PRAGUE (07-13-2015), mkivsoopra (07-10-2015)
Old 07-10-2015, 04:09 PM   #2
Kodename47
Senior Member
 
Kodename47's Avatar
 
Join Date: Oct 2012
Drives: UK GT86
Location: UK
Posts: 3,040
Thanks: 185
Thanked 1,632 Times in 1,113 Posts
Mentioned: 156 Post(s)
Tagged: 1 Thread(s)
If I remove the top line I get this error:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb0 in position 24: invalid start byte

If I put the 1st line in I get:
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; } # -*- coding: utf-8 -*-
^
SyntaxError: invalid syntax
__________________
.: Stealth 86 :.
Abbey Motorsport/K47 Tuned Sprintex 210 Supercharger

Kodename 47 DJ:
Soundcloud / Instagram / Facebook
Kodename47 is offline   Reply With Quote
The Following User Says Thank You to Kodename47 For This Useful Post:
DAEMANO (07-10-2015)
Old 07-10-2015, 04:52 PM   #3
burdickjp
Senior Member
 
Join Date: Jan 2015
Drives: 2013 ultramarine Scion FR-S
Location: Royal Oak, MI
Posts: 293
Thanks: 140
Thanked 137 Times in 70 Posts
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quote:
Originally Posted by Kodename47 View Post
If I remove the top line I get this error:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb0 in position 24: invalid start byte

If I put the 1st line in I get:
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; } # -*- coding: utf-8 -*-
^
SyntaxError: invalid syntax
Try it now. That "p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }" was junk added in the posting process. If you open a blank spyder doc you'll see what the header is supposed to look like.
burdickjp is offline   Reply With Quote
The Following User Says Thank You to burdickjp For This Useful Post:
DAEMANO (07-10-2015)
Old 07-10-2015, 08:03 PM   #4
Kodename47
Senior Member
 
Kodename47's Avatar
 
Join Date: Oct 2012
Drives: UK GT86
Location: UK
Posts: 3,040
Thanks: 185
Thanked 1,632 Times in 1,113 Posts
Mentioned: 156 Post(s)
Tagged: 1 Thread(s)
This is what I've put entered:
Code:
# -*- coding: utf-8 -*-
"""
 Created on Thu Jul  9 22:06:52 2015
 

 @author: jeff
"""
 

import pandas as pd
from bokeh.plotting import figure, HBox, output_file, show, VBox
 

output_file("graph.html")
 

logRaw = pd.read_csv('C:\EcuTek\MapAccessLogs\Sprintex 70mm-01-03-2015.csv')
 

p1x = logRaw['Time']
p1y = logRaw['FLKC']
 

p1 = figure(tools="pan,wheel_zoom,box_zoom,reset,save", plot_width=1024, plot_height=600)
p1.scatter(p1x, p1y, size=1, color="red", alpha=0.5)
 

show(VBox(HBox(p1)))
I still get the same unicode decode error as above. Is it a log file length/format thing?
__________________
.: Stealth 86 :.
Abbey Motorsport/K47 Tuned Sprintex 210 Supercharger

Kodename 47 DJ:
Soundcloud / Instagram / Facebook
Kodename47 is offline   Reply With Quote
Old 07-10-2015, 09:09 PM   #5
phrosty
Senior Member
 
Join Date: Apr 2013
Drives: 2013 FR-S
Location: Seattle
Posts: 806
Thanks: 202
Thanked 321 Times in 199 Posts
Mentioned: 18 Post(s)
Tagged: 1 Thread(s)
Why do you believe Python is, by its nature, a more human readable language than the other ones you mentioned (Java and C#)?
__________________
2013 Whiteout 6AT FR-S | Perrin Inlet Tube + 2.75" CAI | OpenFlash Header | P&L Catback | 4.88 Final Drive | Dialed in OFT 2.0x Stage 2 E85 | 18x8 Enkei Raijin + 225/40 Michelin Pilot Super Sport | 17x7 Stock + 215/45 Michelin X-Ice Xi-2
phrosty is offline   Reply With Quote
Old 07-10-2015, 09:16 PM   #6
burdickjp
Senior Member
 
Join Date: Jan 2015
Drives: 2013 ultramarine Scion FR-S
Location: Royal Oak, MI
Posts: 293
Thanks: 140
Thanked 137 Times in 70 Posts
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quote:
Originally Posted by phrosty View Post
Why do you believe Python is, by its nature, a more human readable language than the other ones you mentioned (Java and C#)?
I'm not a programmer, so the specifics of it are lost on me. I know that python is much easier for ME to read and understand than other languages. The only c-like language I've seen as similarly easy is wiring (arduino programming). It's my understanding wiring handles a lot in the background to make it easier in the foreground.

There's a reason python is experiencing explosive growth in academia, science, and research. It's not necessarily on topic here, but I LOVE python and feel it's the right tool for this job.
burdickjp is offline   Reply With Quote
Old 07-10-2015, 09:17 PM   #7
burdickjp
Senior Member
 
Join Date: Jan 2015
Drives: 2013 ultramarine Scion FR-S
Location: Royal Oak, MI
Posts: 293
Thanks: 140
Thanked 137 Times in 70 Posts
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quote:
Originally Posted by Kodename47 View Post
This is what I've put entered:
Code:
# -*- coding: utf-8 -*-
"""
 Created on Thu Jul  9 22:06:52 2015
 

 @author: jeff
"""
 

import pandas as pd
from bokeh.plotting import figure, HBox, output_file, show, VBox
 

output_file("graph.html")
 

logRaw = pd.read_csv('C:\EcuTek\MapAccessLogs\Sprintex 70mm-01-03-2015.csv')
 

p1x = logRaw['Time']
p1y = logRaw['FLKC']
 

p1 = figure(tools="pan,wheel_zoom,box_zoom,reset,save", plot_width=1024, plot_height=600)
p1.scatter(p1x, p1y, size=1, color="red", alpha=0.5)
 

show(VBox(HBox(p1)))
I still get the same unicode decode error as above. Is it a log file length/format thing?
I'm not sure. Are you using anaconda with python 3 or python 2?
burdickjp is offline   Reply With Quote
Old 07-10-2015, 10:19 PM   #8
wbradley
Sarcastic SOB
 
wbradley's Avatar
 
Join Date: May 2012
Drives: '13 FR-S M6, '23 Volvo V60 CC
Location: Thornhill Ontario
Posts: 4,643
Thanks: 1,362
Thanked 2,858 Times in 1,642 Posts
Mentioned: 32 Post(s)
Tagged: 3 Thread(s)
Garage
Python: the programming language for Arduino.
Some cool project ts done with it. In the pinball machine hobby there are some real magicians. A guy named Ben Heck started with hacking game consoles and then controller U its for one off custom pinball machines.
Cool stuff.
__________________
5:AD kit, HKS V1+ S/C, ECUtek dyno'd, Ohlins MP20, Magnaflow cb, Revworks UEL, Topspeed overpipe, Pinnacle Ceramic tint, VG shark fin, HID's, yellow DRL's, full LEDs, red floor lights, Homelink mirror, trunk lid liner, Perrin LWCP, Valenti smoked, Flossy Grip Tape Shorty, GT86 plaque, lighted vanity mirror, Michelin PSS, Project mU +800, DOT4 fluid, 720 Form GTF1 17x8&9, stitched leather bits, EZ valve.
wbradley is offline   Reply With Quote
Old 07-10-2015, 10:24 PM   #9
burdickjp
Senior Member
 
Join Date: Jan 2015
Drives: 2013 ultramarine Scion FR-S
Location: Royal Oak, MI
Posts: 293
Thanks: 140
Thanked 137 Times in 70 Posts
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quote:
Originally Posted by wbradley View Post
Python: the programming language for Arduino.
Some cool project ts done with it. In the pinball machine hobby there are some real magicians. A guy named Ben Heck started with hacking game consoles and then controller U its for one off custom pinball machines.
Cool stuff.
I'm sure someone had python being compiled for arduino, but I'm most familiar with wiring and arduino. Again: right tool for the job. Wiring is great for it.

Sent from my XT1045 using Tapatalk
burdickjp is offline   Reply With Quote
Old 07-11-2015, 04:05 AM   #10
Kodename47
Senior Member
 
Kodename47's Avatar
 
Join Date: Oct 2012
Drives: UK GT86
Location: UK
Posts: 3,040
Thanks: 185
Thanked 1,632 Times in 1,113 Posts
Mentioned: 156 Post(s)
Tagged: 1 Thread(s)
Quote:
Originally Posted by bur****jp View Post
I'm not sure. Are you using anaconda with python 3 or python 2?
I downloaded Python 3. I literally installed and then ran Spyder as you suggested.
__________________
.: Stealth 86 :.
Abbey Motorsport/K47 Tuned Sprintex 210 Supercharger

Kodename 47 DJ:
Soundcloud / Instagram / Facebook
Kodename47 is offline   Reply With Quote
Old 07-11-2015, 04:19 AM   #11
coyote
Senior Member
 
coyote's Avatar
 
Join Date: Oct 2011
Drives: Slowly
Location: brisbane.qld.au
Posts: 1,064
Thanks: 212
Thanked 539 Times in 235 Posts
Mentioned: 21 Post(s)
Tagged: 1 Thread(s)
Python is great for this kind of stuff. I use it a lot.

Sent from my Nexus 6 using Tapatalk
coyote is offline   Reply With Quote
Old 07-11-2015, 06:47 AM   #12
burdickjp
Senior Member
 
Join Date: Jan 2015
Drives: 2013 ultramarine Scion FR-S
Location: Royal Oak, MI
Posts: 293
Thanks: 140
Thanked 137 Times in 70 Posts
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quote:
Originally Posted by Kodename47 View Post
I downloaded Python 3. I literally installed and then ran Spyder as you suggested.
There might be a bug with the current version of anaconda using Python3 and windows. Let me see what I can find.

Sent from my XT1045 using Tapatalk
burdickjp is offline   Reply With Quote
The Following User Says Thank You to burdickjp For This Useful Post:
Kodename47 (07-11-2015)
Old 07-11-2015, 07:10 PM   #13
Kodename47
Senior Member
 
Kodename47's Avatar
 
Join Date: Oct 2012
Drives: UK GT86
Location: UK
Posts: 3,040
Thanks: 185
Thanked 1,632 Times in 1,113 Posts
Mentioned: 156 Post(s)
Tagged: 1 Thread(s)
Quote:
Originally Posted by bur****jp View Post
There might be a bug with the current version of anaconda using Python3 and windows. Let me see what I can find.

Sent from my XT1045 using Tapatalk
I'm on Windows8 64 bit. Should I revert to python2?
__________________
.: Stealth 86 :.
Abbey Motorsport/K47 Tuned Sprintex 210 Supercharger

Kodename 47 DJ:
Soundcloud / Instagram / Facebook
Kodename47 is offline   Reply With Quote
Old 07-11-2015, 08:15 PM   #14
burdickjp
Senior Member
 
Join Date: Jan 2015
Drives: 2013 ultramarine Scion FR-S
Location: Royal Oak, MI
Posts: 293
Thanks: 140
Thanked 137 Times in 70 Posts
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quote:
Originally Posted by Kodename47 View Post
I'm on Windows8 64 bit. Should I revert to python2?
Give it a try. I booted into windows and got a similar error.
burdickjp is offline   Reply With Quote
 
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
BRZ MPG Data Analysis housecat BRZ First-Gen (2012+) — General Topics 30 02-14-2016 09:32 PM
Recognizing Brake Fade with Data Analysis GSpeed Tracking / Autocross / HPDE / Drifting 25 07-06-2015 01:42 AM
Help with School Assignment.(Programming with Python) Zaku Off-Topic Lounge [WARNING: NO POLITICS] 0 04-09-2013 03:55 PM
python vinyl wrapped interior panels Vonsamhain Cosmetic Modification (Interior/Exterior/Lighting) 26 10-14-2012 02:21 AM
Downloadable driving data/Toyota encourages modification nate89 Scion FR-S / Toyota 86 GT86 General Forum 22 03-15-2012 10:12 AM


All times are GMT -4. The time now is 01:41 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
User Alert System provided by Advanced User Tagging v3.3.0 (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.

Garage vBulletin Plugins by Drive Thru Online, Inc.