Learn Python with Talk Python's 270 hours of courses

#281: Python in Car Racing Transcript

Recorded on Wednesday, Jul 22, 2020.

00:00 I love to bring you stories of Python being used in amazing places outside the traditional tech silos of pure web development and data science.

00:07 On this episode, you'll meet Robert Kane Repligal, who works on simulation and test software at Richard Childress Racing,

00:14 the NASCAR team that just finished number one and two at the Texas Motor Speedway.

00:18 You'll hear how Python is allowing them to model car behavior, airflow, and much more, faster than others using outdated tools.

00:26 This is Talk Python to Me, episode 281, recorded July 22nd, 2020.

00:31 Wait, wait, wait, wait. Normally, I'd play a little guitar riff right here to kick off the episode.

00:37 But this episode is about racing and race cars, so let's kick it off with a different kind of instrument and note.

00:44 Let's jump into a 2017 Indy Pro Mazda, a furlap around the storied Brands Hatch circuit, and let the engine notes be the music.

00:51 This episode is brought to you by the music.

01:21 Welcome to Talk Python to Me, a weekly podcast on Python, the language, the libraries, the ecosystem, and the personalities.

01:50 This is your host, Michael Kennedy. Follow me on Twitter, where I'm @mkennedy.

01:54 Keep up with the show and listen to past episodes at talkpython.fm, and follow the show on Twitter via at Talk Python.

02:00 This episode is brought to you by Sonar Cube and Linode. Please check out what they're offering during their segments.

02:05 This is a really fun episode. You're going to enjoy Kane's story.

02:09 And if you're interested, you can find the full five-minute video that Drive Around Brands Hatch at talkpython.fm/hatch.

02:15 Kane, welcome to Talk Python to Me.

02:17 Thanks. Glad to be here.

02:19 Yeah, 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.

02:25 All right.

02:25 And you've got some really cool stories to tell, I could tell already. So I'm looking forward to having you on the show.

02:31 Thanks for having me. I'm excited about it.

02:33 Yeah, 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?

02:39 Well, 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.

02:50 Yeah.

02:50 Yeah.

02:51 That'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.

03:12 You know, I got to admit, I was always a TI sort of person.

03:16 Yeah.

03:17 I 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.

03:25 Oh, yeah.

03:25 But yeah, I remember.

03:27 No, 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.

03:37 But 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.

03:47 You were in engineering?

03:48 Yes.

03:49 In mechanical engineering?

03:50 I studied mechanical engineering in Auburn.

03:51 Yeah. 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.

04:00 Yeah. Yeah. And the older generation of mechanical engineers are still diehard Fortran.

04:07 Interesting.

04:07 One 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.

04:19 So yeah, it smokes.

04:20 By 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.

04:33 And 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.

04:56 So yeah, you can't just open up those APIs and have a look at them, right? They're binary.

05:01 Right, 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.

05:18 But 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.

05:38 So, I mean, they were doing everything in Excel and they were the ones who SIM runs in Fortran.

05:44 Right.

05:44 So 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.

06:00 Yeah. 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.

06:09 Oh, it's impossible. It's impossible.

06:11 Yeah.

06:12 I 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.

06:24 But 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.

06:34 Yeah. 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.

06:46 You'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.

06:56 It blows my mind how some of these, these sort of organizations can be like Pennywise pound foolish.

07:02 Yeah. 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.

07:25 And it's like, wow, that's still not really being done in the same way as what I was doing way back when.

07:32 So when you're talking about simulations, is this like tire pressure, ride height, cambers, like the mechanical setup or something else?

07:39 No, 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.

07:53 When 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.

08:06 Yeah.

08:36 Get 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.

08:51 Wow.

08:51 And 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.

09:13 So, like, Dale Jr. Decides he's going to run the three car in Xfinity with his dad's old Wrangler paint scheme.

09:21 Right.

09:21 And 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.

09:37 So 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.

09:48 Like, 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:15 Yeah, exactly.

10:16 But 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:43 So I programmed mine where the projection mapping would follow the complementary color set of the lighting design.

10:52 Oh, that's clever. That's cool.

10:53 Yeah. 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:06 So 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:18 And then I had a little color matching deal that would match it up.

11:22 So even if I didn't have that data coming in, really, I was solving problems. That's what I do. Right?

11:27 Yeah, that's awesome.

11:28 This portion of Talk Python to me is brought to you by SonarCube.

11:33 Here's something I get asked a lot.

11:35 Once you've mastered the basics of Python, how do you keep building your skill of the language?

11:39 Not 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:48 That's where SonarCube static analysis comes in.

11:51 SonarCube finds bugs, vulnerabilities, code smells, and security hotspots in your code.

11:56 Every 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:04 It's powerful, fast, and accurate out of the box.

12:07 Oh yeah, and it's free.

12:09 So learn more and download SonarCube today at talkpython.fm/sonar.

12:15 That's talkpython.fm/sonar, S-O-N-A-R.

12:19 Yeah, so I got back into racing.

12:22 Obviously, the pay is pretty good compared to normal engineer's pay.

12:27 So they drug me back in.

12:29 I did a technical director role at a small team and then was still doing the lighting on the side.

12:35 But 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:44 Oh, awesome.

12:45 In mechanical engineering?

12:46 It was in, they actually have a mechanical engineering motorsports division.

12:51 Oh wow, that's pretty specific.

12:52 That's awesome.

12:52 Yeah.

12:53 And 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:02 Yeah, that's sort of the world headquarters for NASCAR, like Indianapolis is for Indy and maybe UK is for Formula One.

13:10 Yeah.

13:10 And 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:19 And, you know, as you go, not have to move all over the country to go to different places.

