Sunday, January 29, 2017

"Sector Times Deltas" from WRC Rally Stage Split Times

For the longer stages on the WRC rally, one or more split times track the progress of each car through the rally stage. The results record the accumulated stage time of the first car as it passed each timing control, (I'm not sure what is reported if the first car doesn't make it all the way through the stage?), with an offset reported for the cars that follow:

From this information, we can find the accumulated stage time of each car - simply add the offset to the corresponding split time of the first car.

Given the accumulated stage time of a car as it passes each timing control, we can also calculate the time the car spent going between those controls: for two consecutive split times, simply subtract the first split-time from the second. In circuit racing, this would be called a sector time (I'm not sure if rallyspeak uses the same terminology?). Adding up all the sector times recorded by a car should give its stage time.

If for each sector we find the minimum sector time, we can subtract this from the each car's sector time to find the sector time "delta" for that car - the time over the fastest time to complete that sector. (An ultimate stagetime is then given as the sum of the minimum sector times for the stage. A driver could then be said to drive an ultimate stage if his sector times are the fastest in each sector for that stage.)

Just as we could chart split time deltas at stage splits (the times reported in the WRC results shown above), as well as rebased deltas relative to an arbitrary driver, we can also chart the deltas to the minimum sector time for each driver.

The following chart from Stage 3 of the 2017 Monte Carlo rally shows how Ogier was 40s behind the minimum sector time for the first sector, lost a few seconds in the second, but was then on the ball in the latter half of the stage. Evans lost 40s or so in each of the first 3 sectors, and dropped 20s in the last sector. Hanninen was competitive for the first three sectors, but lost time somewhere in the last sector.

(The number labels represent the overall rally ranking (rather than the RC1 relative class ranking shown in the charts in the previous post) based on sector time for that sector. A driver driving an ultimate stage would have position 1 for each sector.)

As well as grouping by driver, we can group by sector. Trends within a sector may show how conditions improved or worsened over the course of the runners. The grouping also highlights drivers who lost time in a particular sector - the number labels in this case represent the car number.

So for example, we see how cars 1, 3 and 20 lost significant amounts of time in sector 1, cars 3 and 30 in sectors 2 and 3, and car 20 in sector 4. Indeed, the last 4 runners in sector 4 all lost more than 15 seconds.

Notes on how to generate these charts will be published at some point...

Saturday, January 28, 2017

Rebasing WRC Stage Split Times - How Elfyn Evans Lost Time on Stage 3 of the Monte Carlo 2017 WRC Rally

As well as visualising split times within a stage relative to the first car passing through the stage (for example, WRC Rally Stage Reports - Split Times (stage 3, Monte Carlo 2017), we can also rebase the split times relative to the times recorded through the stage by any particular driver.

For example, rebasing split times for stage 3 of the Monte Carlo 2017 rally relative to Elfyn Evans' times shows how he lost time relative to everyone except Ogier and Serderidis on the first split, but then continued to lost time at a more or less constant rate over the remaining splits to everyone except Serderidis, who had a spectacularly miserable time.

Note also how this chart is further annotated using colour to highlight the times of a specified driver (which need not be the driver relative to whose times the other drivers' deltas are calculated).

Friday, January 27, 2017

WRC Rally Stage Reports - Split Times (stage 3, Monte Carlo 2017)

I had another tinker with the WRC results/timing data last night, and sketched a chart inspired by seasonal subseries charts that shows the split times and final stage time for each driver in a particular stage.

Drivers are ordered according to the order in which they started the stage. The points within each driver series correspond to the separate split times, in order. The y-axis is the time delta in seconds to the first driver onto the stage, which is why Ogier's times are flat with a delta of 0s at each timing point. The number labels are the in-class rank of the driver at each timing point.

So what can we learn, just from the chart? Firstly, Ogier seemed to lose it at the start. From the Red Bull TV (WRC Rally) coverage (and WRC/FIA footage on Youtube), it seems Ogier went for a little excursion at the start of the stage (stage 3), which accounts for his poor performance there, losing around about 40s compared to the other runners. The trends on Neuville's and Meeke's times are more or less flat, which shows they were approximately keeping time with each other, and with Ogier, across the other checkpoints. Latvala and Breen lost small amounts of time at each split, (the slight upward trend), Lefebvre more so, and Evans and Serderidis big time. Hanninen looked to be making time over the first part of the stage (the downward trend) before losing it on the last part.

Here's another view, rendered using seaborn.

I'll plot a code recipe at some point. Also, I think I'm pretty much committed to trying a Jupyter/python workflow for another data junkie data wrangling book on Leanpub, based around the WRC data...

Wednesday, January 25, 2017

Playing with Python / Pandas - WRC Stage Chart, Monte Carlo 2017

Whilst many of the data sketches I've produced for the F1DataJunkie blog have been generated using R/ggplot2, I spend more of my time now using the Python programming language, and in particular the pandas tabular data wrangling package.

This is partly why my F1 data wrangling tailed off last year. But new year, and all that, so I thought I'd start playing with a new data set, and a new set of charts - around WRC (World Rally Championship) data.

Here's the first sketch I came up with, described (with code) here - a stages chart for the RC1 cars in the 2017 Monte Carlo WRC rally:

This was generated using matplotlib, and shows the overall classification (across all classes) of the RC1 cars at the end of each stage. The boxed numbers showing the ranking of the driver outside the top 12 (there were 12 RC1 cars registered at the start of the rally).

Sunday, May 29, 2016

F1 2016 Monaco Race Battlemaps

The following reading is based solely on the charts and in absence of having seen the race or read any race reports.

A quick sketch of the race track chart shows how the 2016 Monaco F1 Grand Prix evolved.

The cars were bunched for the first few laps, presumably behind a safety car? Thereafter,  RIC's early dominance was cut short as HAM made ground and took the lead, then it was a close fought battle at the front for the middle third of the race, with HAM drawing away at the end.

The second half of the race also saw a close fought battle for second, with a close group of several cars in the middle order.
So how do the battle maps read?

Winner HAM started the race behind teammate ROS and slipping away from RIC up front, before taking the position from ROS and halting RIC's advance as ROS fell away at about 2s per lap. Presumably following a pit stop by RIC(?), which granted HAM the lead, RIC made a quick return to the battle for first, tussling closely with HAM for the rest of the race before falling back a second a lap at the end of the race.
From RIC's perspective, once the race was properly underway he pulled away from ROS, until HAM got past ROS and managed to hold the gap to ahead, before taking the lead as RIC pitted(?). RIC pulled HAM back over the course of 5 laps, but thereafter spent the race nipping at HAM's heels. Behind, PER ebbed and flowed, losing time over several laps, before pulling it back, then losing out again several times.

PER seems to have had an interesting time. Trailing SAI for the first quarter of the race, with ALO close behind, PER spent laps 21 to 28 sandwiched between ROS and VET, presumably before pitting? For the last half of the race, PER managed the gap to RIC 10s ahead, chipping in to the gap whenever VET fell off a second or two behind, before losing it again as the battle to fend of VET reasserted itself.
VET's race began being sandwiched between HAM ahead and HUL behind, until all change (a pit stop?) and VET found himself behind MAS, then ROS briefly, before settling into the forty plus laps of sitting on PER's rear. Behind, it was pretty much clear air once ALO fell away.
So it looks like ALO was fifth? After his early battle with PER ahead, and BUT behind, before BIT fell away, ALO was chasing HUL and then SAI for a while as GUT made ground from behind, fell away, recovered, and fell away again. When SAI was replaced by VET ahead, VET's advantage was evident has he sped off in to the distance, while ALO gamely held off ROS for over forty laps before HUL seems to have snatched sixth on the final lap?

So how did HUL see the race? Caught between VET and SAI from the off, HUL joined battle with ROS around lap 32/33(ish?!) and then pestered him till the end before snatching the place on the final lap. Behind, SAI kept trying, but he too fell off at the end.
So ROS is presumably not the happiest of bunnies tonight? Once the race started, RIC sped off into the distance ahead, whilst HAM presumably fumed behind? Once HAM passed, SAI, then PER gave grief from behind before pit stops (presumably) established a new order of ROS stuck between ALO in front and HUL behind. As the race entered the last few laps, ALO started to draw away but HUL was tenacious behind, stealing the place on the last lap.

I'm guessing SAI was classified next? He was giving grief to HU throughout the race, with PER and ALO behind for the first half of the race, then BUT behind for the second half, though far enough behind for there to be enough of a breathing space behind that there was no threat from a DRS assist.
So JB / BUT had his own race, it seems? A scrappy first quarter of the race chasing GUT then WEH, with an attack from GRO behind, before WEH was passed and left, only for VES to come on a charge and pass at a great rate of knots. SAI was just too far ahead to provide much close racing there, and no threat from behind in the middle third as GUT fell off. The last third saw MAS chasing BUT down, but the race was three or four laps too short for the threat to require any close defense from the attack behind,
MAS' early race was spent defending against GRO, and then VET, the latter battle allowing PER to pull away ahead. As the race entered the second quarter WEH fell off behind, the GUT ahead was passed and easily pulled away from. MAS made in-roads into the gap ahead, pulling BUT back at an impressive rate, but the road ran out before a full passing attack on BUT could be seriously considered.
BOT doesn't seem to have had much fun. With ALO pulling away at the start. BOT was stuck between WEH and ERI. Mid-way through the race, BOT managed to take WEH and pull away rapidly, only to be lapped by the cars fighting for first and second, then third and fourth. Being able to lap HAR probably didn't offer much solace, but having started to manage the gap to GUT ahead in the final quarter, the last few laps saw BOT take the gap down and pass GUT on the final lap.

So GUT then seems to have had an eventful time. His early tussle with BOT ahead and RAI behind saw him cut down a gap to ALO before having to defend against VES. ALO pulled away ahead, then BUT,  while MAS made the pass from behind and then he too drove away. As GUT was lapped by the leaders, he managed to lap HAR in turn, and then poor old GRO. Behind, BOT looked to be safely back in the mirrors, but after taking a chunk out of the gap in the penultimate lap, GUT lost out to BOT on the final lap. 

WEH seems to have spent the race watching BUT then BOT in his mirrors, though he did get to see MAS then BOT speed off ahead, only to have GRO then sit on his tail as he started to get lapped by all and sundry. It looks as if GRO fell off right at the end? 
GRO had a slightly more interesting time perhaps? He seems to have taken HAR and then NAS ahead before hooking up with WEH? NAS looks like he may have threatened mid-way though the race, but then disappeared?

Of the rest, what happened to VES? It looks as if he was stuck behind NAS and MAG for a bit, but then he seems to have made a break, accelerating away from MAS as he chased down BUT and then GUT, though BUT charged back, albeit without being able to pass. When VES race came to an early end, he was nipping at SAI's rear end and holding off BUT behind.

So, what actually happened? Time to read some race reports, I think, and try to catch the race highlights...

Saturday, May 28, 2016

F1 Monaco Qualifying

How the drivers progressed through qualifying.

Autodetected signals:

Going from Q1 to Q2:

* GRO failed to improve his time, recording 75.571 compared to 75.465 (0.106s slower)

Going from Q2 to Q3:
* VET failed to improve his time, recording 74.552 compared to 74.318 (0.234s slower)
* KVY failed to improve his time, recording 75.273 compared to 74.794 (0.479s slower)
* ALO failed to improve his time, recording 75.363 compared to 75.107 (0.256s slower)

How the drivers improved position going from Q2 to Q3: 

imp1 is time diffrence (negative is an improvement in laptime) for a driver who improved his rank going from Q2 to Q3; imp2 is the improvement in laptime for a driver who lost rank position to the driver in the first column.

So RIC improved his rank going Q2 to Q3 over ROS, HAM and VET; HUL improved rank over RAI, SER, PER and KVY; SAI improved rank over KVY; and PER improved rank over KVY.

 driverName   imp1 driverName   imp2
1        RIC -0.735        ROS -0.252
2        RIC -0.735        HAM -0.114
3        RIC -0.735        VET  0.234
4        HUL -0.263        RAI -0.057
5        HUL -0.263        SAI -0.056
6        HUL -0.263        PER -0.035
7        HUL -0.263        KVY  0.479
8        SAI -0.056        KVY  0.479
9        PER -0.035        KVY  0.479

Qualifying session cutoff time evolution:

Sunday, May 1, 2016

F1 2016 Russian Grand Prix - Race Chart and Driver Battlemaps

From the perspective of race winner ROS, the on-track race history chart shows a relatively straighforward race, other than having to cope with traffic around lap 30 and then again from laps 43 to 46 or so.

There chart also shows a significant battle for 7th place throughout the race.

Despite a miserable Saturday, HAM got the opportunity to battle with the Williams of BOT and the Ferrari of RAI for the first third of the race, before getting passed BOT and breaking clear of RAI. Around lap 35 he look as if he might be able to make gains on ROS, but then ROS managed to pull away again, other than when he got caught in traffic.

RAI started to make a comeback towards the end of the race bit was never going to be a real threat...

Or was he? From RAI's perspective, the race looks as if it could have ben on - if only it had been a bit longer!

Second place on the grid BOT was never going to be able to keep ROS honest, although he did manage to fend off HAM for most of the first twenty laps, but then he lost out to both HAM and RAI, with RAI pulling away into the distance at a rate of knots from lap 40. Behind, teammate MAS could make no ground for the middle third of the race, and then fell further back over the last laps.
Indeed, for the last to thirds of the race, MAS was largely on his own...
ALO doesn't look as if he has much chance to race once he managed to pull away from GRO. VES was pulling away with ease ahead until his race came to an unfortunate end. 

MAG had quite an eventful race - after an early battle with GRO, with PAL fighting and then falling of behind, MAG took the place from GRO and began to chase down RIC at a rate of knots. After 5 laps of close fighting, MAG took the position but then failed to make any further progress against ALO a few seconds further up the road, whilst still having to fend off GRO behind.
After and early battle with ALO ahead and MAG behind, ALO pulled ahead to leave GRO still having to defend himself from MAG, and then losing out, spending the remaining 35 laps just out of DRS range ahead, and PER nipping at his heels behind.
PER certainly got a lot of close fought racing in throughout the day; caught between RIC and GUT for the first few laps, he then battled to get passed BUT whilst WEH and then ERI fell off behind. Passing BUT, all he could do was see MAS pull away ahead, but then following a brief battle with SAI he got stuck in a sandwich with GRO ahead and SAI behind, with last few laps free of an immediate threat from behind as SAI fell off and his place taken by BUT.
SAI's start to the race saw his wing mirrors filled with the likes of NAS and BUT, as PAL managed to pull away ahead, only to be pulled back in and passed a few laps later. SAI then got caught in a range of tussles with GRO, PER and BUT, and ended his race with everything falling away as BUT pulled away and RIC started to charge him down from behind.

BUT was back in the thick of the midfield, fending off WEH to start as he fought to pass NAS ahead, then challenging SAI as PER took over the offensive behind. The middle of the race saw him charge down, and pass, PAL, before getting stuck behind SAI until SAI's race went off in the last 5 laps.

Although fighting with various cars ahead for the first 10 laps, ERI spent the first 20 laps fending of RIC behind. After being passed by ALO midway through the race, there was no-one to focus on ahead, but there was RIC on a charge from behind, who then continued to charge on ahead. Behind, KVY posed no threat, but the race was on the last few laps as PAL looked increasingly like he could be caught.

I'm not sure how much RIC was grinning, but I can imagine his teeth were gritted as he chased ERI for two thirds of the race, and then cut down and passed PAL at the end of the race. Behind, MAG was held off for a few laps after charging from behind mid-race, and in the final third, ERI could only go backwards behind.

After a close convoy ahead and behind at the start of the race, VAN had some chances at chasing and cutting down cars ahead, first GUT and then WEH. Following a brief mid-race battle with NAS, the rest of the race was spent watching his mirrors as the leading cars came up to lap him.

(All the above readings are based  solely on what's depicted in the charts.)