Archive for the 'Sports' Category

Strava “API” and privacy leaks.

Monday, July 8th, 2013

I previously had some pages which used the Strava API to do useful things for me, the one I used most was seeing who rode climbs together, it simply used the API to see everyone who rode a segment and then tracked their start times so you could see who was riding with who. It was also really useful to see changes in time between groups in a race. ie the break started a lap 2 minutes ahead and then next lap only 1 minute.

Strava killed their previous API though, and despite an initial promise from them for me to have access to their new API if I agreed to remove their embarrasing GPX export service which revealed the private zones of peoples rides, I never got access, they just stopped emailing. (The privacy flaw was in their export, not in anything I did…).

I’m stuck here now without access to the useful features, so I’ve started looking for a replacement. I don’t have access to their new APIs, and in fact I don’t think I’d bother investing the time in them anyway, once bitten… But I started looking at the services they use to populate the pages themselves. An immediate thing hits me, their page API allows access to private activities.

Accessing private activities

Here’s a private run of mine, you won’t be able to see it, however here’s a JSON file of the exact run. So as long as you know the ID of a users ride, you can get all the info about it. It also completely ignores the privacy zones you have configured when exporting a private ride. A public version the same as the last run this has a privacy zone (it’s only hiding a sports club which is the start for these races, it’s not my house!) and you can see from exporting this one that the points within the privacy zone are reset to 0,0 rather than the actual lat/lon. Yet on the fully private activity, those same points were available, private activities actually provide more risk to revealing your location than public ones.

Private rides are just security through obscurity, and the ID’s aren’t even that obscure, don’t give Strava data that you actually want private.

Distances within privacy zones are provided

Another privacy flaw here is that while the lat/lon’s on public rides in your privacy zone are hidden, the distances you travel for each of those points in the private zone are not, so it’s a pretty easy algorithm to get back to very close to the start of your ride/run unless you do some laps inside your zone or something similar to obfuscate it. Altitude is also provided for the points within the zone, so that may reveal more for those of you who don’t live in flat lands.

Strava Lack of time?

Strava have repeatedly said their reason for not supporting old API’s or for providing access to the new API is lack of time. I guess I can now believe this, as they don’t even appear to have the time to invest in even basic honouring of their privacy assurances. I did try emailing them before publishing this, and then tried twitter but still no response.

Exporting GPX from Strava

Monday, September 5th, 2011

I knocked up a greasemonkey script to get GPX routes out of Strava, to help you know exactly where the segments start and finish. The script lets you Export GPX rides and segments from Strava. At the moment it’s very rudimentary with just the route being created. It would be quite easy to add way markers or course points to it to highlight when you were approaching the start or finish of a segment, but for now I just kept it super simple.

Measuring Fitness and Training Stress

Tuesday, October 26th, 2010

Successful events, come from successful training, you need to train to increase your fitness, constantly creating stimulus on your body to build bigger muscles, more efficient engines and everything it takes, but not so much stimulus that your body is so damaged it takes a long time to rebuild, or you get into a chronic fatigue situation. At the same time your body is incredibly lazy, and if you don’t work it more than its current level, it just sits there content that it’s fit enough for the demands.

So the goal is to balance increasing the good stress that builds fitness, but limits the bad stress that stops you training, and maybe even worse knocks you out for months. There’s also another side of successful events, that of being not so fatigued from the recent training that you’re literally too tired out and damaged to do well. Essentially, this is often expressed as

Form = Fitness - Fatigue.

So how do you manage this? Lots of ways, but the geeky way is to evaluate each workout as to how much fatigue it caused you and how much fitness it will reward you with in the future, and then average out all the workouts to come out with some numbers which tell you your form, your fatigue and your fitness.

Training is essentially a mix of frequency, intensity and duration, but how do you compare different workouts - say five 1 mile repeats at a high intensity, a 10 mile tempo run, or an easier 15miles. Which was harder, which was more useful training, does it even make sense to compare them? I think it does, and if not, you couldn’t evaluate more than one session anyway, so we’re going to give each workout a score.