13:24 It's just the length of my commute changes for what team I'm working with.

13:27 Funny.

13:28 Yeah.

13:29 But 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:43 I mean, there is no doubt about it.

13:45 The 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:55 And it's fast and it's fast to develop.

13:58 And 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:13 And 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:20 And it was heavily numerical based.

14:23 It was all MATLAB.

14:24 And 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:29 So 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:40 Cause I only had two months to have not only skills enough to teach the material, but I had to write the whole course.

14:48 I had to write all the homework assignments.

14:50 I had to write all the tests.

14:51 Wow.

14:51 And I think I was getting like four hours of sleep there for that two months period.

14:55 And then when I finally had the class done, I slept for like 24 hours straight and it doesn't help.

15:02 You still just wake up tired, you know?

15:04 Wow.

15:05 But I had a lot of great feedback.

15:06 You know, they had never even had a MATLAB class.

15:09 Any of the students, they don't teach that in the department.

15:12 And so they were all learning from scratch.

15:14 And one of my TAs, he loved it so much.

15:18 He took my class the first semester and then was my TA the second semester.

15:23 And he came to me like halfway through his semester.

15:26 And 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:38 You know, 50 channels at a thousand hertz.

15:41 He had these spreadsheets that were just massive.

15:45 And I mean, Excel can't handle that.

15:47 Yeah.

15:47 The document too large or whatever.

15:49 Like it only does five minutes at a time.

15:51 Who knows?

15:51 Yeah.

15:52 And he redid it and he was just so proud of himself.

15:55 And 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:02 Yeah.

16:02 But to have the skill to be able to do that and make it happen is pretty good.

16:07 He actually ended up taking a job at Caterpillar designing huge diesel engines for the earth moving equipment.

16:13 Okay.

16:14 Yeah.

16:14 Yeah.

16:14 Caterpillar is doing a bunch of stuff with Python.

16:16 Oh, yeah.

16:17 Yeah.

16:18 Actually, Caterpillar is one of our sponsors too.

16:20 I don't know if you knew that for our team.

16:22 No, I didn't know that.

16:23 Yeah.

16:23 They were telling us, I met with some of the guys.

16:26 We were comparing machine learning notes and he was telling us about their division that does all the reliability testing and things.

16:34 So they have all their trucks instrumented.

16:37 And 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:49 Wow.

16:50 Yeah.

16:50 It's pretty impressive how industry has really latched onto the data science, but racing still lagging behind, I feel.

16:57 But we still haven't got to my Python.

16:58 Well, you know, one of the things...

17:00 That's right.

17:01 Bo, just one quick comment.

17:02 I think the type of software that you're talking about is really interesting challenges.

17:06 I got to work in this for a while as well, where it's event-based, like human event-based.

17:10 Yeah.

17:11 Right.

17:11 We'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:20 And 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:24 Like, yeah, that was the Daytona 500 and it didn't work.

17:28 So you missed it.

17:28 Oh, yeah.

17:29 Tell me about it.

17:29 I mean, and it's even worse than that.

17:31 What 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:40 The 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:48 I mean, much less you could crash the car.

17:50 You could crash the car and hurt the driver.

17:52 You could kill the driver.

17:53 You could crash the car so bad that parts go through the catch fence and hurt fans, which has happened before.

17:59 And so I always try to make sure that they understand the impact that they could have.

18:04 But when it comes to the key talent that you need, it's measuring disappointment because it doesn't matter how hard you try.

18:13 You 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:23 And then by no fault of your own, cut a tire, plow into the fence and your whole weekend.

18:28 Now, no matter how good it was to that point, you're a failure now.

18:33 You know, and yeah, absolutely.

18:35 Yeah.

18:35 I see a lot of the young people really have a problem battling with depression.

18:39 And I mean, I tell this story as kind of a joke in a way, but it's serious.

18:44 And it's easy to get disgruntled and like think of yourself as a failure in this industry.

18:50 Yeah.

18:50 I can imagine.

18:51 I mean, you have to set your expectations right.

18:54 Stuff's going to happen.

18:55 Things are going to go wrong.

18:56 Right.

18:57 Sometimes your fault, sometimes not.

18:58 Sometimes finishing in the middle is something you've got to be proud of and not like seen as a failure or whatever.

19:04 Right.

19:05 Like it just I think it does take that mental sort of not necessarily toughness, but just setting the expectations in a real way.

19:12 Absolutely.

19:14 It seems really frustrating.

19:15 Like you spend the whole weekend.

19:16 Someone takes you out in the first corner of the race.

19:18 It doesn't matter how good your simulation was.

19:19 Nope.

19:20 You you're packing it up and you're going back home.

19:22 Yeah.

19:23 Yeah.

19:23 And there's a few other aspects of it, too, where I mean, we're a team.

19:27 Right.

19:28 So 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:41 And so having that positive mental attitude is the only way to be successful.

19:46 And I mean, I've definitely learned a lot through my career, which is why I try to share that.

19:51 But in my earlier days, it was rough.

19:53 I was not a good teammate and would say harsh things and I would have harsh things said to me.

20:00 Yeah.

20:00 But back on the Python track, since we still haven't made it there.

20:03 So after I had my son, I couldn't do working on a race team full time and teaching classes.

20:09 So I had to quit the UNC Charlotte job and I loved it and love my time with MATLAB.

20:14 But then I lost my license because I was on an educational license.

20:18 So I had to look at the landscape of like, what do I want to do at Richard Children's Racing?

20:23 We 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:35 And now we've actually upgraded and we have plenty of MATLAB licenses as well.

20:38 But I've put so much effort into my Python experience and I just love it.

20:42 I mean, it's clean.

20:43 Yeah.

20:44 My code is beautiful.

