StephenBlackWasAlreadyTaken / wixel-xDrip

Allow a wixel to function as Dexcom Reciever
Other
47 stars 117 forks source link

Receiving very large numbers for dex_(ppkt->raw) #34

Closed ijustlovemath closed 9 years ago

ijustlovemath commented 9 years ago

Using the wixel as the receiver, I have been getting very weird numbers for my glucose values. My settings:

I added another part to print_packet that shows ppkt->raw. So my output is: 'ppkt->raw dex_num_decoder(ppkt->raw TRANSMITTER_BATTERY WIXELBATTERY'

A couple readings and their associated G4 values:

98: n/a 117888 215 0 89: 36298 141920 215 0 86: 19848 148000 215 0

Am I just not interpreting the values right?

StephenBlackWasAlreadyTaken commented 9 years ago

Im not super sure what you are refering too, if you want to paste your print line here I may be able to help more. But anticipate the raw value to bg conversion to be around ((raw/100)*1.05) - 28 or so, these numbers depend on the age of your sensor and the sensor itself, this is why a calibration algorithm is needed

ijustlovemath commented 9 years ago

Those were the print lines! Just added a field, and put the actual value to the left of the colon. Where did you get that fit? Where can I find the calibration algorithm? Is it in the xDrip source? On Monday, June 8, 2015, Stephen Black notifications@github.com wrote:

Im not super sure what you are refering too, if you want to paste your print line here I may be able to help more. But anticipate the raw value to bg conversion to be around ((raw/100)*1.05) - 28 or so, these numbers depend on the age of your sensor and the sensor itself, this is why a calibration algorithm is needed

— Reply to this email directly or view it on GitHub https://github.com/StephenBlackWasAlreadyTaken/wixel-xDrip/issues/34#issuecomment-110009524 .

StephenBlackWasAlreadyTaken commented 9 years ago

xdrip has its own algorithm that can be found in the calibration model, its a weighted least squares linear regression (weights are age of calibration(linear but should be exponential in the future), sensor confidence(parabolic) and slope confidence(linear)), its split up using LaGrange interpolation because Its the only way I could figgure to write it out in java

https://github.com/StephenBlackWasAlreadyTaken/xDrip/blob/master/app/src/main/java/com/eveningoutpost/dexdrip/Models/Calibration.java#L394

ijustlovemath commented 9 years ago

So raw/1000 is always used, but the coefficients (1.05 and -28) are calculated for the individual using least squares. It's usually a linear fit then? Or did you say exponential was better?

ijustlovemath commented 9 years ago

Also, is the 1.05, -28 the inital approx, for low numbers of values?

StephenBlackWasAlreadyTaken commented 9 years ago

yeah I always divide by 1000 first to get the numbers more familiar, but you dont have to, you could just have your slope account for that. I find there is some curvature at the higher end but its fairly linear, and yeah the 1.05 and the -28 are just rough approximations, a slope of around 1 is fairly common and -30ish seems to be the default intercept, though its not always a good fit, its a good way to estimate if you dont have any calibration data yet

ijustlovemath commented 9 years ago

I can't believe I thought I would avoid using statistics in this project of mine :) Thanks, you've been helpful as always.