Measuring duration sounds pretty easy - you need a watch. The only question becomes what to do with time when you stop, should the time you spend stopped be counted as part of a workout.

Measuring Intensity

Intensity is harder, and measuring intensity is the fundamental problem of scoring a workout.

For cycling, if you have a power meter, you can measure intensity pretty directly by the power you produce, this is how Training Peaks and WKO+ does it, using the ratio of the Normalized Power for the ride to your FTP to get your “intensity factor” to produce the Training Stress Score (IF^2 * duration).

For running, on flat, consistent ground, pace is a very good measure of intensity, and WKO+ / Training Peaks again uses this, however it attempts to deal with hills by creating a “Normalized Graded Pace” for your run as if it was on flat ground. And uses this pace relative to your Threshold pace for creating the intensity factor (plus a 10% extra because it’s a run…) The big problem with this is ground surface, running in mud, track or tarmac is completely different and using pace has no way to address this, so it’ll never give you good results for cross country running or if you don’t have accurate elevation data for your runs. If you run similar surfaces and roads it does a good job though.

For both running and cycling heart rate shows a strong correlation with intensity, it can be depressed or elevated for various reasons, it falls down particularly at discerning between near maximal efforts, but there’s still a strong correlation. Heart Rate response is not linear though - progressively more stress is done at the higher heart rates than at the lower ones, so you need to scale the intensity with the effort. This has been called training impulse or TRIMP The scaling is generally designed to mirror the blood lactate response of a person (the WKO Power model is similarly designed, being inspired by this TRIMP model.)

One problem with the Power and Pace model of intensity is that it’s highly dependant on accurate determination of your threshold power and pace, which are volatile targets, hopefully improving considerably as you train, so you can end up with inflated scores before you realise your thresholds have changed. In established athletes with pretty stable values this is less of a problem, in less trained people improving rapidly it’s more of a problem. There’s also a problem with cycling that your threshold is actually a bit of a moving target, different courses can make a difference - a 1 hour hill climb will generally produce higher watts than a 1 hour flat ride, which FTP do you use?

Because I can’t use running pace, I run on too wide a variety of surfaces even within a ride and without accurate elevation data for even my regular routes. And because I want to use a single measure I use the TRIMP model for everything, although I always look closely at how the Power based model compares when I cycle with my power meter. In all but a few cases it’s near enough identical, in the few cases it’s not there’s often a reason I understand and I can choose to override a score or not - but the power one is as often out as the HR one it seems - I’ll visit a full analysis of this in a later post.


Once you have your score for an individual session, you need to mix them together to track your Fitness, and your Fatigue. Your fitness is simply all your workouts for a recent time combined together to create a score for today, your fatigue is the same. The difference being the time period that you measure for. To combine the workouts, rather than a simple average it’s a weighted average so that the more recent training is worth more than older training. ie the fatigue caused by yesterdays workout is more than last weeks workout.

The fatigue - the average of your recent Training Scores, is called your ATL (Acute Training Load), and typically set up to respond to the previous 5-15 days of training.

The fitness - the average of your longer Training Scores, is called your CTL (Chronic Training Load), and typically set up to respond to the previous 6 weeks of training.

The form - the difference between your Fitness and your Fatigue, is called your TSB (Training Stress Balance) and is simply the difference between your CTL and ATL.

When your ATL is higher than your CTL, you’re likely fatigued, and the larger negative the TSB is the more fatigued you are. When it’s positive you’re likely in good form. However, if it’s largely positive, that can only have happened if you’ve severely reduced or stopped your training, so whilst you may be very un-fatigued, you’ll also not be very fit.

Automating the calculation

Raceday and WKO track this based on power and pace for running and cycling, Golden Cheetah does it for cycling using power (or HR in the very latest build), and the general principles are the same as below, but as I’m advocating Heart Rate, I’m going to talk about what I use the Training Load Plugin in SportTracks. It will use Power like the others, but by default it uses Heart Rate.

Because it uses HR, you need to configure it. First you need to ensure that you have your HR zones configured and they are reasonably right for you, the ST forum has a little info on this. Personally, I use 6 zones, zone 0 for essentially resting, HR below 103, and a classic 5 Zone system, but you can do whatever you want, so long as the zones reasonably match your HR profile.