20:45 I love PEP 8.

20:46 I love black.

20:47 Oh, yeah.

20:48 And just not even having to think about the white space and how I do my continuation lines.

20:53 And I mean, just every aspect of it.

20:56 I 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:05 Yeah, that is pretty interesting.

21:06 Yeah.

21:06 Because just nobody in my industry used it.

21:09 But 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:19 Been working on the fast AI.

21:22 I think you interviewed Jeremy Howard, who is just an amazing teacher, has an amazing teaching style.

21:28 You can't not like the guy.

21:29 Yeah, awesome.

21:30 Yeah, I don't think I have interviewed him.

21:31 I should.

21:32 But yeah, fast AI is cool.

21:34 Yeah.

21:34 And clean.

21:35 And I was already using PyTorch and it works on top of PyTorch now.

21:39 Okay.

21:40 So maybe give me a perspective now that you're three years in.

21:43 You're not new to the Python world at all anymore.

21:47 Some of the stuff we're going to talk about that you've been doing, it's incredible.

21:49 But it's still pretty fresh in your mind, I suspect.

21:51 Coming 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:03 Versus if you can find it on GitHub or on PyPI and it works decent, now that's another thing you can do.

22:11 It feels like the world is more open to just doing what you want to solve your problem.

22:15 Well, and I think to put that even further, I would say that the competition level is really interesting with open source.

22:23 Because as you see some new idea come out, you might see a package start and then another flower pops up somewhere else.

22:31 And the contributors look at each other's work and they're like, okay, I'm going to come work on yours now.

22:35 Yeah.

22:36 You know, and just like abandon that space if somebody comes out with like a better approach to solving some issue.

22:42 And I think that that is a powerful thing that these commercial softwares can't compete with.

22:47 Right, exactly.

22:48 And they definitely can't compete with all the free help that people give.

22:53 Yep.

22:53 Absolutely.

22:54 That's really, really interesting.

22:55 So let's talk really quickly just about like some high level stuff in racing.

22:59 I 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:04 But just give us a sense of what type of data you're collecting.

23:08 You 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:17 Like what kind of stuff are you guys doing?

23:19 Yeah, pretty much most of that.

23:21 We're limited during the race.

23:23 NASCAR has, they issue us a data logger and it is nothing that you can really mess with.

23:30 And it only has certain channels.

23:32 So we're only allowed to have a few channels during the race, you know, GPS location.

23:36 So lat, long, elevation type stuff.

23:39 A few basic driver things.

23:41 So you'll have brake pressure, throttle position, and steering wheel angle.

23:45 Everything he's doing, he controls with those three things.

23:47 So, 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:53 And that's where you stay for the whole lap.

23:55 Unless you're on a road course, yeah.

23:56 Yeah.

23:57 But 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:08 Air flows through the radiators.

24:10 Air flows through brake ducts, you know, if we're running out of braking track.

24:15 We have these things called wheel force transducers that are like the top of the line.

24:19 They're the most expensive sensor.

24:20 So you typically actually detune your car when you go test with this because you don't want to risk hitting the wall.

24:28 But it measures the three directions of force, three directions of torque, tire pressure, tire temperature.

24:34 And so there's quite a few sensors on just that one tire.

24:37 You know, we'll use pitot tubes mounted to the roof to track airflow across the top of the roof.

24:43 So we can look at the pressure difference there.

24:45 There's inside the engine, there's just a hundred things that you could do.

24:49 So the data system, the data person job is pretty demanding as well.

24:54 Yeah, it sounds like it.

24:55 But the system we use for the races is pretty small.

24:59 It's pretty lightweight.

24:59 So it's not a big deal.

25:00 Yeah.

25:01 And then, I mean, not to mention we go to the wind tunnel.

25:04 I 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:09 Yeah, I don't think so.

25:09 Maybe tell people about it.

25:11 Yeah.

25:11 Yeah.

25:11 It's a 180 mile an hour rolling road wind tunnel.

25:15 Like a treadmill, but that goes 180 miles an hour.

25:18 It's a treadmill with a $300,000 stainless steel belt.

25:22 Oh my goodness.

25:23 Okay.

25:23 You know, and so there's force pads under the belt to measure the weight on the tires.

25:30 And you're also trying to capture the wind speed through the radiator and that kind of test too.

25:36 And you don't want to mess with that belt because it's very expensive.

25:39 But 180 miles an hour is the...

25:42 I believe it's still the fastest wind tunnel in the world.

25:44 Wow.

25:44 That's pretty awesome.

25:46 And I love when we do a wind tunnel test because I only live about three miles from

25:50 the wind tunnel and I live 40 miles from the shop.

25:53 So it's much nicer commute, but then I don't get to listen to as much podcast.

25:58 Yeah, that's true.

25:59 That's definitely a drawback.

26:00 But yeah, a three mile commute is pretty sweet.

26:02 Yeah.

26:03 So one of the things that you actually have been spending a lot of time lately is applying

26:07 Python and scikit-learn to this wind tunnel data, right?

26:12 Oh yeah.

26:12 We had an aerodynamicist leave at the end of 2018 who managed the wrangling of all the data

26:22 from the raw wind tunnel data into what our sim needs to ingest to do all of its calculations.

26:29 And he kind of left all of a sudden.

26:33 And so I wasn't that busy.

26:35 And so I was just like, hey, pick me.

26:37 And so I took it over.

26:38 And I have to say that the system that they were using for all this wind tunnel data in

26:43 Excel was a nightmare.

26:45 And so our manufacturer, General Motors, had been working with a company to develop a new

26:51 fitting algorithm to fit this data.

26:53 You have to imagine this data is four dimensional.

