Try
{
for (let m of icu.fit.record) {
data.setAt(m.timestamp.value, m[‘Effort Pace’]?.value)
}
}
Try
{
for (let m of icu.fit.record) {
data.setAt(m.timestamp.value, m[‘Effort Pace’]?.value)
}
}
Thank you, that works!
I’ve made a custom stream to display the Garmin Edge battery status over time. It kinda works, but the data is only once per minute, and the graph only displays peaks at that exact time, instead of just keeping the last value until the value is updated.
This is the code:
{
for (let m of icu.fit) {
// Only view mesg_num 104
if (m._num !== 104) continue
// Timestamp is in field 253
let ts=m.f_253.onlyvalue
// Battery percentage is in field 2
if (ts) data.setAt(ts, m.f_2.value)
}
}
What am I missing?
You need to add a post processing step to fill in the missing values with the previous value:
{
for (let m of icu.fit) {
if (m._num !== 104) continue
let ts = m.f_253.value
if (ts) data.setAt(ts, m.f_2.value)
}
let prev
for (let i = 0; i < data.length; i++) {
if (data[i]) prev = data[i]
else data[i] = prev
}
}
Hello David, hello all contributors & users !
I am trying to create my own activity streams graphics, and I am facing some issues to catch the data from the fit file (as it seems from my different attempts)
If you have some ideas/solutions/tips this would be greatly helpful !
I also give the bike computer type : Wahoo elemnt (in case someone found the right names/formats)
Blockquote
{
let alt = icu.streams.altitude
let dist = icu.streams.distance
let cad = icu.streams.cadence
let vit = icu.streams.Speed
let temp = icu.streams.Temperature
let grade = icu.streams.Grade
let kg = activity.icu_weight+16
// for (let m of icu.fit) {
// data.setAt(m.timestamp.value, m.Speed?.value)
// }
for (let i = 0; i < data.length; i++) data[i] = vit[i]
}
in my for loop i would compute some values based on the different one from the streams. Here is just a test to display each of the streams and see which one is blocking and find a solution :
I tried different names for the streams (speed, Speed, spd etc… ) but this is worst as it doesn’t recognize the stream => the error is : Invalid stream type [speed]. So only the spelling here above displayed seems to be found in the fit file… but still data are empty…
in fitfile viewer, we can see the data are present :
on runanalyze, same, I can see the raw data as below :
I tried to replace : “icu.streams” by “icu.fit”, => same results
As you may see in the lines in comments, i tried building the data array with the other way, but not working neither. losing my mind, I tried many different ways (in case of chance), but no…
Hope you could help me a bit here !
Thank you in advance for your answers !
Best regards,
Pask
Intervals.icu maps many “standard” fields from the fit file records to different names internally. Some of this is to match the names Strava uses since that is how this project started.
You can see the names here:
https://forum.intervals.icu/t/server-side-data-model-for-scripts/25781#ActivityStream
So it’s velocity_smooth instead of speed and so on.
Stream names that start with a Capital letter are for custom streams which may or may not exist. That is why you don’t get an error for “Speed” but do for “speed” (no such standard stream).
I made a custom activity stream which displays correctly when I click on the “play arrow”. But in the activity page the graph doesn’t get displayed.
The fit file is re-processed and the process fit file box is ticked.
Any idea what could be wrong?
I had some trouble with a stream having a space in the name. Had to use
{
for (let m of icu.fit.record) {
data.setAt(m.timestamp.value, m[‘Effort Pace’]?.value)
}
}
To get it right.
Could also be a problem with the default axis values if you convert Pace/Speed…
Can you show screenshot of the Type and Script tabs?
Two remarks:
Changed code to the following, in order to handle the 0 values better. But still doesn’t render anything.
{
let streams = icu.streams;
let act = icu.activity;
let pwr = streams.get('fixed_watts').data;
let left_torque = streams.get('left_torque_effectiveness').data;
let left_leg_power = streams.get('PowerLeftLeg').data;
let minThreshold = 0; // Minimum threshold for valid values
let maxThreshold = 1000; // Maximum threshold for valid values
for (let i = 0; i < left_leg_power.length; i++) {
if (left_torque[i] === 0 || left_leg_power[i] === 0) {
data[i] = 0;
} else {
let calculatedValue = (left_leg_power[i] * 100) / left_torque[i];if (!isFinite(calculatedValue) || calculatedValue < minThreshold || calculatedValue > maxThreshold) {
data[i] = 0;
} else {
data[i] = calculatedValue;
}
}
}
}
I just had a look at that stream on one of your activities (18th August) and it seems to be rendering now? Is it working for you now?
He’s got it working by deleting the custom stream first and starting over with the same code. Probably was a cache error.
I’m trying to create a left/right balance metric as a custom stream from the fit file.
What values do I need to output in the data array to have a “50/50” metric ?
The following code is not showing data in the graph:
{
let streams = icu.streams;
let act = icu.activity;
let gpr_l = streams.get('GPRL').data;
let gpr_r = streams.get('GPRR').data;
for (let i = 0; i < gpr_l.length; i++) {
let sum = gpr_l[i] + gpr_r[i];
data[i] = (gpr_l[i] / sum) * 100
}
}
There is custom plotting code to handle the built in left_right_balance stream. That stream is stored as “% of right leg” so 65 means 35% from left leg, 65% from right leg displayed as “35/65”. Currently you can’t flag a custom stream as L/R balance to get that display and plot.
Why do you need to recreate L/R balance?
It’s not the same L/R balance as the one which is already available.
I’m investigating my L/R imbalance, and for that I created some custom streams (Gross Power Released, Gross Power Absorbed, Net Power Released).
But the L/R balance for GPR and GPA would also be useful to see.
Based on this article: Investigating Power Asymmetry using Pedaling Metrics – Spare Cycles
Hi Davids, as I would also like to investigate my “net power released” and gross powers released and absorbed, and the balances of these – I though I use the custom activity streams of @David_Scheers
I found some but not all streams I would like to use – do, e.g., the “power absorbed” streams exist and are public, @David_Scheers ?
However, more importantly, I could select and add the customs streams to my analysis – nut using them in my activity pages does not seem to work:-o
Standard (timeline charts) do not sho at all, a heat map I created (GPR L?R vs. power) does not render, or, does not render anything but the heading/title.
Do this streams work and should I be able to use them?
Is there anything special I need to do?
I am looking at activities recored using Assioma Duos.
These are all the custom streams I created. They should all be public.
Then I use these streams in custom graphs, where I apply a moving average to the stream, to smooth out the fluctuations.
Thanks, yes, I can see and “choose” all of these.
Creating a timeline chart with the left/right leg power works. If I create a chart – or more accurately add the plot to a chart – with, e.g., the GPR streams the chart disappears from my timeline. It is still listed in the charts, but the graphics box disappears. This is for activities which do display TE and PS… :-o
Any idea?
@David , how would one “debug” this problem?
There is a lot going on here. Could you please add a new tab to the activity detail view with just the minimum number of charts etc. to demonstrate this problem. Tx.