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:
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).
Thanks, I’ll try it right away
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)
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
Can anyone help a noob out please?
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.
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:
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.
Perfect thank you! It’s working as intended. I need to learn JS
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.
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.
The re-analyse option on the activity list view has a checkbox to keep existing intervals.
You can also get this for a range of activities from the API: Swagger UI
Wow thanks I missed that one. Will have to give it a go.
Hi All,
I imagine this is a really basic question but i just don’t understand why this isnt working. Any help for a complete java beginner much appreciated!!
I am recording a field called “Bloodglucose” to my FIT file using the xdrip+ add in on my garmin watch.
The field is called “Bloodglucose” and i can see this when i open the file in fitfileviewer. I am trying to follow the above guidance in order to create fields for a) time spent below 4, b)time spent above 10, c) time spent in range. But im struggling to access the data at all using the below:
//limits
Low_limit=4
High_limit=10
//get streams
Blood_glucose= streams.get(“Bloodglucose”).data
//calculate time spent
let time_low=0
for(let i=0; i<Blood_glucose.length; i++) {
let t=Blood_glucose[i]
if (t<=Low_limit) time_low +=1
}
But i keep getting the error “Invalid stream type [Bloodglucose]” - but this steam definitely exists when i view the FIT file in fitfileviewer. Any ideas what i’m doing wrong?
Thanks for the help,
Rhys