26:56 So you have two travel things on the body that tell you the attitude of your car.

27:03 And then you have the yaw angle that your car is to the wind.

27:06 And then you have roll.

27:07 Right.

27:08 Okay.

27:08 So it's a 4D fit problem.

27:10 So they're kind of struggling with getting the accuracy that we were trying to demand.

27:15 And their system, the workflow was pretty hairy and a lot of manual cutting and pasting and

27:21 putting it into a form that you needed.

27:23 And I got so fed up with it, with this wind tunnel a few months ago that I said, you know

27:28 what?

27:28 There's another guy who's helping with this now.

27:30 Hey, you start with their stuff and try to do it, mash it through.

27:35 And I'm just going to write a new script in Python and let's see who finishes and what

27:39 the results are.

27:40 And so, you know, at first I was really nervous because it was like the first time I was

27:44 the first time I had tried to fit a four dimensional surface like that in Python.

27:49 And at the end of the second day, I had improved the accuracy of the fit by five times.

27:55 Wow.

27:56 In some parts of the map.

27:57 And just...

27:58 500% improvement.

28:00 That's insane.

28:00 Yeah.

28:01 I'm like, you know, but where it missed, it missed really bad.

28:05 It wasn't bad everywhere.

28:06 Okay.

28:07 But where it missed, it was really bad.

28:08 So I might've had, we talked wind tunnel terms in terms of counts, which is the coefficient,

28:14 but they might have an error at some point of the map of 80 counts.

28:19 And I might have an error of one count or two counts at that same point.

28:23 And so the support vector regression algorithm inside Git Learn is phenomenal and so easy to

28:30 work with.

28:31 And it fits super fast for the amount of data that we're using.

28:33 But yeah, I think another interesting aspect of that project is the other aerodynamicists

28:39 I was working with who kind of went on and got the headaches of the other package.

28:44 You take the bumpy road.

28:45 Yeah.

28:46 When he came back, well, I had been doing it for almost three years at that point,

28:50 two and a half years.

28:51 So I had suffered enough, but yeah, he came back and I showed him what I was doing.

28:56 And he was struggling with his sheet that he uses in the wind tunnel of his Excel sheet locking

29:02 up and things like that.

29:03 And so we had a few discussions back and forth about MATLAB versus Python and everything else.

29:09 And I showed him the code for the aero map fitter that I built.

29:14 And he was like, I'm sold.

29:16 That looks so easy.

29:17 That looks so easy.

29:19 And so he actually jumped on board and has been working on this project to replace his thing.

29:26 And he finished it last week and used it for the first time in the wind tunnel last week.

29:30 So kudos to him.

29:32 That's a pretty good advancement.

29:34 Yeah, that's a big achievement.

29:35 Yeah.

29:35 In a two month span, you know.

29:37 Yeah.

29:37 Wow.

29:38 But he also had a good teacher, I guess, since he calls me up.

29:42 But one thing that you talk about on the show a lot is the imposter syndrome.

29:46 And I have to say that that hits me right in the heart because every project I do,

29:52 I've got to learn something new to finish the project.

29:54 And it's like, when will I ever know enough to just sit down and not have to pull up the

30:00 documentation on some package or something?

30:03 And it kind of gets to you after a while.

30:07 You get stuck on some pandas.

30:09 I forget what it's called now.

30:10 It's like, it's where pandas is trying to make, pandas thinks you're trying to make a copy of data.

30:16 But what you're really doing is pointing to the same spot in memory.

30:21 Right.

30:21 So you're going to run into problems when you change the one thing and now the other thing changes.

30:27 And that kind of stuff is hard to get your head around when you come from the MATLAB space.

30:31 So he has lots of errors like that.

30:33 But, 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:39 Wow.

30:40 I remember struggling with that.

30:42 Here's how you fix it.

30:43 Yeah.

30:43 And that really takes away a lot of the imposter part when you can provide so much help so quickly without any effort.

30:49 That'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:55 So you always are pushing against that edge and always.

30:58 Right.

30:58 You got to feel that like that struggle.

31:00 But then you get a chance to look back and help others.

31:03 You're like, oh, actually.

31:04 This is easy.

31:05 I clearly see what you need to do.

31:07 I remember this was hard, but it doesn't feel hard anymore.

31:10 Yeah.

31:11 Great.

31:11 Well, and, you know, in the racing industry, I mean, I have data that I'm processing that comes directly from NASCAR.

31:17 I have the track data that's coming from multiple sources.

31:20 I have the wind tunnel data that's coming from source.

31:23 Your 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:33 Yeah.

31:34 And 20% is them complaining about spending so much time wrangling the data.

31:38 I definitely have been accused of that because I will complain.

31:42 But again, you have all these different sources that you don't control.

31:47 And 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:00 And dealing with that by hand is just a nightmare.

32:04 So Python's been a definite blessing with regards to that.

32:09 This portion of Talk Python to Me is brought to you by Linode.

32:12 Whether 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:21 With 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:36 Get 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:52 Just visit talkpython.fm/Linode when creating a new Linode account and you'll automatically get $20 credit for your next project.

33:00 Oh, and one last thing.

33:01 They're hiring.

33:02 Go to linode.com slash careers to find out more.

33:05 Let them know that we sent you.

33:06 I can imagine.

33:09 And, you know, the version of the software changes or you go to the track the next time.

33:13 They're like, oh, we've changed the format of this or we've added a column or taken away a column.

33:17 And you're just like, oh, great.

33:19 Here we go.

33:20 Yeah, constantly.

33:20 Oh, and they always would add the column.

33:23 They don't add it at the end.

33:24 So, in Excel, where you had all your formulas related to that cell, now that cell is not the same data anymore.

33:31 And you got to go through and change all your formulas again.