Heart rate zones reflecting high heart rate has a high zone

You can of course have different HR zones for Cycling and running, or indeed any other sport. Once your HR zones are set up, you also need to set up the factors in Training Load to reflect the different intensities. Again here are mine:

Factors for different heart rates reflecting time spent in high zones is worth more

The important fact is that the values get progressively bigger as the HR values get larger, so 1 minute at a high HR contributes more to your score than 1 minute at a lower HR. My values for running are different:

HR zones are higher multiples as I find cycling more stressful

They’re all higher, this is because for me, running causes considerably more stress, it hurts the muscles more etc, so I want it to contribute a higher value to the ATL than otherwise.

The result, the shiny graphs

The result is some graphs, showing how your training load has changed over the past (click for larger view)

My training load a varied graph showing how my fitness goes up and down

As you can see from the graph, which is my training between March 2008 and March 2010, pretty much when I returned to training as a slow, overweight, average mid 30’s geek. The blue shaded area is my CTL, as you can see it rose gradually into the 60’s, declined throughout the summer and then rose again as I trained for a marathon - the large bar showing a large TSS in Nov 2008. You can see the taper before the marathon as the red line - showing ATL - drops below the blue immediately before the event.

2009 was much more up and down, as I aimlessly cycle raced, but maintained a general higher fitness (ie more training!) than I did in 2008, and at the end of the graph I’m extremely fatigued with a high CTL - from 10 days and 41 hours of training in Lanzarote.

You can use the CTL and TSB to predict performance, you’re likely to do very well when your TSB is near 0, it may be that you do best with a little -ve or a little +ve. People are different, and events are different, many people find with intense events a small -ve TSB is advantageous.

The Problem of Specificity

All training isn’t equal of course, and CTL/ATL and TSB, is only relevant if the training is appropriate to your event, or specific as it’s commonly known. If you look at my graph above and look at the high training load I had in June, you’d think I could’ve run a good strong 10km race. However, I couldn’t, and if you look again just for running, you’ll see why.

Running graph, much smaller than the cycling graph

This clearly shows running is pretty much a winter sport for me (although the big rise in October 2009 was actually in Hawaii when I didn’t have a bike) and my Sport Specific CTL in running is tiny during the summer, I barely run once or twice a month.

This just means, whilst you can use overall ATL as a good guide for if you’re overtrained, or undertrained etc. It doesn’t remove you of the need to keep your workouts relevant to your event. It also means you probably want to track different sports seperately too.

Does it matter how accurate the factors are?

It doesn’t actually matter if you get the numbers exactly right, since the important things are the shape and patterns, not the absolute numbers. Generally though people try and calibrate it such that 100 is 1 hour all out.

Another thing to remember is that you’re measuring training stress, so if you increase the duration of the workout but aren’t training during it, then it’s important that this isn’t counted in the final result. That’s why there’s a zone 0 in my HR factors, this is another problem with TSS used in Training Peaks and WKO, it’s inflated by stop time, or long descents where you’re essentially doing nothing. Sixty minutes climbing Alp d’Huez and then Twenty minutes descending never pedalling should not actually give you any more training stress than sixty minutes climbing and twenty minutes sitting on a coach driving down. So you need to be a little careful if you use power to avoid inflating your TSS via duration at an intensity which isn’t really a workout.

Further reading:

  1. Morton et al. 1990 paper on modelling performance
  2. Performance manager chart in WKO / Training Peaks
  3. Charles Howe on Performance manager
  4. Training Load plugin forum
  5. Using performance manager to peak an IM

This was repurposed from a blog post on tritalk, I wanted to rescue it in case it ever disappeared

Training like the pro’s

Wednesday, October 20th, 2010

Everyone seems to want to train like professionals, they look at the professional rider or runner and try an imitate what they do in their own training. The coaches of these pros get the reputation and make the money spoon feeding their experiences of hows pros train to the masses. But few amateurs can train like pros for so many reasons, so why does everyone want to?

