Computed activity fields

Just reverse the terms and be careful with upper/lower case and with field code spelling:

activity.isNew ? activity.VO2maxGarmin * 3.5 / 65536 : activity.VO2maxGarmin
3 Likes

EDIT: Figured it out. Speed is in m/s and need to convert to KMH by multiply 3.6

Help?
How come this either doesn’t work (wrong data/number) or doesn’t have data? (I did the Activty-Analyse)

All data in m/s can be automatically formatted as pace using the recent option added for that:

Or do you need especially km/h?

Yea. I would like to see Max Speed during a Ride. So, kmh

1 Like

Is supporting this for filters on the roadmap as well? Would be really nice to be able to use the same custom computed fields as a filter on either the activity list view or in the fitness graphs

You can do this using the new powerCurve object (available as icu.powerCurve). I have edited the top post and there is some more detail here:

1 Like

Just added: If the field has multiple values you can use array index notation to extract the one you want:

avg_left_power_phase[2]

To get the 3rd value (first has index 0).

3 Likes

Thanks, I’ll try it right away :+1:

Late to the party here. Using this is it possible to get the max 5min power, max 20min power etc from within an activity? Are these the actual/raw power data or is this fitted to a curve?

This could potentially save me days of processing!!

Thanks

John

Just to clarify, ultimately what I’m after is the data that sits behind an individual activity power curve over the API.

Yes you can get those. This will give you the best 5m power for the activity from the actual power duration curve (not modelled):

icu.powerCurve.getWatts(5 * 60)
1 Like

Perfect, thanks. I can build a little comma delimited string which I can access in the API to get a range of max powers for times.

You’ve just saved me a tonne of work :slight_smile:

1 Like

Can anyone help a noob out please? :slight_smile:

I’m reverse engineering a few scripts created by the fantastic users here, but namely one created by @Povedano which calculates for an activity time spent in a certain % of your MaxHR.

I am looking to use this as the basis of showing time spent above 90% MaxHR. Now this should be as simple as adjusting the numbers in the script but it doesn’t seem to work…

If I change the values up to 85% MaxHR it shows correct values which align with the HR Curve accordingly, but if I change the number to anything above the 85% value, then nothing is returned, even though the HR Curve shows time above this MaxHR value…

I am sure I am missing something… some screenshots.

image

image

Thanks! Any tips on where to lean more about the coding language etc greatly received.

It’s JavaScript but running in a sandbox on the server.
I found the Fundamentals part of this tutorial very useful to start ‘reading’ existing scripts:

2 Likes

You can comment or remove this line at the end to always return a value, not only when time between percentages is the most time spent in the workout:

I think the HR curve goes the other way, I mean, in your screenshot, you have spent 26min above your 85.1% of HRmax.

Edit: After reading you again, you understand perfectly the HR curve, just need to remove the condition I’ve told you above.

1 Like

Perfect thank you! It’s working as intended. I need to learn JS :wink::grinning:

1 Like

Quick follow up. Do I need to “re analyse” all my activities for the value to show up in each activity?

I’m afraid so. For me is so bad because I have several workouts planned that not match with the actual activity, so I have to go back to drag n’ drop again. I also have to block the intervals on each activity once again…

Perhaps we can ask for a feature request to @david to have a new action for all the activities to recalculate only custom fields.

2 Likes

Hey, I am studying my running “Flight Time” for a good build, however my watch and strap combo don’t show me this information. I think I can get it removing the ground contact time (GCT) from the time I spend between steps (getting this from the steps per minute). This is the formula I have come out:

(60 / (activity.average_cadence * 2) * 1000) - activity.GCT

I have created a public custom activity field to test it (it uses the GCT custom field that I get from Garmin fit field). The values I get make sense to me, do you people think it is correct?

It can be calculated by running the script per activity too. But that is only good news if you need just to do a couple of them. Then it saves you the work of reworking all intervals.