33:34 And, oh, man, it's just...

33:35 Like halfway through the session, it's changed or something.

33:38 Yeah.

33:38 Or, you know, it's a data stream.

33:42 So, maybe the data is just not coming in anymore.

33:44 Like, it just...

33:45 You missed a packet.

33:45 Yeah.

33:46 Like, what do you do then?

33:47 And, you know, or there's a big section of blank.

33:50 Yeah.

33:50 So, 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:58 Or, you can replace all the NAs with a zero or whatever kind of makes sense for whatever that entity is.

34:03 And 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:10 Right.

34:11 For hours?

34:11 It's a four-hour event with 10 channels at 20 hertz.

34:16 Oh, and NASCAR releases all 40 cars data.

34:19 So, everybody had...

34:21 So, you don't just have your two cars that are in the race.

34:23 You've got the 40 cars that are in the race.

34:25 That's interesting.

34:26 And do you do a lot of analysis on the competitors' cars?

34:29 Yes.

34:29 I can imagine.

34:30 Yes.

34:31 Quite a bit.

34:32 We're actually...

34:33 Right now, what I'm gearing up to do is do a full suite of dashboards to try to get the hands into...

34:41 Or the data in a usable format into the hands of the less technical people.

34:45 Or even the technical people who just don't have Python experience.

34:49 It's been hard for me to provide them with it.

34:53 It's mostly them sending me work orders where it's like, hey, can you run this on these files?

34:58 I need this report.

35:00 Yeah.

35:00 Give me the report.

35:01 Yeah.

35:02 And so, you had done...

35:03 I guess it's been a couple months ago.

35:05 You had the guy from Streamlit on.

35:07 Yeah.

35:07 Adrian on from Streamlit.

35:09 Yeah.

35:09 Adrian.

35:09 Yeah.

35:10 And I had been working with Plotly and Dash.

35:13 And I think for the end polish product, maybe you can make it look nicer with Dash still.

35:19 But you have to do all the CSS programming.

35:22 I mean, who really wants to do all that stuff?

35:24 So, I actually downloaded Streamlit today for the first time and started working with this afternoon.

35:31 And I've already got a dashboard built that is functioning with the lap data.

35:35 Oh, that's cool.

35:36 Plotting out lap times.

35:37 And I mean, it is just...

35:39 It is...

35:40 Wow.

35:40 What a simple thing.

35:41 Yeah.

35:41 So, for those folks who haven't heard about Streamlit or didn't listen to that episode,

35:46 I'll give my take on it.

35:47 You can give your take on it.

35:48 So, the idea is you take something that would be just a top-to-bottom regular script.

35:53 Maybe it has functions.

35:54 Maybe it doesn't.

35:56 And you want to turn that into an interactive website.

35:59 That sounds like a very far bridge to cross.

36:01 But the way Streamlit works is it does a bunch of magic to give you stuff that you just put into your script.

36:07 And then it turns that into interactive dashboards with sliders and drop-downs and search fields and all kinds of stuff.

36:14 And integrates with Plotly and other tools as well.

36:17 Yeah.

36:17 It's pretty slick, right?

36:18 It's really slick.

36:19 And 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:25 it works similar to...

36:27 I do a lot of stuff in Jupyter Notebook.

36:29 So, I'm always wanting to review my data.

36:31 So, 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:38 And Streamlit does that and it puts it on your webpage.

36:41 So, you don't even have to tell it st.table or whatever.

36:45 You just put the data frame, you know, just data frame.

36:48 And then, bam, it's on your page.

36:50 Nice.

36:51 Anything 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:58 And, I mean, how awesome is that?

37:00 I mean, this is like the best, laziest package I've ever seen.

37:04 Productivity, productive laziness or something like that.

37:08 There's got to be a term for it.

37:09 Yeah.

37:09 And working with it for the few hours that I did and to already have a dashboard that doesn't look great,

37:16 but is functioning, I think is pretty impressive.

37:20 Yeah, yeah, it definitely is.

37:21 So, 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:29 They can go do the slider themselves or select the thing themselves and they get the answer, right?

37:34 Yeah, exactly.

37:35 And sometimes too many opinions is too much, definitely in racing, because everybody's making decisions from partial information.

37:43 But 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:57 And hey, what's with this?

37:58 Or hey, look at this correlation.

38:00 You 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:12 I think our simulation has 634 user inputs right now.

38:18 So, and some of those aren't, some of those are not stuff that you touch all the time.

38:24 A lot of them aren't.

38:25 But there's about 275 things that you set in the model to actually be able to simulate a car.

38:30 And it gets worse every day because things keep getting added to it, right?

38:34 So-

38:35 Right, right.

38:35 Different knobs you can turn, different adjustments you can make.

38:38 Yeah.

38:38 And everything's interactive.

38:40 It's a dynamic system.

38:41 It's not a dynamic part.

38:43 You can't change this spring and change, you can't change one thing and get any benefit.

38:49 You have to change a system of parts.

38:51 Right.

38:52 You 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:59 Like it's all-

39:00 Exactly.

39:00 It's like a whack-a-mole.

39:01 You change one thing, it's going to change a bunch of others.

39:03 Yeah.

39:04 Yep, exactly.

39:05 And 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:18 So it better run quick.

39:20 Yeah.

39:20 Yeah.

39:20 So how do you run these things?

39:22 Is it computationally slow or do you just have a lot of hardware or is it not actually that bad?

39:26 Yes.

39:28 So it depends.

39:32 There's a different aspect.

39:33 There's the full dynamic model and that needs to solve at a thousand hertz.

39:38 So that's a lot of data.

39:39 So 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:49 That 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:08 So you don't get the same answer.