Professional Athletes

  • Have forty hours a week to train.
  • Are close to their limits of potential
  • Have at least 5-10 years hard training behind them before they become pro.
  • Have to perform either every week, or for a single event a year.
  • Need a holiday from their job.
  • Dope (maybe).

Amateur Athletes

  • Have eight hours a week to train.
  • Have barely touched their potential.
  • Are in there first years of training.
  • Race when they want to, and when they can.
  • Sport is a holiday from their job.
  • Drink, eat, party (maybe).

Forty hours vs Eight hours

Professional athletes have nothing but their training to do with their time, it’s their job, everything else is secondary, the amateur has to fit their training in around their job. The professional is forced by simple energy requirements to do a particular sort of training for a lot of their time, they simply can’t eat enough to go harder. They’re forced to split their hours say 80%, 15%, 5% in different zones, the amateur however can do split their hours differently as they don’t have the same limits.

So because a pro spends 28 hours of their time with their heart rate below 75% of maximum doesn’t say anything about what an amateur with eight hours available should do, any more than the fact a pro spends 12 hours with their heart rate above 75% does.

Limits approached vs heaps of potential

When you’re unfit, there are very rapid gains to be had, your VO2max rapidly responds to training, your neuromuscular pathways get the muscles moving better and there’s plenty of room for your muscles to get bigger or to adapt to get more fuel and oxygen to them. The trained athlete who’s been doing this for years though doesn’t have that anymore, their VO2max will be close to their genetic limit, their muscles will already be packed full of capillaries.

So the response to training is different, but that also means the type of training to elicit that response need not be the same

Ten years background vs Six months background

Certain components of fitness come from shere volume, having years of running behind you has completed the adaptations that let you run for hours every week logging mile after mile. The body has had time to build all the adaptations it needs, the amateur doesn’t have this, and their body is also likely still changing a lot as the weight comes off from the new found exercise.

70miles per week running is maybe reasonable after five years of adaptations, but crazy after six months.

Important races vs race when you want to

Professional sportsmen have very specific demands on when they do well, for some that is one chance every four years at an olympics, for others, they have to perform every week for months on end through there on season. The amateur athlete can do an event anytime in the year, any place, any where.

Holiday from sport vs sport is holiday

When your job is training and competing every day, you’ll need a decent break where you stop doing the things you do all the time and kick back, relax, do something different - drink, party etc. So taking a holiday from training makes sense. If you’re doing the sport because you enjoy it, taking a break becomes a self enforced torture as you’re desperate to do the things you enjoy.

Taking a break from your job is likely done for a different reason than taking a break from your training, don’t confuse the two.

Doping vs Drinking

Whilst not all professional athletes dope of course, many do, and many of the big name coaches made their names coaching doped athletes. In some periods it was impossible to even make the start line unless you were doping - endurance sports in the early 90’s for example, EPO was so abused you had little choice. Doping changes how you train, even if not how you can compete, the doped athletes recovery will be faster, they’ll be able to go harder in sessions, everything is different it’s not just working at a higher level. The amateur athlete tends to abuse their body in a lot different way, drinking, partying etc. these effect training differently again.

Four pints on a saturday night will effect sundays workout very differently from a large dose of Human Growth Hormone, the beers will hurt you.

You’re different.

Professionals are different to amateurs, planning your training can be good and helpful, but doing the same as a professional but in a cut down form is unlikely to be logical. Everyone needs training which helps deal with their limiters, professional and an amateurs limiters are likely to be radically different so the training should be different.

Simplest and Quickest Jibbering Gel Recipe

Monday, June 7th, 2010

After continuing to experiment with making my own energy gels, I’ve now finally settled on what the quickest and easiest recipe and settled on the steps.


  • 500g Maltodextrin
  • 250ml of Water
  • 120ml of Innocent Fruit Smoothie (Other pure fruit brands would work too)
  • 50ml Pectin
  • ~1 teaspoon citric acid
  • 8g BCAA
  • 1g Beta Alanine
  • 2g L-Histidine
  • 0.8g Caffeine if you want a caffeine gel

The method

