Archive for the 'cycling' 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!

Another race, another last place

Monday, January 25th, 2010

In the many cycle races I’ve done, my commonest result by far is last, even when I’m not actually last, but just right near the back, the results seem to appear with me last. I tell myself I don’t mind, there really is no difference between 11th and last in most of the races I do, and since becoming a 3rd cat, points mean little, so I just want prizes, and there’s generally only money for the top 5.

Actually what I really want is to be pleased with the race, the results really comes second. Of course if I went a season never getting a result, I’d not be happy. But I’m geeky enough that good numbers, no crashes, and a sense that I didn’t do anything stupid makes for a happy race.

Saturdays race was the Hillingdon winter series 3rd cat only race, and us Kingston Wheelers were out in force. After a very fast start led out when the entire bikefood team decided to take us out for the first 5 laps averaging 42.5km/h against the more normal 40km/h for Hillingdon. Everyone was pretty fresh though, and only a couple of people got caught out enough to be dropped, everyone else just enjoyed the speed. I did more than work than necessary, going back and forth through the group to see how Maryka and the other clubmates were doing and just generally drifting back through inattention and then deciding to move up again.

After the bikefood guys had tired themselves out, the average pace slowed to the more normal 40km/h, but it was the normal up and down of attack / chase / lull. We had many people regularly off the front, but the pack was always very alert, even with some blocking work nothing looked likely to escape. Inevitably when the 3 lap to go board came out, everyone slowed down and we had the slowest lap of the race, and it didn’t speed up much more during the next two. My normal poor position, and the slowness left me struggling to move up on the packed circuit. Coming up to the bell I was midpack and desperate to move up, remembering James’s request for a fast last lap, and if I was anywhere but the front I wouldn’t be able to help with that.

Just before the chicanes the pack slowed so much I was at my slowest speed all race, but as soon as the chicane apexed I was on the outside and had a clean run to the front, I accellerated hard but instead of finding myself at the front of the bunch, I found myself 10m off the front so I kept going hard through the S bend and was now solo away from a baying bunch. 30seconds into it I thought YES! I’ve 50m already I’m going to win here. A minute into it, hurting like crazy I thought NO! why did I start this stupid idea! 90 seconds into it I looked again behind me, and I still had 60 or 70m on the bunch YES! two more corners and just the matter of a 250m hill. At the last corner I look again, and still they’re not close. 50m up the hill, I stand to eke out the last power I have, and find out it’s none, I collapse, the hill chases any speed I have out of me and shortly after 44 riders sweep past and I inch over the line to last place.

So last place, but the stats tell an interesting story. Almost all the time I made up on the bunch was through the S bend, which I did in 42 seconds, rather than a typical 58seconds for the pack. Through the back straight and the two subsequent corners the bunch only gained back a few seconds on me, it was only once I could no longer deliver the power that I was caught. The 42 seconds cost me 580 watts though, so getting away was tough, and left me only managing to deliver 380watts for the remaining 80 seconds of my ill fated solo effort.

In the middle of a club run on sunday, I did 380 watts for almost 7 minutes up Box Hill, so in looking at the raw stats, I should’ve been able to keep it going for the win comfortably, but the previous hour of hard riding had simply taken too much out of me. So now I’m stuck wondering, if I did the same, but without having wasted so much energy in the race, would I have stayed away?

The picture below, taken at the final corner, not long before I blew up, shows another reason I failed.
Me failing in the break
I’m simply too un-aerodynamic to be doing anything solo, I waste so much energy fighting the air. It’s a reason to get a new bike, one suited to racing, and not cycling around the hills in great comfort, the RS is awesome, but I shouldn’t be racing crits on it.

The good turnout by many strong Wheelers has really got me looking forward to the road racing season, when I won’t be there mostly for training, wasting energy, and with more strong wheelers like Damien still to race it should be a fun year!

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.