40:10 So you don't get the same answer.

40:11 Right.

40:12 But 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:17 Right.

40:18 If 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:30 Yeah.

40:31 It's exponentially.

40:32 As you get your accuracy, you pay with money, you pay with computational time, you pay with losing the engineer's focus.

40:40 The 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:47 Right.

40:47 It's easy to lose yourself when you're running 200 sims a week.

40:51 Yeah, I can imagine.

40:52 Wow.

40:52 So 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:01 You have access to a lot of the different cars and whatnot.

41:04 It seems like there's probably a lot of machine learning stuff that you could potentially apply here.

41:09 Like what's the story of machine learning in your world?

41:12 I think it is the future.

41:13 So 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:23 We 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:32 We're trying to get very specific answers.

41:36 And 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:44 Right.

41:44 You 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:53 Obviously, higher pressures and temperatures will change.

41:56 The amount of fuel used has changed.

41:58 All those things are just like they're not comparable, right?

42:00 Yeah.

42:00 There's a few places that we've used some deep learning.

42:03 Okay.

42:04 Some photo stuff.

42:06 General Motors provides a photographer to the track.

42:09 Well, during the pandemic, they don't always.

42:11 But they provide a professional photographer to the track to take pictures of all your other cars, all the cars on track.

42:17 So 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:24 But over a weekend, you have about 7,000 photos taken and to go.

42:30 And 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:41 Right.

42:42 And 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:49 So it's not like they're grouped together in any way.

42:52 So 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:07 All right.

43:08 Maybe 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:18 The rake.

43:19 So show me that.

43:20 Show me that for this car.

43:22 You could probably build that with Streamlight.

43:23 That's a great idea.

43:24 I think I'll build that next week.

43:25 There you go.

43:26 What's crazy is like, I mean, you're joking.

43:30 It 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:41 And now it's like, maybe we'll do that in this little app.

43:43 Yeah.

43:43 Our cute little app.

43:45 Yeah.

43:45 So a lot of the performance stuff, we have enough data during the race to use some deep learning.

43:50 But I really think the simpler just regression analysis and classification analysis types of things where you're looking at data.

44:00 You take all the metrics of output of these different cars and you split it up around the track.

44:06 And then you train a fairly simplified model on what do the fast cars have in common?

44:11 What do the slow cars have in common?

44:13 And let's not be like the slow cars because there is so much data.

44:18 It's hard to say what knob does matter.

44:20 What knob is the crucial thing?

44:22 So that's the direction we're going.

44:24 And I'm excited about it.

44:26 Building some new skills and being given the opportunity to apply them in so many different aspects of the job is just huge.

44:33 Keep it.

44:34 Keep me motivated.

44:35 Keep me motivated.

45:05 Or 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:12 For details, visit training. talkpython.fm/business or just email sales at talkpython.fm.

45:21 Yeah, I can imagine.

45:22 And racing is one of those things that's pretty interesting because there's a lot of bespoke engineering that happens.

45:29 Like one-off custom engineering.

45:31 Yeah.

45:32 There's a team of people that are building stuff and adjusting stuff.

45:35 It's not like, well, these are the three things I can get from the parts store.

45:38 I'm going to stick on here.

45:39 Like, you guys are like, well, it would be better if it was like this.

45:42 Let's go build that and try it.

45:44 Right.

45:44 Right.

45:45 Yeah.

45:45 And our hands have been tied quite a bit recently with the rules package.

45:49 And we can't do a lot of that anymore.

45:51 All the parts have to be submitted to NASCAR ahead of time.

45:55 And then they judge whether they like it or not.

45:58 And if it's too different from anybody else, they won't approve it.

46:03 So it turns into a bit of a cat and mouse game where you're trying to sneak stuff around.

46:06 And 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:14 Yeah.

46:15 You know, but that's a real deal.

46:16 Yeah, I can imagine.

46:17 Every little bit is an edge.

46:19 And, you know, you got to push it to the limit.

46:21 Yeah, for sure.

46:22 But 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:35 But 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:49 But we're not allowed to do that.

46:51 So you have to use a lot of weird tricks and things to get these things to go fast and handle well.

46:58 And so it's a little bit different.

47:00 I think from an engineering standpoint, the jobs in the different series is quite a bit different.

47:04 I think NASCAR and IndyCar are pretty similar.

47:07 You see people going back and forth between those series.

47:10 You don't see a lot of Formula One guys.

47:12 Yeah, both of those series have the somewhat spec aspect to it, right?

47:17 Like a lot of rules about we're kind of going to agree on this part.

47:20 IndyCar goes here or IndyCar is the same chassis as all Dallara chassis or something like that, right?

47:26 Right.

47:26 Yeah.

47:27 But I think the jobs are quite a bit different too.

47:30 If a race team has 300 employees, they might only have 25 engineers in NASCAR.

47:36 In Formula One, if they have 300 employees, my understanding is that almost 300 of them have an engineering degree.

47:45 Exactly.

47:45 And they're back there building carbon-carbon adapters or for who knows what, right?

47:50 Yeah.

47:51 And I think that we had a few Formula One people come in and work at Richard Childress a few years ago.

47:56 And the parts that they had worked on, they were incredibly talented at that aspect.

48:02 But like in NASCAR, because you have fewer people, you can't just be a tire guy, really.

48:09 Like 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:18 Yeah.

48:19 And 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:25 Right, right.

48:26 I don't know what the NASCAR price is.

48:28 Maybe you tell me.

48:29 To run an IndyCar, I think, is about $15 million per year.

48:34 Run a Formula One car.

48:35 You know, Ferrari and Mercedes are spending like $300, $400 million a year.

48:42 Yeah.

48:44 That's a 10X or 20X difference.