Add 250ml of just boiled water to a measuring jug, and then mix in the Amino acids and caffeine etc. first, stirring well as these are the least soluble. Then mix in the 500g of malto. Do it cautiously with about 50-100g at a time to avoid clumps, but it should dissolve pretty easily in the hot water.

Transfer to a pan, add the Smoothie, then add the pectin and citric acid, the citric acid may not be needed if you’re using a more acidic smoothie (such as a berry based one) and heat it up to ensure it’s above 80C, either using a sugar thermometer, or just guess if it’s bubbling up, it’s more than hot enough

Allow to cool briefly, and then pour into suitable container whilst still nicely liquid. Allow to cool, and then refigerate. Cooling time does seem to impact the texture, if you cool it rapidly (e.g. cold water bath in fridge) it’s more liquid, no idea on why that might be, but it appears to be the case.

The Result

As always the ingredients are all bought from My Proteinand you can use my referal code MP107371 to get 5% off - you also earn me some points.

Pleasingly I’ve had lots of reports of success with the previous gel recipes, and they’ve continued to work extremely well for me, it’s good to hear how other people go with it, and news of any failures or alternative recipes especially welcome!

Barns Green half marathon race report.

Sunday, November 22nd, 2009

I took most of the year off running, concentrating on cycle racing, with barely a couple of runs a month (generally a 3mile all out race, and a hill session) but I was doing lots of hard cycling miles.

My previous PB for the half marathon was around 1:59 for a standalone half, and 1:43:49 for the half marathon split in a marathon. But I think the goal was a feasible one, as two weeks before the race I did 66:09 for the Cabbage Patch 10mile race.

That race was completely flat though, Barns Green is rolling, and the weather forecast for today, was torrential rain, 30mph winds with gusts up to 45mph. I almost bailed.

It was my running clubs Half Marathon championships, so I had lots of friendly faces, and started off running the first few miles with two of them, and watching the faster club guys come past (not sure why they’d all lined up 200 back, I crossed the start line around 80th or so, which was about right, not held up, not holding anyone else up)

The rain wasn’t as bad as it could’ve been, mostly just drizzle, the winds however were strong, and it’s the first running race where I’ve seen real packs form - not just pacing packs, but actual draft packs, it made a big difference!

The rolling course made my splits tough to know just how even they were - 6:32, 6:39, 6:38, 6:17, 7:11, 6:23 for the first 6 miles, and coming through half way in 44:00 - This worried me, because of the weather I’d scaled back my expectations to getting as close as I could to 1:30, on a good day I was thinking 1:28 was the best I could do. (McMillan reckons a 66:09 10mile is equivalent to 1:27:51 Half, and I normally bias towards the short stuff and Barns Green is tougher than the completely flat Cabbage Patch)

I run on perceived exertion though, so I stuck with the pace I was running. At around 8miles two more guys from my club passed me but I kept them in sight and it was at this point that my running partner from the start of the race dropped behind.

The 10mile marker had been blown away by the wind I guess, as I saw the line on the ground but didn’t hit the watch. Mile 12 became a struggle, all up hill and into the wind, and I was disappointed to see the split come in at 7:26 - although the Garmin has it as a long split.

I knew from 12miles it was all down hill until 400m to go, and I still had 9 minutes to cover the last 1.1 miles. I tried to work to catch the team-mate I could still see ahead. It never happened, but 7:20 for the last 1.1 miles, and a sprint to beat some guy in yellow in the last 100m brought me home in 1:28:25.

Job done, very, very, very happy considering the conditions. I guess I should’ve done better in the Cabbage Patch. A positive split, 44:00 vs 44:25, but not too bad, and I think the course was tougher in the second half.

My Nutrition - went to plan, 100 calories in home made strawberry gels with ~400mg caffeine 20minutes before the start, Gel flask with water/gel mix of around 250calories taken over four seperate evenly spaced shots.

I would recommend Barns Green Half as a race to do, extremely well organised despite the torrential rain and conditions, an interesting and whilst hilly not that slow a course, the hills aren’t steep, so as long as you can descend without braking the undulations help break the monotony. Could do without the long hill at 11miles though.

PowerTap Calibration Checking - the “Stomp Test”

Saturday, November 14th, 2009

