mirror of
https://github.com/nasa/openmct.git
synced 2025-05-03 17:22:56 +00:00
Fixed erroneous data
This commit is contained in:
parent
14722a6ef5
commit
cdc2a407dc
@ -30,7 +30,7 @@ define(
|
|||||||
float: "number",
|
float: "number",
|
||||||
integer: "number",
|
integer: "number",
|
||||||
string: "string"
|
string: "string"
|
||||||
};
|
}
|
||||||
|
|
||||||
function RemsTelemetryModelProvider(adapter){
|
function RemsTelemetryModelProvider(adapter){
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ define(
|
|||||||
key: measurement.identifier,
|
key: measurement.identifier,
|
||||||
ranges: [{
|
ranges: [{
|
||||||
key: "value",
|
key: "value",
|
||||||
name: "Value",
|
name: measurement.units,
|
||||||
units: measurement.units,
|
units: measurement.units,
|
||||||
format: format
|
format: format
|
||||||
}]
|
}]
|
||||||
|
@ -37,21 +37,41 @@ define(
|
|||||||
function RemsTelemetryServerAdapter($q, $http, REMS_WS_URL){
|
function RemsTelemetryServerAdapter($q, $http, REMS_WS_URL){
|
||||||
var histories = {},
|
var histories = {},
|
||||||
deferreds = {};
|
deferreds = {};
|
||||||
|
|
||||||
|
function statisticalRejection(values){
|
||||||
|
//First, calculate mean
|
||||||
|
var mean = values.reduce(function(accumulator, value){
|
||||||
|
return accumulator += parseInt(value.value);
|
||||||
|
}, 0) / values.length;
|
||||||
|
var variance = values.reduce(function(accumulator, value){
|
||||||
|
return accumulator+= Math.pow(parseInt(value.value) - mean, 2);
|
||||||
|
}, 0) / values.length;
|
||||||
|
var stddev = Math.sqrt(variance);
|
||||||
|
return values.filter(function(value){
|
||||||
|
return mean - stddev < parseInt(value.value) && parseInt(value.value) < mean + stddev;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function requestHistory (id) {
|
function requestHistory (id) {
|
||||||
$http.get(REMS_WS_URL).then(
|
$http.get(REMS_WS_URL).then(
|
||||||
function(response){
|
function(response){
|
||||||
|
histories = {};
|
||||||
/**
|
/**
|
||||||
* All history is fetched in one go, cache it all to save round trips to the server on subsequent requests
|
* All history is fetched in one go, cache it all to save round trips to the server on subsequent requests
|
||||||
*/
|
*/
|
||||||
var lastGoodValue=0;
|
|
||||||
response.data.soles.forEach(function(solData){
|
response.data.soles.forEach(function(solData){
|
||||||
for (var prop in solData){
|
for (var prop in solData){
|
||||||
histories[prop] = histories[prop] || [];
|
histories[prop] = histories[prop] || [];
|
||||||
var value = isNaN(solData[prop]) ? lastGoodValue : (lastGoodValue = solData[prop]);
|
if (!isNaN(solData[prop])) {
|
||||||
histories[prop].unshift({date: Date.parse(solData[TERRESTRIAL_DATE]), value: value});
|
//var value = isNaN(solData[prop]) ? lastGoodValue : (lastGoodValue = solData[prop]);
|
||||||
|
histories[prop].unshift({
|
||||||
|
date: Date.parse(solData[TERRESTRIAL_DATE]),
|
||||||
|
value: solData[prop]
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
//deferreds[id].resolve({id: id, values: statisticalRejection(histories[id])});
|
||||||
deferreds[id].resolve({id: id, values: histories[id]});
|
deferreds[id].resolve({id: id, values: histories[id]});
|
||||||
}, function (error){
|
}, function (error){
|
||||||
deferreds[id].reject(error);
|
deferreds[id].reject(error);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user