48:46 That means a really different constraints if you can operate with those two numbers.

48:50 Yeah.

48:50 There's nobody spending $100 million that I'm aware of running, you know.

48:57 You have to keep in mind, too, that the Formula One cars, they're only running two cars.

49:02 Yeah.

49:03 Right?

49:04 And so they have all that resource and they're still only running two cars.

49:07 So they're only paying two drivers.

49:09 You look at a Hendrick Motorsports or something and they have four drivers that you're paying.

49:13 The driver's the most expensive part, for sure.

49:15 Besides maybe that adapter that measures the wheel that you don't want to crash.

49:19 Yeah.

49:20 No, the driver.

49:21 Most drivers are still way more expensive than that.

49:25 But when they win, it's worth it, right?

49:27 Right.

49:28 Yeah.

49:28 I haven't looked at much of the budget stuff in a long time.

49:31 What I'll say is there's a huge gap in what kind of team you're running.

49:36 The guys that are out there running 35th to 40th are doing it pretty cheap.

49:41 The cars themselves aren't ridiculously expensive because it's old tech and there's, you know,

49:47 we can't do carbon bodies.

49:48 I mean, we have some carbon parts, but teams don't have autoclays where they're making a

49:53 monocoque, right?

49:54 But I think that going on the budget, I think the last number I heard, it was about $150,000

50:01 a week, you know, an event.

50:03 So if you do, as good as I am at math and science, I'm terrible at basic math.

50:08 So whatever 150,000 times 38 is, is a pretty decent number.

50:15 Yeah.

50:15 5.7 million.

50:16 Yeah.

50:17 Nice.

50:17 Yeah.

50:18 So there's a big difference there.

50:20 Yeah.

50:20 Yeah.

50:20 For sure.

50:21 You know, but there's a lot of benefits to keeping your costs down too.

50:24 Yeah.

50:24 Oh yeah.

50:24 Because when you're looking at the sponsorship and you're trying to make the sponsor dollar

50:28 go as far as possible, you know, being much cheaper is better.

50:33 Yeah.

50:34 Well, and it means that the sport could be more vibrant, right?

50:37 Like if one team drops out, another can come in.

50:39 It's not like they have to come up with half a billion dollars.

50:42 Right.

50:42 Right.

50:43 Or something insane, right?

50:44 And an engineering factory and all that kind of stuff.

50:47 So yeah, it's definitely an interesting angle.

50:49 So let's maybe just wrap up our show on this, which has been really, really fun.

50:53 Just to maybe get your thoughts on this idea of open source and Python, both for ramping

51:01 up the capabilities, but also opening up the possibilities, right?

51:05 You don't have to buy expensive licenses to custom modeling software and whatnot.

51:09 How do you see that affecting the advantage of your team or the industry in general?

51:14 Yeah.

51:15 I think it's going to be the way of the future.

51:16 I mean, I don't see why you would buy a MATLAB license now.

51:20 Yeah.

51:20 Definitely, if you're having young engineers coming in that haven't ever used MATLAB and

51:26 to have that be your standard, I feel like the learning curve of MATLAB is just much more

51:31 difficult.

51:31 Getting it all right, getting things to work, especially the file input, output aspects that

51:37 I always struggle.

51:38 I had a ton of experience with MATLAB and I still struggled with, oh, I've got an XML I've

51:44 got to get.

51:44 Okay, well, how do I even do that?

51:46 And, you know, or JSON or something.

51:48 And with pandas, you just, it's one line and it interprets what you, what it thinks you

51:53 mean it to be.

51:54 And it, I think it's going to be the wave of the future.

51:57 And for race teams, free is always better.

51:59 Cheap is not always good, but free is better.

52:02 Right.

52:02 And the other angle is you can bring in people who are not potentially trained, you know,

52:09 brought up through the engineering side or the math and MATLAB side of things, right?

52:14 You could find somebody who was working at a startup, but is passionate about this and they're

52:19 really good at Python and data science.

52:21 They could maybe make that transition over potentially.

52:24 Yeah, absolutely.

52:25 I mean, that's what I was saying before, the science of what you do, it doesn't matter if

52:30 you're, if you're working at Caterpillar or a race team or, you know, a toilet paper factory,

52:37 the way that you're studying the data, all the data science stuff, it applies to every field in the,

52:42 in the universe.

52:43 So that's absolutely true that you could bring in some excellent programmers.

52:49 The one thing I will say, and we have some excellent programmers that are the ones who

52:53 actually do our simulation department and everything.

52:56 And, but they don't necessarily come from a racing background.

52:59 And the one thing I'll say, like I said, I was passionate about UX.

53:03 The biggest thing we fight with them is trying to get them to do it the way we want.

53:09 Right.

53:09 Not the easiest way to code.

53:11 Yeah.

53:12 Because I need flexible tools.

53:14 I need a lot of buttons and things to be able to manipulate this the way I want.

53:19 And it's like one of our programmers, he was doing a job for me and he delivered it to me.

53:24 And I'm like, what is this?

53:26 This is nothing like what we discussed.

53:28 Like, where is this part of it?

53:30 And where is this part?

53:31 How did you not include this?

53:33 And he's a Spanish guy.

53:35 I won't try to mimic his accent.

53:37 He's an ex-Formula 1 guy too.

53:38 Brilliant programmer.

53:39 But he explained it to me.

53:41 He said, well, when we talked about the project, you explained a lot of things and I didn't see why they were needed.

53:46 Here's what you need to understand.

53:48 If 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:55 But no, he's a great guy.

53:59 And we're doing a lot of good work right now.

54:01 He's building a data store to be a server-based data store for all these dashboards to be able to work flawlessly across.