To check if your PowerTap is accurate, you can use a “Stomp Test“, applying a known torque to the hub, and seeing if it’s measured correctly. Unfortunately this isn’t possible with alternative head units such as the Garmin 705, 500 or 310xt or other ANT+ units from specialized etc.

On the wattage mailing list Brian Fitzpatrick pointed me at Quarqd a simple daemon that can read ANT+ sport data if you have an ANT+ USB stick such as come with the Garmin 405 or 310xt. Unfortunately it only runs on Mac’s or Linux, but a virtual linux install had it working on my windows XP.

The raw messages out of ANT+ aren’t very useful however. So I knocked up a little Adobe Air application which reads the messages, and assists with the testing.

screenshot of stomper application

You need to install quarqd and have it running, then you can start the AIR application, point it at the instance, set up your bike with the weight on the pedal, enter the bike details, and see how accurate your PowerTap is.

Not ideal, as getting quarqd up and running is relatively painful in itself unless you’re pretty geeky, but it’s better than reading raw XML messages.

Download Stomper application

And the result? Our PowerTap’s are pretty much accurate. As accurate as our weights anyway, maybe some accurately measured weights and some speedplay pedals to hang them off to check even more accurately, but I’m not that worried.

Rotterdam Marathon

Tuesday, April 7th, 2009

I signed up for this marathon in the winter after having unfinished business with the last one having failed to get the 3:30 target. It’s pretty flat, very fast, lots of competitors and well supported. Unfortunately my training’s been very poor, I was sick in December, and simply haven’t been motivated enough to do any long runs since, cycling has been more fun. My longest run pre-marathon was around 10miles. So not great preparation.

Annoyingly the organisers had me as a “recreational” runner, which means unlike the club runners (the majority) or the Elites, I wasn’t chip timed. So I needed to get myself near the front of the pens, and with some dodging and weaving past the crowds of club runners, I managed to end up crossing the start line only 12 seconds after the gun went.

Despite the manouvering, I was still passing a lot of very slow people strung across the road. I normally start too fast anyway, but with the added bonus of lots of people to pass and gaps to find, I started very fast. Up and across the Erasmus Bridge, 2km came by in 7:56, but I was still feeling pretty good running along with everyone and decided to keep at the pace, even if it turned out I couldn’t hold it.

The 5km mark was after a complete 180 turnaround coming back on the same road you were running down, so at 4.75km I could see the marker and looked at my garmin and then it hit me, I was going to get a sub 20minute 5km. But my 5km PB was 20:35, what was I doing going so fast? Sure enough the 5km marker was crossed with 19:38 on the clock, almost a minute off the 5km PB, but I still had the entire rest of the race to go, could I keep the pace up?

I couldn’t, the sun had come out more, and I was really beginning to overheat, I’d dressed for 9C and clouds, and it was about 15C and sunny. I pressed on, two more kilometers went by in 4:09 and 4:06. Then we had another bridge to go over, it wasn’t steep, hardly even a hill. Howevre my hip flexors which were hurting from about 30km in the last marathon began to scream at me today after only 7km, and I only managed the next two km in 4:11 and 4:10. I was definately slowing down a lot by now, but seeing the 9km marker and looking at the Garmin saying 35:55. I decided to press on and really work for the rest of the race, the time was still pretty good.

There were very few people around me, but I guy in blue came past and I tried to keep with him, and then just after a kink in the road, I saw the glorious site of the word FINISH over a gantry, and a clock counting down next do it. I sure was glad I’d swapped to the 10km race from the marathon the day before when collecting the numbers. With about 20m to go, the big clock rolled over the 40:00, and I crossed the line just beating the guy in blue to stop my Garmin at 39:51.

So a very pleasing outcome for the 10km - 93 seconds off of my PB. Marred by some disappointments - the leg pains that slowed me down and the lack of official result, that actually says I ran that time. They don’t even give me a gun time, which would’ve been 40:03, it’s as if I never ran the race.

I know I did, and I know it was a PB, I also know that 39minutes is probably doable on a good day on a similarly fast 10km with some actual training, so that should probably be my next goal