Latest / Talk Python To Me / #281: Python in Car Racing
Transcript
- 0:00I love to bring you stories of Python being used in amazing places outside the traditional tech silos of pure web development and data science.
- 0:07On this episode, you'll meet Robert Kane Repligal, who works on simulation and test software at Richard Childress Racing,
- 0:14the NASCAR team that just finished number one and two at the Texas Motor Speedway.
- 0:18You'll hear how Python is allowing them to model car behavior, airflow, and much more, faster than others using outdated tools.
- 0:26This is Talk Python To Me, episode 281, recorded July 22nd, 2020.
- 0:31Wait, wait, wait, wait. Normally, I'd play a little guitar riff right here to kick off the episode.
- 0:37But this episode is about racing and race cars, so let's kick it off with a different kind of instrument and note.
- 0:44Let's jump into a 2017 Indy Pro Mazda, a furlap around the storied Brands Hatch circuit, and let the engine notes be the music.
- 0:51This episode is brought to you by the music.
- 1:21Welcome to Talk Python To Me, a weekly podcast on Python, the language, the libraries, the ecosystem, and the personalities.
- 1:50This is your host, Michael Kennedy. Follow me on Twitter, where I'm @mkennedy.
- 1:54Keep up with the show and listen to past episodes at talkpython.fm, and follow the show on Twitter via at Talk Python.
- 2:00This episode is brought to you by Sonar Cube and Linode. Please check out what they're offering during their segments.
- 2:05This is a really fun episode. You're going to enjoy Kane's story.
- 2:09And if you're interested, you can find the full five-minute video that Drive Around Brands Hatch at talkpython.fm/hatch.
- 2:15Kane, welcome to Talk Python To Me.
- 2:17Thanks. Glad to be here.
- 2:19Yeah, it's awesome to have you here. I get to bring two of the things that I'm really passionate about together, racing and Python.
- 2:25All right.
- 2:25And you've got some really cool stories to tell, I could tell already. So I'm looking forward to having you on the show.
- 2:31Thanks for having me. I'm excited about it.
- 2:33Yeah, it's going to be a lot of fun. And I guess, as usual, let's just start at the beginning. How do you get into programming in Python?
- 2:39Well, it's a pretty long story. But I started off with, do you remember the basic game, Gorillaz? It was like Windows 3.1 and you threw the bananas that blew up.
- 2:50Yeah.
- 2:50Yeah.
- 2:51That's where I started. A friend of mine showed me how to get in there and hack the explosion side so I could never lose to my brother. So that was the intro. It at least got me started on looking at logic and reading code. And then my next project was actually programming my HP calculator. I don't know if you ever used one of those.
- 3:12You know, I got to admit, I was always a TI sort of person.
- 3:16Yeah.
- 3:17I didn't have the HP when I had the TI. Even I had one of those big widescreen TI-93s that had a Cordy keyboard in it. It was crazy.
- 3:25Oh, yeah.
- 3:25But yeah, I remember.
- 3:27No, this one goes back to the reverse Polish notation and everything else that everybody hated. But you were shamed if you had a TI in mechanical engineering. So everybody had HPs.
- 3:37But yeah, so I did a couple of scripts with that stuff, just mostly playing around. At Auburn, we studied Fortran 77. This was back in 96.
- 3:47You were in engineering?
- 3:48Yes.
- 3:49In mechanical engineering?
- 3:50I studied mechanical engineering in Auburn.
- 3:51Yeah. I was in chemical engineering for a year and I wanted to take C++ and they told me, no, no, no, you have to take Fortran. It's going to be the most important language you ever learned.
- 4:00Yeah. Yeah. And the older generation of mechanical engineers are still diehard Fortran.
- 4:07Interesting.
- 4:07One of the teams I worked with a few years ago, their simulation was actually written mostly in Fortran. And I mean, you can't argue with the processing speed of numerical calculations, which is all the sim really is.
- 4:19So yeah, it smokes.
- 4:20By the time I was like a sophomore year, I had moved on to MATLAB and most people were using MATLAB for their coursework and projects and things like that. So yeah, I was a big fan of MATLAB for a long time.
- 4:33And then all my graduate work, I did my master's at Purdue with a focus on vehicle dynamics and all my master's work was done in MATLAB. So got a pretty good amount of experience in that. I really like the scripting languages. I've done some Objective-C stuff and felt out of place, you know, with compiled code and not being able to really dig into it after using MATLAB for so long.
- 4:56So yeah, you can't just open up those APIs and have a look at them, right? They're binary.
- 5:01Right, right. Yeah. And so a lot of the problems that we work on in this industry, you have to explore the data a ton before you know what you're even going to do with the project. So the scripting is good for me. My coworkers that are the C-sharp and C++ guys shame me and tell me I'm not a real programmer, you know, so.
- 5:18But it's all in good fun. And I continued using MATLAB as I started my career. Ford Motor Company had pretty much all their stuff in MATLAB at the time. When I left Ford and went to Hendrick Motorsports to be the race engineer for the 24 car with Jeff Gordon, I was sadly, sadly depressed to not be given a license for MATLAB.
- 5:38So, I mean, they were doing everything in Excel and they were the ones who SIM runs in Fortran.
- 5:44Right.
- 5:44So it was the simulation, they used Excel as a GUI and then had this backend of Fortran piped in to run it. So it was pretty interesting because having the power of Excel where I can just click here and do some calculations was pretty useful.
- 6:00Yeah. Excel is really powerful like that, right? Except it's hard to follow the logic of it if you've got this formula that leads to that, which is back over there. And then there's a conditional, which jumps here.
- 6:09Oh, it's impossible. It's impossible.
- 6:11Yeah.
- 6:12I cringe when somebody sends me a big Excel sheet with all kinds of formulas all over the place. The logic of the structure of it is what makes sense. And I am not a fan of VBA, so I don't like getting in the backend of that either.
- 6:24But yet moving into the, you know, racing stuff, we'll spend a million dollars to try to make five horsepower, but we can't spend $2,000 on a MATLAB license to solve analytical problems.
- 6:34Yeah. I think that's the, I mean, that's the racing take on that story, but you hear and see that story all over the place. Like companies spending millions of dollars or there's millions of dollars of efficiencies to be gained, but like, no, no, no.
- 6:46You're going to use this crappy old computer that doesn't work that well. It's all locked down or you're going to not get a license to this thing or that thing because for whatever reason, it's right.
- 6:56It blows my mind how some of these, these sort of organizations can be like Pennywise pound foolish.
- 7:02Yeah. Yeah. And it's like, I had just finished simplified vehicle simulation optimization program as my masters. So I see the power of not even having to figure out what you want the car to do. You give the simulation, these limits of things that you want for the balance and for the travels and things. And you just say, go. And it finds the setups that will get you those vehicle outputs.
- 7:25And it's like, wow, that's still not really being done in the same way as what I was doing way back when.
- 7:32So when you're talking about simulations, is this like tire pressure, ride height, cambers, like the mechanical setup or something else?
- 7:39No, it's a full model, physical model of a vehicle. So the big modeling package right now is Demola, which is built on Modelica and it handles all the dynamics and vehicle parts, but there's still a lot more to it.
- 7:53When you want to have a nice GUI interface, you want to be able to output files. There's a whole realm of difficulty in putting this stuff together. It's pretty impressive that a lot of the teams develop their own in-house.
- 8:06Yeah.
- 8:36Get out of racing, actually, after I left Hendrick. Didn't really know what I wanted to do. You know, the schedule is just brutal in NASCAR. It's 38 events. And my last year on the road with a 24, we had 22 tests. So I was in town 31 hours a week.
- 8:51Wow.
- 8:51And I was in the shop working. And I mean, I was not having a good relationship. We were having problems. And it just got to the point where I got moved into the R&D group where I did only about half as much travel and got to work on some pretty cool projects doing experimental, I guess I should say, exhibition races.
- 9:13So, like, Dale Jr. Decides he's going to run the three car in Xfinity with his dad's old Wrangler paint scheme.
- 9:21Right.
- 9:21And they would work out a deal with Hendrick to make that race happen. And so I'd still get to do some race engineering, but I was mostly doing beta testing and breaking things because I had a reputation for being able to break any sim release.
- 9:37So they all went through me before it got released to the guys, you know, that were going to the track. So, but I still wasn't programming much. But through that, I got a lot of experience with user experience part of it.
- 9:48Like, just making suggestions to the simulation group of, hey, can we add this little calculator thing over here? And can we add this would be really useful for the race engineers at the track. And maybe I'm lazy, but I like software to work very easily and fluidly. And I hate doing a lot of clicking. And if it takes 75 clicks for me to get the sim to run, I am not a happy guy, you know?
- 10:15Yeah, exactly.
- 10:16But then moving on after that, I kind of did an about face and started doing lighting design for concerts. And I wasn't happy with the software that was available for that. So this is where I delved into the Objective-C part using Xcode with Course Composer and doing some video projection stuff and pretty fun stage lighting, motion lights, had some pretty cool little gimmicks. I always got frustrated at shows where they had lights and video, but the color schemes clashed.
- 10:43So I programmed mine where the projection mapping would follow the complementary color set of the lighting design.
- 10:52Oh, that's clever. That's cool.
- 10:53Yeah. And then I ran into the problem where not, you know, sometimes I would just do the projection stuff and there would be another lighting designer, but they wouldn't have an output that they could give me easily to receive what their color scheme was.
- 11:06So I started using a digital camera and I had an app that I had built for my iPad where I could pick from the video image and it would decode what that color of those pixels were.
- 11:18And then I had a little color matching deal that would match it up.
- 11:22So even if I didn't have that data coming in, really, I was solving problems. That's what I do. Right?
- 11:27Yeah, that's awesome.
- 11:28This portion of Talk Python To Me is brought to you by SonarCube.
- 11:33Here's something I get asked a lot.
- 11:35Once you've mastered the basics of Python, how do you keep building your skill of the language?
- 11:39Not everyone is lucky enough to have a well-versed mentor who can take the time to look over new commits and guide them in mastering the more subtle aspects of Python.
- 11:48That's where SonarCube static analysis comes in.
- 11:51SonarCube finds bugs, vulnerabilities, code smells, and security hotspots in your code.
- 11:56Every issue is presented in the context of the code with a detailed description of why it's a problem and code examples to guide you in making the fix.
- 12:04It's powerful, fast, and accurate out of the box.
- 12:07Oh yeah, and it's free.
- 12:09So learn more and download SonarCube today at talkpython.fm/sonar.
- 12:15That's talkpython.fm/sonar, S-O-N-A-R.
- 12:19Yeah, so I got back into racing.
- 12:22Obviously, the pay is pretty good compared to normal engineer's pay.
- 12:27So they drug me back in.
- 12:29I did a technical director role at a small team and then was still doing the lighting on the side.
- 12:35But then I moved on to, I got invited while I was still racing, I got invited to be an associate professor at UNC Charlotte, University of North Carolina, Charlotte.
- 12:44Oh, awesome.
- 12:45In mechanical engineering?
- 12:46It was in, they actually have a mechanical engineering motorsports division.
- 12:51Oh wow, that's pretty specific.
- 12:52That's awesome.
- 12:52Yeah.
- 12:53And so they try to prepare the students for getting out into the actual race industry, which is pretty much centered here in Charlotte, especially for NASCAR.
- 13:02Yeah, that's sort of the world headquarters for NASCAR, like Indianapolis is for Indy and maybe UK is for Formula One.
- 13:10Yeah.
- 13:10And I mean, it helps physically for all the teams to be close together because there's a lot of turnover between different teams and all.
- 13:19And, you know, as you go, not have to move all over the country to go to different places.
- 13:24It's just the length of my commute changes for what team I'm working with.
- 13:27Funny.
- 13:28Yeah.
- 13:29But so I started thinking a lot on designing this new vehicle dynamics class and how what I was seeing in other industries with this data science movement and machine learning stuff is that it's going to be the way of the future.
- 13:43I mean, there is no doubt about it.
- 13:45The gains that we're able to make by applying machine learning algorithms to this data is just leaps and bounds of what anybody could do in an Excel spreadsheet.
- 13:55And it's fast and it's fast to develop.
- 13:58And somebody can have a super great idea, but the three other engineers that are going to be using this tool, they want some small aspects of it changed, like how you break up the track, where you're looking at cornering forces and things.
- 14:13And so I felt like I wanted to make the class a lot like the vehicle dynamics class I took in my master's program.
- 14:20And it was heavily numerical based.
- 14:23It was all MATLAB.
- 14:24And so I just said, well, it's been a few years since I used MATLAB, but I'm sure it can't be hard to relearn.
- 14:29So while I was on a full travel schedule again, I was staying up till one and two in the morning, just making toy projects and doing tutorials and trying to get my class together.
- 14:40Cause I only had two months to have not only skills enough to teach the material, but I had to write the whole course.
- 14:48I had to write all the homework assignments.
- 14:50I had to write all the tests.
- 14:51Wow.
- 14:51And I think I was getting like four hours of sleep there for that two months period.
- 14:55And then when I finally had the class done, I slept for like 24 hours straight and it doesn't help.
- 15:02You still just wake up tired, you know?
- 15:04Wow.
- 15:05But I had a lot of great feedback.
- 15:06You know, they had never even had a MATLAB class.
- 15:09Any of the students, they don't teach that in the department.
- 15:12And so they were all learning from scratch.
- 15:14And one of my TAs, he loved it so much.
- 15:18He took my class the first semester and then was my TA the second semester.
- 15:23And he came to me like halfway through his semester.
- 15:26And he's like, I almost had my whole thesis research work redone in MATLAB because he was trying to use Excel to process engine data that was recording at like a thousand hertz.
- 15:38You know, 50 channels at a thousand hertz.
- 15:41He had these spreadsheets that were just massive.
- 15:45And I mean, Excel can't handle that.
- 15:47Yeah.
- 15:47The document too large or whatever.
- 15:49Like it only does five minutes at a time.
- 15:51Who knows?
- 15:51Yeah.
- 15:52And he redid it and he was just so proud of himself.
- 15:55And I mean, I was proud for him because that is a big thing to take the semester you're about to graduate and just start at ground zero.
- 16:02Yeah.
- 16:02But to have the skill to be able to do that and make it happen is pretty good.
- 16:07He actually ended up taking a job at Caterpillar designing huge diesel engines for the earth moving equipment.
- 16:13Okay.
- 16:14Yeah.
- 16:14Yeah.
- 16:14Caterpillar is doing a bunch of stuff with Python.
- 16:16Oh, yeah.
- 16:17Yeah.
- 16:18Actually, Caterpillar is one of our sponsors too.
- 16:20I don't know if you knew that for our team.
- 16:22No, I didn't know that.
- 16:23Yeah.
- 16:23They were telling us, I met with some of the guys.
- 16:26We were comparing machine learning notes and he was telling us about their division that does all the reliability testing and things.
- 16:34So they have all their trucks instrumented.
- 16:37And as they're going out, they're beaming the data up to a satellite and beaming it back to their data science department and processing it and trying to figure out when these engines are going to fail in a certain way.
- 16:49Wow.
- 16:50Yeah.
- 16:50It's pretty impressive how industry has really latched onto the data science, but racing still lagging behind, I feel.
- 16:57But we still haven't got to my Python.
- 16:58Well, you know, one of the things...
- 17:00That's right.
- 17:01Bo, just one quick comment.
- 17:02I think the type of software that you're talking about is really interesting challenges.
- 17:06I got to work in this for a while as well, where it's event-based, like human event-based.
- 17:10Yeah.
- 17:11Right.
- 17:11We're going to go to the track and on Saturday, the software has to work because we're going to run the simulation in the morning and apply it in the afternoon.
- 17:20And if it doesn't work, it's not like, well, we'll fix the bug next week or we'll push that to the next sprint.
- 17:24Like, yeah, that was the Daytona 500 and it didn't work.
- 17:28So you missed it.
- 17:28Oh, yeah.
- 17:29Tell me about it.
- 17:29I mean, and it's even worse than that.
- 17:31What I always tell all the young engineers that I've trained is there's really two things you need to do to be successful in the racing industry as an engineer.
- 17:40The first thing and foremost is you need to remember that the decisions you're making on this car are going to potentially affect somebody's life.
- 17:48I mean, much less you could crash the car.
- 17:50You could crash the car and hurt the driver.
- 17:52You could kill the driver.
- 17:53You could crash the car so bad that parts go through the catch fence and hurt fans, which has happened before.
- 17:59And so I always try to make sure that they understand the impact that they could have.
- 18:04But when it comes to the key talent that you need, it's measuring disappointment because it doesn't matter how hard you try.
- 18:13You can show up to the racetrack with the fastest car and be the fastest in every practice and qualify on the pole and lead the most laps of the race.
- 18:23And then by no fault of your own, cut a tire, plow into the fence and your whole weekend.
- 18:28Now, no matter how good it was to that point, you're a failure now.
- 18:33You know, and yeah, absolutely.
- 18:35Yeah.
- 18:35I see a lot of the young people really have a problem battling with depression.
- 18:39And I mean, I tell this story as kind of a joke in a way, but it's serious.
- 18:44And it's easy to get disgruntled and like think of yourself as a failure in this industry.
- 18:50Yeah.
- 18:50I can imagine.
- 18:51I mean, you have to set your expectations right.
- 18:54Stuff's going to happen.
- 18:55Things are going to go wrong.
- 18:56Right.
- 18:57Sometimes your fault, sometimes not.
- 18:58Sometimes finishing in the middle is something you've got to be proud of and not like seen as a failure or whatever.
- 19:04Right.
- 19:05Like it just I think it does take that mental sort of not necessarily toughness, but just setting the expectations in a real way.
- 19:12Absolutely.
- 19:14It seems really frustrating.
- 19:15Like you spend the whole weekend.
- 19:16Someone takes you out in the first corner of the race.
- 19:18It doesn't matter how good your simulation was.
- 19:19Nope.
- 19:20You you're packing it up and you're going back home.
- 19:22Yeah.
- 19:23Yeah.
- 19:23And there's a few other aspects of it, too, where I mean, we're a team.
- 19:27Right.
- 19:28So if one guy gets down on the team and you're riding back to the hotel in your your minivan and he makes some comments about how bad practice was that day or something that affects everybody around you.
- 19:41And so having that positive mental attitude is the only way to be successful.
- 19:46And I mean, I've definitely learned a lot through my career, which is why I try to share that.
- 19:51But in my earlier days, it was rough.
- 19:53I was not a good teammate and would say harsh things and I would have harsh things said to me.
- 20:00Yeah.
- 20:00But back on the Python track, since we still haven't made it there.
- 20:03So after I had my son, I couldn't do working on a race team full time and teaching classes.
- 20:09So I had to quit the UNC Charlotte job and I loved it and love my time with MATLAB.
- 20:14But then I lost my license because I was on an educational license.
- 20:18So I had to look at the landscape of like, what do I want to do at Richard Children's Racing?
- 20:23We had some legacy licenses at the time, but they were so old that going back and relearning what the syntax changes were was not really something that I had any interest in.
- 20:35And now we've actually upgraded and we have plenty of MATLAB licenses as well.
- 20:38But I've put so much effort into my Python experience and I just love it.
- 20:42I mean, it's clean.
- 20:43Yeah.
- 20:44My code is beautiful.
- 20:45I love PEP 8.
- 20:46I love black.
- 20:47Oh, yeah.
- 20:48And just not even having to think about the white space and how I do my continuation lines.
- 20:53And I mean, just every aspect of it.
- 20:56I really, the most surprising thing to me is that Python didn't show up on my radar during my entire career up until three years ago.
- 21:05Yeah, that is pretty interesting.
- 21:06Yeah.
- 21:06Because just nobody in my industry used it.
- 21:09But yeah, so I've kind of gone full tilt on the Python kick, probably done 20 or 25 online courses and everything that's on the Kaggle page.
- 21:19Been working on the fast AI.
- 21:22I think you interviewed Jeremy Howard, who is just an amazing teacher, has an amazing teaching style.
- 21:28You can't not like the guy.
- 21:29Yeah, awesome.
- 21:30Yeah, I don't think I have interviewed him.
- 21:31I should.
- 21:32But yeah, fast AI is cool.
- 21:34Yeah.
- 21:34And clean.
- 21:35And I was already using PyTorch and it works on top of PyTorch now.
- 21:39Okay.
- 21:40So maybe give me a perspective now that you're three years in.
- 21:43You're not new to the Python world at all anymore.
- 21:47Some of the stuff we're going to talk about that you've been doing, it's incredible.
- 21:49But it's still pretty fresh in your mind, I suspect.
- 21:51Coming from this commercial MATLAB, every little aspect of a library, every toolkit I want to use is like another $1,000 in a negotiation with a purchasing side of my company.
- 22:03Versus if you can find it on GitHub or on PyPI and it works decent, now that's another thing you can do.
- 22:11It feels like the world is more open to just doing what you want to solve your problem.
- 22:15Well, and I think to put that even further, I would say that the competition level is really interesting with open source.
- 22:23Because as you see some new idea come out, you might see a package start and then another flower pops up somewhere else.
- 22:31And the contributors look at each other's work and they're like, okay, I'm going to come work on yours now.
- 22:35Yeah.
- 22:36You know, and just like abandon that space if somebody comes out with like a better approach to solving some issue.
- 22:42And I think that that is a powerful thing that these commercial softwares can't compete with.
- 22:47Right, exactly.
- 22:48And they definitely can't compete with all the free help that people give.
- 22:53Yep.
- 22:53Absolutely.
- 22:54That's really, really interesting.
- 22:55So let's talk really quickly just about like some high level stuff in racing.
- 22:59I want to keep it a little bit focused just so we can spend a lot of time on the Python that you're riding, the simulations you're doing.
- 23:04But just give us a sense of what type of data you're collecting.
- 23:08You know, is this during the race you're tracking like tire wear or is it speeds or are you trying to simulate when you should pit?
- 23:17Like what kind of stuff are you guys doing?
- 23:19Yeah, pretty much most of that.
- 23:21We're limited during the race.
- 23:23NASCAR has, they issue us a data logger and it is nothing that you can really mess with.
- 23:30And it only has certain channels.
- 23:32So we're only allowed to have a few channels during the race, you know, GPS location.
- 23:36So lat, long, elevation type stuff.
- 23:39A few basic driver things.
- 23:41So you'll have brake pressure, throttle position, and steering wheel angle.
- 23:45Everything he's doing, he controls with those three things.
- 23:47So, I mean, other than shifting gears, but most of the time we don't even shift gears on track because you get to fourth gear.
- 23:53And that's where you stay for the whole lap.
- 23:55Unless you're on a road course, yeah.
- 23:56Yeah.
- 23:57But during tests, we might have a small test where we just have like 50 instruments where we're actually tracking damper travels for the suspension, all kinds of engine things.
- 24:08Air flows through the radiators.
- 24:10Air flows through brake ducts, you know, if we're running out of braking track.
- 24:15We have these things called wheel force transducers that are like the top of the line.
- 24:19They're the most expensive sensor.
- 24:20So you typically actually detune your car when you go test with this because you don't want to risk hitting the wall.
- 24:28But it measures the three directions of force, three directions of torque, tire pressure, tire temperature.
- 24:34And so there's quite a few sensors on just that one tire.
- 24:37You know, we'll use pitot tubes mounted to the roof to track airflow across the top of the roof.
- 24:43So we can look at the pressure difference there.
- 24:45There's inside the engine, there's just a hundred things that you could do.
- 24:49So the data system, the data person job is pretty demanding as well.
- 24:54Yeah, it sounds like it.
- 24:55But the system we use for the races is pretty small.
- 24:59It's pretty lightweight.
- 24:59So it's not a big deal.
- 25:00Yeah.
- 25:01And then, I mean, not to mention we go to the wind tunnel.
- 25:04I don't know if you've seen the wind shear wind tunnel, which is what we use most of the time, but it's a...
- 25:09Yeah, I don't think so.
- 25:09Maybe tell people about it.
- 25:11Yeah.
- 25:11Yeah.
- 25:11It's a 180 mile an hour rolling road wind tunnel.
- 25:15Like a treadmill, but that goes 180 miles an hour.
- 25:18It's a treadmill with a $300,000 stainless steel belt.
- 25:22Oh my goodness.
- 25:23Okay.
- 25:23You know, and so there's force pads under the belt to measure the weight on the tires.
- 25:30And you're also trying to capture the wind speed through the radiator and that kind of test too.
- 25:36And you don't want to mess with that belt because it's very expensive.
- 25:39But 180 miles an hour is the...
- 25:42I believe it's still the fastest wind tunnel in the world.
- 25:44Wow.
- 25:44That's pretty awesome.
- 25:46And I love when we do a wind tunnel test because I only live about three miles from
- 25:50the wind tunnel and I live 40 miles from the shop.
- 25:53So it's much nicer commute, but then I don't get to listen to as much podcast.
- 25:58Yeah, that's true.
- 25:59That's definitely a drawback.
- 26:00But yeah, a three mile commute is pretty sweet.
- 26:02Yeah.
- 26:03So one of the things that you actually have been spending a lot of time lately is applying
- 26:07Python and scikit-learn to this wind tunnel data, right?
- 26:12Oh yeah.
- 26:12We had an aerodynamicist leave at the end of 2018 who managed the wrangling of all the data
- 26:22from the raw wind tunnel data into what our sim needs to ingest to do all of its calculations.
- 26:29And he kind of left all of a sudden.
- 26:33And so I wasn't that busy.
- 26:35And so I was just like, hey, pick me.
- 26:37And so I took it over.
- 26:38And I have to say that the system that they were using for all this wind tunnel data in
- 26:43Excel was a nightmare.
- 26:45And so our manufacturer, General Motors, had been working with a company to develop a new
- 26:51fitting algorithm to fit this data.
- 26:53You have to imagine this data is four dimensional.
- 26:56So you have two travel things on the body that tell you the attitude of your car.
- 27:03And then you have the yaw angle that your car is to the wind.
- 27:06And then you have roll.
- 27:07Right.
- 27:08Okay.
- 27:08So it's a 4D fit problem.
- 27:10So they're kind of struggling with getting the accuracy that we were trying to demand.
- 27:15And their system, the workflow was pretty hairy and a lot of manual cutting and pasting and
- 27:21putting it into a form that you needed.
- 27:23And I got so fed up with it, with this wind tunnel a few months ago that I said, you know
- 27:28what?
- 27:28There's another guy who's helping with this now.
- 27:30Hey, you start with their stuff and try to do it, mash it through.
- 27:35And I'm just going to write a new script in Python and let's see who finishes and what
- 27:39the results are.
- 27:40And so, you know, at first I was really nervous because it was like the first time I was
- 27:44the first time I had tried to fit a four dimensional surface like that in Python.
- 27:49And at the end of the second day, I had improved the accuracy of the fit by five times.
- 27:55Wow.
- 27:56In some parts of the map.
- 27:57And just...
- 27:58500% improvement.
- 28:00That's insane.
- 28:00Yeah.
- 28:01I'm like, you know, but where it missed, it missed really bad.
- 28:05It wasn't bad everywhere.
- 28:06Okay.
- 28:07But where it missed, it was really bad.
- 28:08So I might've had, we talked wind tunnel terms in terms of counts, which is the coefficient,
- 28:14but they might have an error at some point of the map of 80 counts.
- 28:19And I might have an error of one count or two counts at that same point.
- 28:23And so the support vector regression algorithm inside Git Learn is phenomenal and so easy to
- 28:30work with.
- 28:31And it fits super fast for the amount of data that we're using.
- 28:33But yeah, I think another interesting aspect of that project is the other aerodynamicists
- 28:39I was working with who kind of went on and got the headaches of the other package.
- 28:44You take the bumpy road.
- 28:45Yeah.
- 28:46When he came back, well, I had been doing it for almost three years at that point,
- 28:50two and a half years.
- 28:51So I had suffered enough, but yeah, he came back and I showed him what I was doing.
- 28:56And he was struggling with his sheet that he uses in the wind tunnel of his Excel sheet locking
- 29:02up and things like that.
- 29:03And so we had a few discussions back and forth about MATLAB versus Python and everything else.
- 29:09And I showed him the code for the aero map fitter that I built.
- 29:14And he was like, I'm sold.
- 29:16That looks so easy.
- 29:17That looks so easy.
- 29:19And so he actually jumped on board and has been working on this project to replace his thing.
- 29:26And he finished it last week and used it for the first time in the wind tunnel last week.
- 29:30So kudos to him.
- 29:32That's a pretty good advancement.
- 29:34Yeah, that's a big achievement.
- 29:35Yeah.
- 29:35In a two month span, you know.
- 29:37Yeah.
- 29:37Wow.
- 29:38But he also had a good teacher, I guess, since he calls me up.
- 29:42But one thing that you talk about on the show a lot is the imposter syndrome.
- 29:46And I have to say that that hits me right in the heart because every project I do,
- 29:52I've got to learn something new to finish the project.
- 29:54And it's like, when will I ever know enough to just sit down and not have to pull up the
- 30:00documentation on some package or something?
- 30:03And it kind of gets to you after a while.
- 30:07You get stuck on some pandas.
- 30:09I forget what it's called now.
- 30:10It's like, it's where pandas is trying to make, pandas thinks you're trying to make a copy of data.
- 30:16But what you're really doing is pointing to the same spot in memory.
- 30:21Right.
- 30:21So you're going to run into problems when you change the one thing and now the other thing changes.
- 30:27And that kind of stuff is hard to get your head around when you come from the MATLAB space.
- 30:31So he has lots of errors like that.
- 30:33But, you know, having my coworker come to me and show me what he's struggling with and me let, you know, just have that.
- 30:39Wow.
- 30:40I remember struggling with that.
- 30:42Here's how you fix it.
- 30:43Yeah.
- 30:43And that really takes away a lot of the imposter part when you can provide so much help so quickly without any effort.
- 30:49That's a great point because so often you're pushing the edge of the envelope, trying to do more and more with your current skill set.
- 30:55So you always are pushing against that edge and always.
- 30:58Right.
- 30:58You got to feel that like that struggle.
- 31:00But then you get a chance to look back and help others.
- 31:03You're like, oh, actually.
- 31:04This is easy.
- 31:05I clearly see what you need to do.
- 31:07I remember this was hard, but it doesn't feel hard anymore.
- 31:10Yeah.
- 31:11Great.
- 31:11Well, and, you know, in the racing industry, I mean, I have data that I'm processing that comes directly from NASCAR.
- 31:17I have the track data that's coming from multiple sources.
- 31:20I have the wind tunnel data that's coming from source.
- 31:23Your joke about, I think it was you or Brian said the joke about 80% of a data scientist's job is wrangling data and getting it into the right form.
- 31:33Yeah.
- 31:34And 20% is them complaining about spending so much time wrangling the data.
- 31:38I definitely have been accused of that because I will complain.
- 31:42But again, you have all these different sources that you don't control.
- 31:47And so when you have a sheet, a data file being delivered to you that changes size in all different aspects, every week, depending on the track, it has different widths and different lengths and all this stuff.
- 32:00And dealing with that by hand is just a nightmare.
- 32:04So Python's been a definite blessing with regards to that.
- 32:09This portion of Talk Python To Me is brought to you by Linode.
- 32:12Whether you're working on a personal project or managing your enterprise's infrastructure, Linode has the pricing, support, and scale that you need to take your project to the next level.
- 32:21With 11 data centers worldwide, including their newest data center in Sydney, Australia, enterprise-grade hardware, S3-compatible storage, and the next-generation network, Linode delivers the performance that you expect at a price that you don't.
- 32:36Get started on Linode today with a $20 credit and you get access to native SSD storage, a 40-gigabit network, industry-leading processors, their revamped cloud manager at cloud.linode.com, root access to your server, along with their newest API and a Python CLI.
- 32:52Just visit talkpython.fm/Linode when creating a new Linode account and you'll automatically get $20 credit for your next project.
- 33:00Oh, and one last thing.
- 33:01They're hiring.
- 33:02Go to linode.com slash careers to find out more.
- 33:05Let them know that we sent you.
- 33:06I can imagine.
- 33:09And, you know, the version of the software changes or you go to the track the next time.
- 33:13They're like, oh, we've changed the format of this or we've added a column or taken away a column.
- 33:17And you're just like, oh, great.
- 33:19Here we go.
- 33:20Yeah, constantly.
- 33:20Oh, and they always would add the column.
- 33:23They don't add it at the end.
- 33:24So, in Excel, where you had all your formulas related to that cell, now that cell is not the same data anymore.
- 33:31And you got to go through and change all your formulas again.
- 33:34And, oh, man, it's just...
- 33:35Like halfway through the session, it's changed or something.
- 33:38Yeah.
- 33:38Or, you know, it's a data stream.
- 33:42So, maybe the data is just not coming in anymore.
- 33:44Like, it just...
- 33:45You missed a packet.
- 33:45Yeah.
- 33:46Like, what do you do then?
- 33:47And, you know, or there's a big section of blank.
- 33:50Yeah.
- 33:50So, dealing with that with pandas is just a dream come true because it has like the drop NAs that just gets rid of all the NAs.
- 33:58Or, you can replace all the NAs with a zero or whatever kind of makes sense for whatever that entity is.
- 34:03And especially for the amount of data that we're processing from a race event where the data is all being recorded at 20 hertz.
- 34:10Right.
- 34:11For hours?
- 34:11It's a four-hour event with 10 channels at 20 hertz.
- 34:16Oh, and NASCAR releases all 40 cars data.
- 34:19So, everybody had...
- 34:21So, you don't just have your two cars that are in the race.
- 34:23You've got the 40 cars that are in the race.
- 34:25That's interesting.
- 34:26And do you do a lot of analysis on the competitors' cars?
- 34:29Yes.
- 34:29I can imagine.
- 34:30Yes.
- 34:31Quite a bit.
- 34:32We're actually...
- 34:33Right now, what I'm gearing up to do is do a full suite of dashboards to try to get the hands into...
- 34:41Or the data in a usable format into the hands of the less technical people.
- 34:45Or even the technical people who just don't have Python experience.
- 34:49It's been hard for me to provide them with it.
- 34:53It's mostly them sending me work orders where it's like, hey, can you run this on these files?
- 34:58I need this report.
- 35:00Yeah.
- 35:00Give me the report.
- 35:01Yeah.
- 35:02And so, you had done...
- 35:03I guess it's been a couple months ago.
- 35:05You had the guy from Streamlit on.
- 35:07Yeah.
- 35:07Adrian on from Streamlit.
- 35:09Yeah.
- 35:09Adrian.
- 35:09Yeah.
- 35:10And I had been working with Plotly and Dash.
- 35:13And I think for the end polish product, maybe you can make it look nicer with Dash still.
- 35:19But you have to do all the CSS programming.
- 35:22I mean, who really wants to do all that stuff?
- 35:24So, I actually downloaded Streamlit today for the first time and started working with this afternoon.
- 35:31And I've already got a dashboard built that is functioning with the lap data.
- 35:35Oh, that's cool.
- 35:36Plotting out lap times.
- 35:37And I mean, it is just...
- 35:39It is...
- 35:40Wow.
- 35:40What a simple thing.
- 35:41Yeah.
- 35:41So, for those folks who haven't heard about Streamlit or didn't listen to that episode,
- 35:46I'll give my take on it.
- 35:47You can give your take on it.
- 35:48So, the idea is you take something that would be just a top-to-bottom regular script.
- 35:53Maybe it has functions.
- 35:54Maybe it doesn't.
- 35:56And you want to turn that into an interactive website.
- 35:59That sounds like a very far bridge to cross.
- 36:01But the way Streamlit works is it does a bunch of magic to give you stuff that you just put into your script.
- 36:07And then it turns that into interactive dashboards with sliders and drop-downs and search fields and all kinds of stuff.
- 36:14And integrates with Plotly and other tools as well.
- 36:17Yeah.
- 36:17It's pretty slick, right?
- 36:18It's really slick.
- 36:19And one of the things that I'm surprised Adrian didn't really touch on, or maybe he did and I just didn't recall,
- 36:25it works similar to...
- 36:27I do a lot of stuff in Jupyter Notebook.
- 36:29So, I'm always wanting to review my data.
- 36:31So, I create a data frame and then it's df.head so I can see and make sure that it's in the right form and stuff.
- 36:38And Streamlit does that and it puts it on your webpage.
- 36:41So, you don't even have to tell it st.table or whatever.
- 36:45You just put the data frame, you know, just data frame.
- 36:48And then, bam, it's on your page.
- 36:50Nice.
- 36:51Anything that is a variable that is on a line by itself, it just assumes you want it to put that output to the HTML.
- 36:58And, I mean, how awesome is that?
- 37:00I mean, this is like the best, laziest package I've ever seen.
- 37:04Productivity, productive laziness or something like that.
- 37:08There's got to be a term for it.
- 37:09Yeah.
- 37:09And working with it for the few hours that I did and to already have a dashboard that doesn't look great,
- 37:16but is functioning, I think is pretty impressive.
- 37:20Yeah, yeah, it definitely is.
- 37:21So, this is something you could publish for people to interact with more real-time data or so they don't have to bother you.
- 37:29They can go do the slider themselves or select the thing themselves and they get the answer, right?
- 37:34Yeah, exactly.
- 37:35And sometimes too many opinions is too much, definitely in racing, because everybody's making decisions from partial information.
- 37:43But I still think getting tools like that into as many hands in front of as many eyeballs as possible has got to be an improvement of somebody noticing something that the other people haven't noticed yet.
- 37:57And hey, what's with this?
- 37:58Or hey, look at this correlation.
- 38:00You know, if you do this output metric versus your finishing position and you see a trend of spring rates and things, having all those people poke around at this stuff, because we do have,
- 38:12I think our simulation has 634 user inputs right now.
- 38:18So, and some of those aren't, some of those are not stuff that you touch all the time.
- 38:24A lot of them aren't.
- 38:25But there's about 275 things that you set in the model to actually be able to simulate a car.
- 38:30And it gets worse every day because things keep getting added to it, right?
- 38:34So-
- 38:35Right, right.
- 38:35Different knobs you can turn, different adjustments you can make.
- 38:38Yeah.
- 38:38And everything's interactive.
- 38:40It's a dynamic system.
- 38:41It's not a dynamic part.
- 38:43You can't change this spring and change, you can't change one thing and get any benefit.
- 38:49You have to change a system of parts.
- 38:51Right.
- 38:52You change the springs to make them softer, that changes the ride height, which changes the aerodynamics, which changes the wind pressure or whatever, right?
- 38:59Like it's all-
- 39:00Exactly.
- 39:00It's like a whack-a-mole.
- 39:01You change one thing, it's going to change a bunch of others.
- 39:03Yeah.
- 39:04Yep, exactly.
- 39:05And you'll have crew chiefs that'll come to you, you know, in eight minutes left in practice and want to change these five things and expect you to know how to set the other things to keep your car from crashing into the ground.
- 39:18So it better run quick.
- 39:20Yeah.
- 39:20Yeah.
- 39:20So how do you run these things?
- 39:22Is it computationally slow or do you just have a lot of hardware or is it not actually that bad?
- 39:26Yes.
- 39:28So it depends.
- 39:32There's a different aspect.
- 39:33There's the full dynamic model and that needs to solve at a thousand hertz.
- 39:38So that's a lot of data.
- 39:39So that's a lot of data, a lot of decisions being made for how all these parts are moving on the suspension and everything, how the car is sliding with the tires across the pavement.
- 39:49That I won't say is slow, but it's way slower than a steady state model, which is getting rid of all the dynamics, basically using a set of data inputs that are super simplified and only solving at 10 hertz.
- 40:08So you don't get the same answer.
- 40:10So you don't get the same answer.
- 40:11Right.
- 40:12But like in a case where you need to make a decision really quick and like right now, that is a great tool to have as well.
- 40:17Right.
- 40:18If you can get an answer that you're 90% sure of in the next 14 seconds, that is way better than getting an answer that you're 95% sure of in 42 minutes.
- 40:30Yeah.
- 40:31It's exponentially.
- 40:32As you get your accuracy, you pay with money, you pay with computational time, you pay with losing the engineer's focus.
- 40:40The longer he has to sit there twiddling his thumbs, like he's daydreaming about what he's going to do when the track closes or whatever, you know?
- 40:47Right.
- 40:47It's easy to lose yourself when you're running 200 sims a week.
- 40:51Yeah, I can imagine.
- 40:52Wow.
- 40:52So one thing I've been thinking about as we're talking is all these different inputs, trying to notice what correlations there might be.
- 41:01You have access to a lot of the different cars and whatnot.
- 41:04It seems like there's probably a lot of machine learning stuff that you could potentially apply here.
- 41:09Like what's the story of machine learning in your world?
- 41:12I think it is the future.
- 41:13So when I say we have a lot of data, most of our projects, it's not what most people like big data guys would think is big data.
- 41:23We don't have a lot of places where we can do like deep learning applications because we just don't have enough of the data that fits in this box.
- 41:32We're trying to get very specific answers.
- 41:36And even though you have a race with four hours of data, there's a ton of data in there that's completely worthless because the caution came out.
- 41:44Right.
- 41:44You can't feed that to a training system when over two different races where one part you did that stint with no yellow flag.
- 41:53Obviously, higher pressures and temperatures will change.
- 41:56The amount of fuel used has changed.
- 41:58All those things are just like they're not comparable, right?
- 42:00Yeah.
- 42:00There's a few places that we've used some deep learning.
- 42:03Okay.
- 42:04Some photo stuff.
- 42:06General Motors provides a photographer to the track.
- 42:09Well, during the pandemic, they don't always.
- 42:11But they provide a professional photographer to the track to take pictures of all your other cars, all the cars on track.
- 42:17So you can say, well, here's their attitude on track and here's our attitude and we're doing it wrong because they're faster than us or whatever.
- 42:24But over a weekend, you have about 7,000 photos taken and to go.
- 42:30And of course, it comes in with the file name of whatever the camera is set up to produce, which is pretty much meaningless when you want to find all the pictures of the 18 car.
- 42:41Right.
- 42:42And so you have to look at skim through all these thumbnails of these mixed cars because everybody's on track at the same time.
- 42:49So it's not like they're grouped together in any way.
- 42:52So one good application is to use NeuralNet to, yeah, I guess I should say convolutional NeuralNet to look at these photos and write new file names and organize them into folders and just take the manual drudgery out of that kind of thing.
- 43:07All right.
- 43:08Maybe even create a dashboard that says, I want to look at this car and I need to look at it from the side so that I can understand how much it's like tilting forward or whatever, right?
- 43:18The rake.
- 43:19So show me that.
- 43:20Show me that for this car.
- 43:22You could probably build that with Streamlight.
- 43:23That's a great idea.
- 43:24I think I'll build that next week.
- 43:25There you go.
- 43:26What's crazy is like, I mean, you're joking.
- 43:30It theoretically could be a couple of weeks, whereas like 10 years ago, that was like, we're going to need 50 years and a million dollars of research and like a bunch of PhDs.
- 43:41And now it's like, maybe we'll do that in this little app.
- 43:43Yeah.
- 43:43Our cute little app.
- 43:45Yeah.
- 43:45So a lot of the performance stuff, we have enough data during the race to use some deep learning.
- 43:50But I really think the simpler just regression analysis and classification analysis types of things where you're looking at data.
- 44:00You take all the metrics of output of these different cars and you split it up around the track.
- 44:06And then you train a fairly simplified model on what do the fast cars have in common?
- 44:11What do the slow cars have in common?
- 44:13And let's not be like the slow cars because there is so much data.
- 44:18It's hard to say what knob does matter.
- 44:20What knob is the crucial thing?
- 44:22So that's the direction we're going.
- 44:24And I'm excited about it.
- 44:26Building some new skills and being given the opportunity to apply them in so many different aspects of the job is just huge.
- 44:33Keep it.
- 44:34Keep me motivated.
- 44:35Keep me motivated.
- 45:05Or ditch that unused subscription for our course bundles, which include all the courses and you pay about the same price as a subscription once.
- 45:12For details, visit training. talkpython.fm/business or just email sales at talkpython.fm.
- 45:21Yeah, I can imagine.
- 45:22And racing is one of those things that's pretty interesting because there's a lot of bespoke engineering that happens.
- 45:29Like one-off custom engineering.
- 45:31Yeah.
- 45:32There's a team of people that are building stuff and adjusting stuff.
- 45:35It's not like, well, these are the three things I can get from the parts store.
- 45:38I'm going to stick on here.
- 45:39Like, you guys are like, well, it would be better if it was like this.
- 45:42Let's go build that and try it.
- 45:44Right.
- 45:44Right.
- 45:45Yeah.
- 45:45And our hands have been tied quite a bit recently with the rules package.
- 45:49And we can't do a lot of that anymore.
- 45:51All the parts have to be submitted to NASCAR ahead of time.
- 45:55And then they judge whether they like it or not.
- 45:58And if it's too different from anybody else, they won't approve it.
- 46:03So it turns into a bit of a cat and mouse game where you're trying to sneak stuff around.
- 46:06And every once in a while, you'll see somebody get caught with something, some unapproved part, and they get a $100,000 fine and their hands slapped.
- 46:14Yeah.
- 46:15You know, but that's a real deal.
- 46:16Yeah, I can imagine.
- 46:17Every little bit is an edge.
- 46:19And, you know, you got to push it to the limit.
- 46:21Yeah, for sure.
- 46:22But I think a lot of people take for granted how much tech is in NASCAR because they look at the somewhat antiquated cars with a rear suspension from a 1956 Chevrolet pickup, and they can't understand.
- 46:35But the science behind trying to make a 3,500-pound car with a truck suspension go fast is actually pretty impressive because, I mean, the Formula One car is absolutely designed to be unbelievable race cars.
- 46:49But we're not allowed to do that.
- 46:51So you have to use a lot of weird tricks and things to get these things to go fast and handle well.
- 46:58And so it's a little bit different.
- 47:00I think from an engineering standpoint, the jobs in the different series is quite a bit different.
- 47:04I think NASCAR and IndyCar are pretty similar.
- 47:07You see people going back and forth between those series.
- 47:10You don't see a lot of Formula One guys.
- 47:12Yeah, both of those series have the somewhat spec aspect to it, right?
- 47:17Like a lot of rules about we're kind of going to agree on this part.
- 47:20IndyCar goes here or IndyCar is the same chassis as all Dallara chassis or something like that, right?
- 47:26Right.
- 47:26Yeah.
- 47:27But I think the jobs are quite a bit different too.
- 47:30If a race team has 300 employees, they might only have 25 engineers in NASCAR.
- 47:36In Formula One, if they have 300 employees, my understanding is that almost 300 of them have an engineering degree.
- 47:45Exactly.
- 47:45And they're back there building carbon-carbon adapters or for who knows what, right?
- 47:50Yeah.
- 47:51And I think that we had a few Formula One people come in and work at Richard Childress a few years ago.
- 47:56And the parts that they had worked on, they were incredibly talented at that aspect.
- 48:02But like in NASCAR, because you have fewer people, you can't just be a tire guy, really.
- 48:09Like as a race engineer, you need to be over the full spectrum of working on every aspect of this car to even hope the thing is going to go fast.
- 48:18Yeah.
- 48:19And if you had 30 or 40 people all working on the little details, it'd be better, but our budgets just aren't there.
- 48:25Right, right.
- 48:26I don't know what the NASCAR price is.
- 48:28Maybe you tell me.
- 48:29To run an IndyCar, I think, is about $15 million per year.
- 48:34Run a Formula One car.
- 48:35You know, Ferrari and Mercedes are spending like $300, $400 million a year.
- 48:42Yeah.
- 48:44That's a 10X or 20X difference.
- 48:46That means a really different constraints if you can operate with those two numbers.
- 48:50Yeah.
- 48:50There's nobody spending $100 million that I'm aware of running, you know.
- 48:57You have to keep in mind, too, that the Formula One cars, they're only running two cars.
- 49:02Yeah.
- 49:03Right?
- 49:04And so they have all that resource and they're still only running two cars.
- 49:07So they're only paying two drivers.
- 49:09You look at a Hendrick Motorsports or something and they have four drivers that you're paying.
- 49:13The driver's the most expensive part, for sure.
- 49:15Besides maybe that adapter that measures the wheel that you don't want to crash.
- 49:19Yeah.
- 49:20No, the driver.
- 49:21Most drivers are still way more expensive than that.
- 49:25But when they win, it's worth it, right?
- 49:27Right.
- 49:28Yeah.
- 49:28I haven't looked at much of the budget stuff in a long time.
- 49:31What I'll say is there's a huge gap in what kind of team you're running.
- 49:36The guys that are out there running 35th to 40th are doing it pretty cheap.
- 49:41The cars themselves aren't ridiculously expensive because it's old tech and there's, you know,
- 49:47we can't do carbon bodies.
- 49:48I mean, we have some carbon parts, but teams don't have autoclays where they're making a
- 49:53monocoque, right?
- 49:54But I think that going on the budget, I think the last number I heard, it was about $150,000
- 50:01a week, you know, an event.
- 50:03So if you do, as good as I am at math and science, I'm terrible at basic math.
- 50:08So whatever 150,000 times 38 is, is a pretty decent number.
- 50:15Yeah.
- 50:155.7 million.
- 50:16Yeah.
- 50:17Nice.
- 50:17Yeah.
- 50:18So there's a big difference there.
- 50:20Yeah.
- 50:20Yeah.
- 50:20For sure.
- 50:21You know, but there's a lot of benefits to keeping your costs down too.
- 50:24Yeah.
- 50:24Oh yeah.
- 50:24Because when you're looking at the sponsorship and you're trying to make the sponsor dollar
- 50:28go as far as possible, you know, being much cheaper is better.
- 50:33Yeah.
- 50:34Well, and it means that the sport could be more vibrant, right?
- 50:37Like if one team drops out, another can come in.
- 50:39It's not like they have to come up with half a billion dollars.
- 50:42Right.
- 50:42Right.
- 50:43Or something insane, right?
- 50:44And an engineering factory and all that kind of stuff.
- 50:47So yeah, it's definitely an interesting angle.
- 50:49So let's maybe just wrap up our show on this, which has been really, really fun.
- 50:53Just to maybe get your thoughts on this idea of open source and Python, both for ramping
- 51:01up the capabilities, but also opening up the possibilities, right?
- 51:05You don't have to buy expensive licenses to custom modeling software and whatnot.
- 51:09How do you see that affecting the advantage of your team or the industry in general?
- 51:14Yeah.
- 51:15I think it's going to be the way of the future.
- 51:16I mean, I don't see why you would buy a MATLAB license now.
- 51:20Yeah.
- 51:20Definitely, if you're having young engineers coming in that haven't ever used MATLAB and
- 51:26to have that be your standard, I feel like the learning curve of MATLAB is just much more
- 51:31difficult.
- 51:31Getting it all right, getting things to work, especially the file input, output aspects that
- 51:37I always struggle.
- 51:38I had a ton of experience with MATLAB and I still struggled with, oh, I've got an XML I've
- 51:44got to get.
- 51:44Okay, well, how do I even do that?
- 51:46And, you know, or JSON or something.
- 51:48And with pandas, you just, it's one line and it interprets what you, what it thinks you
- 51:53mean it to be.
- 51:54And it, I think it's going to be the wave of the future.
- 51:57And for race teams, free is always better.
- 51:59Cheap is not always good, but free is better.
- 52:02Right.
- 52:02And the other angle is you can bring in people who are not potentially trained, you know,
- 52:09brought up through the engineering side or the math and MATLAB side of things, right?
- 52:14You could find somebody who was working at a startup, but is passionate about this and they're
- 52:19really good at Python and data science.
- 52:21They could maybe make that transition over potentially.
- 52:24Yeah, absolutely.
- 52:25I mean, that's what I was saying before, the science of what you do, it doesn't matter if
- 52:30you're, if you're working at Caterpillar or a race team or, you know, a toilet paper factory,
- 52:37the way that you're studying the data, all the data science stuff, it applies to every field in the,
- 52:42in the universe.
- 52:43So that's absolutely true that you could bring in some excellent programmers.
- 52:49The one thing I will say, and we have some excellent programmers that are the ones who
- 52:53actually do our simulation department and everything.
- 52:56And, but they don't necessarily come from a racing background.
- 52:59And the one thing I'll say, like I said, I was passionate about UX.
- 53:03The biggest thing we fight with them is trying to get them to do it the way we want.
- 53:09Right.
- 53:09Not the easiest way to code.
- 53:11Yeah.
- 53:12Because I need flexible tools.
- 53:14I need a lot of buttons and things to be able to manipulate this the way I want.
- 53:19And it's like one of our programmers, he was doing a job for me and he delivered it to me.
- 53:24And I'm like, what is this?
- 53:26This is nothing like what we discussed.
- 53:28Like, where is this part of it?
- 53:30And where is this part?
- 53:31How did you not include this?
- 53:33And he's a Spanish guy.
- 53:35I won't try to mimic his accent.
- 53:37He's an ex-Formula 1 guy too.
- 53:38Brilliant programmer.
- 53:39But he explained it to me.
- 53:41He said, well, when we talked about the project, you explained a lot of things and I didn't see why they were needed.
- 53:46Here's what you need to understand.
- 53:48If you hand me a banana and tell me to eat it and don't tell me to peel it, I will eat it unpeeled.
- 53:55But no, he's a great guy.
- 53:59And we're doing a lot of good work right now.
- 54:01He's building a data store to be a server-based data store for all these dashboards to be able to work flawlessly across.
- 54:08We're all over the country, right?
- 54:10So you need to have a good data system and you need to keep that data synced.
- 54:15So if somebody does an analysis and posts it up, it needs to change on everybody's computer.
- 54:19Right.
- 54:20But the synchronization part is tough problems still with if you have a database and there's 18 people across the company editing the same setup, like how do you merge all that stuff?
- 54:31And so that has been the bane of my existence for a long time.
- 54:36Yeah, I'm sure to keep all that data in sync and you're going to run a report and expect an answer out of it.
- 54:40You want to run it against the same data because otherwise you want to run it on sale data and all that kind of stuff, right?
- 54:45Oh, yeah.
- 54:46Yeah, absolutely.
- 54:47Well, thank you so much for sharing your story about how you're using Python and over at the race team.
- 54:53That's just fantastic.
- 54:55Now, before we get out of here, though, I've got to ask you the final two questions.
- 54:57Oh, yeah.
- 54:58If you're going to write some Python code, what editor do you use?
- 55:02If it's an analysis project, I almost always start with Jupyter Notebook.
- 55:07Okay.
- 55:08Jupyter or Jupyter Lab.
- 55:09Which one are you on right now?
- 55:11Jupyter.
- 55:11Okay.
- 55:12And that lets me do my old MATLAB, like searching around where I can print out the data.
- 55:18And just it's a visual thing for me to understand how the flow of this analysis needs to go.
- 55:23And then generally what I'll do is once I get done, I'll merge that all into one cell and put it in VS Code for when it's ready to actually be used on a regular basis.
- 55:35That way I don't have to go through and click all the cells and, well, this thing was out of order and this thing was, you know.
- 55:41Yeah.
- 55:41The Jupyter is a gift and also a curse.
- 55:43Yeah.
- 55:44It's a little bit like Excel in that regard that it has like these implicit go-tos, not because the control flow, but because you could go back three cells, run that thing and then jump down five cells and run the next one.
- 55:54And it looks like in order, like they happened in order, but no, you've got to read that little execution number.
- 55:59Then there's missing numbers that you don't really know what they maybe did, but there's no more evidence of them.
- 56:04It's very tricky in that regard.
- 56:06So I think productizing straight Python files makes a lot of sense.
- 56:10Yeah.
- 56:10Yeah.
- 56:11So that's my typical workflow.
- 56:13Yeah.
- 56:14That sounds good.
- 56:14And then notable PyPI package.
- 56:16I know everybody's heard about Black, but for anybody who uses Jupyter, there's another package called Black Cell Magic that lets you apply Black's formatting inside a Jupyter notebook.
- 56:26And so.
- 56:27Oh my goodness.
- 56:28So that keeps even like my workbook, things that never make it to production, at least formatted right and looking nice.
- 56:34And then I can't say enough about OpenPixel, which is an Excel, a Python Excel interface.
- 56:40It provides all the functionality of cell colors and borders.
- 56:46You could program it all just by typing it out instead of clicking through 8,000 Excel pop-up windows and things.
- 56:54That's cool.
- 56:54And this gives you, this is like your bridge to all the people who have legacy Excel stuff laying around or they want to work in Excel and they're like Excel.
- 57:00And they're like, here you go.
- 57:01You're like, ah, I'm not doing VBA.
- 57:03Hold on.
- 57:03Yeah.
- 57:03No.
- 57:04And when a crew chief can only use Excel, you have to pass them an Excel sheet at the end of the day.
- 57:09Yeah.
- 57:10So that has been a blessing.
- 57:11And then the one thing I found out today when I went and downloaded, when I was going through the documentation on Streamlit is they have a new Streamlit for Teams coming out.
- 57:19I don't know if you've seen that.
- 57:20Yeah.
- 57:20That's going to have one click server deployment for your app.
- 57:24So you can work.
- 57:25That's going to be sweet.
- 57:25Work together and everything.
- 57:27So definitely check that out if you haven't.
- 57:29All right.
- 57:29Awesome.
- 57:30Very good recommendations.
- 57:31Okay.
- 57:31Final call to action.
- 57:32People are excited about this stuff.
- 57:33Maybe making Python a bigger part of their engineering story.
- 57:36What do you say?
- 57:37I like it.
- 57:38They got to do it.
- 57:38It's a friendly environment.
- 57:40Great places to learn all over the internet.
- 57:42Also mostly free.
- 57:44And I guess the other thing I'd like to say is just shout out to all my teammates in case anybody listens to this.
- 57:49They probably hear me talk about Python enough, but we won.
- 57:53We finished first and second in the race on Sunday.
- 57:56So shout out to Austin Dillon for.
- 57:58What event was that?
- 58:00It was Texas.
- 58:01Texas Motor Speedway.
- 58:02Yeah.
- 58:02Cool.
- 58:02All right.
- 58:03Congratulations.
- 58:04And I guess it's cool to know a little bit of Python was behind the scenes there, huh?
- 58:08Oh, yeah.
- 58:08Yeah.
- 58:09Winning races.
- 58:10Right on.
- 58:10And I will mention that there's another race tomorrow night, Thursday, on the NBC Streaming Network.
- 58:15Cool.
- 58:16In Kansas.
- 58:17So definitely check that out.
- 58:19Right on.
- 58:19Awesome.
- 58:20Well, Kane, thanks again for being on the show.
- 58:21It was really good to hear your story.
- 58:23And it's inspiring what you're doing.
- 58:25Yeah.
- 58:25Thanks so much for having me.
- 58:26I really enjoyed it and love the show.
- 58:28Yeah.
- 58:29See you later.
- 58:30All right.
- 58:30Bye.
- 58:30This has been another episode of Talk Python To Me.
- 58:34Our guest on this episode was Robert Kane Replical.
- 58:37And it's been brought to you by SonarCube and Linode.
- 58:40SonarCube finds bugs, vulnerabilities, code smells, and security hotspots in your code.
- 58:46Try it out today.
- 58:47It's free to use.
- 58:48Just visit talkpython.fm/sonar and click download to get started.
- 58:52That's S-O-N-A-R.
- 58:55Or just click the link in your podcast player.
- 58:56Start your next Python project on Linode's state-of-the-art cloud service.
- 59:01Just visit talkpython.fm/Linode.
- 59:04L-I-N-O-D-E.
- 59:05You'll automatically get a $20 credit when you create a new account.
- 59:09Want to level up your Python?
- 59:11If you're just getting started, try my Python Jumpstart by Building 10 Apps course.
- 59:16Or if you're looking for something more advanced, check out our new async course that digs into
- 59:21all the different types of async programming you can do in Python.
- 59:24And of course, if you're interested in more than one of these, be sure to check out our
- 59:28everything bundle.
- 59:28It's like a subscription that never expires.
- 59:31Be sure to subscribe to the show.
- 59:34This is your host, Michael Kennedy.
- 59:39This is your host, Michael Kennedy.
- 59:47Thanks so much for listening.
- 59:49I really appreciate it.
- 59:50Now get out there and write some Python code.
- 59:52Thank you.
- 59:56Thank you.