54:08 We're all over the country, right?

54:10 So you need to have a good data system and you need to keep that data synced.

54:15 So if somebody does an analysis and posts it up, it needs to change on everybody's computer.

54:19 Right.

54:20 But 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:31 And so that has been the bane of my existence for a long time.

54:36 Yeah, 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:40 You 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:45 Oh, yeah.

54:46 Yeah, absolutely.

54:47 Well, thank you so much for sharing your story about how you're using Python and over at the race team.

54:53 That's just fantastic.

54:55 Now, before we get out of here, though, I've got to ask you the final two questions.

54:57 Oh, yeah.

54:58 If you're going to write some Python code, what editor do you use?

55:02 If it's an analysis project, I almost always start with Jupyter Notebook.

55:07 Okay.

55:08 Jupyter or Jupyter Lab.

55:09 Which one are you on right now?

55:11 Jupyter.

55:11 Okay.

55:12 And that lets me do my old MATLAB, like searching around where I can print out the data.

55:18 And just it's a visual thing for me to understand how the flow of this analysis needs to go.

55:23 And 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:35 That 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:41 Yeah.

55:41 The Jupyter is a gift and also a curse.

55:43 Yeah.

55:44 It'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:54 And it looks like in order, like they happened in order, but no, you've got to read that little execution number.

55:59 Then there's missing numbers that you don't really know what they maybe did, but there's no more evidence of them.

56:04 It's very tricky in that regard.

56:06 So I think productizing straight Python files makes a lot of sense.

56:10 Yeah.

56:10 Yeah.

56:11 So that's my typical workflow.

56:13 Yeah.

56:14 That sounds good.

56:14 And then notable PyPI package.

56:16 I 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:26 And so.

56:27 Oh my goodness.

56:28 So that keeps even like my workbook, things that never make it to production, at least formatted right and looking nice.

56:34 And then I can't say enough about OpenPixel, which is an Excel, a Python Excel interface.

56:40 It provides all the functionality of cell colors and borders.

56:46 You could program it all just by typing it out instead of clicking through 8,000 Excel pop-up windows and things.

56:54 That's cool.

56:54 And 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:00 And they're like, here you go.

57:01 You're like, ah, I'm not doing VBA.

57:03 Hold on.

57:03 Yeah.

57:03 No.

57:04 And when a crew chief can only use Excel, you have to pass them an Excel sheet at the end of the day.

57:09 Yeah.

57:10 So that has been a blessing.

57:11 And 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:19 I don't know if you've seen that.

57:20 Yeah.

57:20 That's going to have one click server deployment for your app.

57:24 So you can work.

57:25 That's going to be sweet.

57:25 Work together and everything.

57:27 So definitely check that out if you haven't.

57:29 All right.

57:29 Awesome.

57:30 Very good recommendations.

57:31 Okay.

57:31 Final call to action.

57:32 People are excited about this stuff.

57:33 Maybe making Python a bigger part of their engineering story.

57:36 What do you say?

57:37 I like it.

57:38 They got to do it.

57:38 It's a friendly environment.

57:40 Great places to learn all over the internet.

57:42 Also mostly free.

57:44 And 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:49 They probably hear me talk about Python enough, but we won.

57:53 We finished first and second in the race on Sunday.

57:56 So shout out to Austin Dillon for.

57:58 What event was that?

58:00 It was Texas.

58:01 Texas Motor Speedway.

58:02 Yeah.

58:02 Cool.

58:02 All right.

58:03 Congratulations.

58:04 And I guess it's cool to know a little bit of Python was behind the scenes there, huh?

58:08 Oh, yeah.

58:08 Yeah.

58:09 Winning races.

58:10 Right on.

58:10 And I will mention that there's another race tomorrow night, Thursday, on the NBC Streaming Network.

58:15 Cool.

58:16 In Kansas.

58:17 So definitely check that out.

58:19 Right on.

58:19 Awesome.

58:20 Well, Kane, thanks again for being on the show.

58:21 It was really good to hear your story.

58:23 And it's inspiring what you're doing.

58:25 Yeah.

58:25 Thanks so much for having me.

58:26 I really enjoyed it and love the show.

58:28 Yeah.

58:29 See you later.

58:30 All right.

58:30 Bye.

58:30 This has been another episode of Talk Python to Me.

58:34 Our guest on this episode was Robert Kane Replical.

58:37 And it's been brought to you by SonarCube and Linode.

58:40 SonarCube finds bugs, vulnerabilities, code smells, and security hotspots in your code.

58:46 Try it out today.

58:47 It's free to use.

58:48 Just visit talkpython.fm/sonar and click download to get started.

58:52 That's S-O-N-A-R.

58:55 Or just click the link in your podcast player.

58:56 Start your next Python project on Linode's state-of-the-art cloud service.

59:01 Just visit talkpython.fm/Linode.

59:04 L-I-N-O-D-E.

59:05 You'll automatically get a $20 credit when you create a new account.

59:09 Want to level up your Python?

59:11 If you're just getting started, try my Python Jumpstart by Building 10 Apps course.

59:16 Or if you're looking for something more advanced, check out our new async course that digs into

59:21 all the different types of async programming you can do in Python.

59:24 And of course, if you're interested in more than one of these, be sure to check out our

59:28 everything bundle.

59:28 It's like a subscription that never expires.

59:31 Be sure to subscribe to the show.

59:34 This is your host, Michael Kennedy.

59:39 This is your host, Michael Kennedy.

59:47 Thanks so much for listening.

59:49 I really appreciate it.

59:50 Now get out there and write some Python code.

59:52 Thank you.

59:56 Thank you.

Back to show page
Talk Python's Mastodon Michael Kennedy's Mastodon