Skip to content
Snippets Groups Projects

Scale value error

2 files
+ 7
5
Compare changes
  • Side-by-side
  • Inline
Files
2
from os import name
import json
 
from fastapi import APIRouter, Depends, HTTPException
from fastapi import APIRouter, Depends, HTTPException
from starlette.responses import Response
from starlette.responses import Response
from ... import TimeseriesFactory
from ...algorithm import DbDtAlgorithm
from ...algorithm import DbDtAlgorithm
from ...residual import (
from ...residual import (
calculate,
calculate,
@@ -44,6 +44,9 @@ def get_dbdt(
@@ -44,6 +44,9 @@ def get_dbdt(
)
)
def calculate_residual(reading: Reading, adjust_reference: bool = True):
def calculate_residual(reading: Reading, adjust_reference: bool = True):
try:
try:
return calculate(reading=reading, adjust_reference=adjust_reference)
calculated = calculate(
 
reading=reading, adjust_reference=adjust_reference
 
).json()
 
return json.loads(calculated.replace("NaN", "null"))
except ValueError as e:
except ValueError as e:
raise HTTPException(status_code=400, detail=str(e))
raise HTTPException(status_code=400, detail=str(e))
Loading