Skip to content
Snippets Groups Projects
Commit b6ecfb23 authored by Eddie J Hunter's avatar Eddie J Hunter
Browse files

Merge branch 'scale-value-error' into 'master'

Scale value error

Closes #59

See merge request !148
parents 66f1bf34 c4c4855d
No related branches found
No related tags found
3 merge requests!166Merge branch master into production,!158Merge branch 'master' into 'production',!148Scale value error
Pipeline #79862 canceled
from os import name
import json
from fastapi import APIRouter, Depends, HTTPException
from starlette.responses import Response
from ... import TimeseriesFactory
from ...algorithm import DbDtAlgorithm
from ...residual import (
calculate,
......@@ -44,6 +44,9 @@ def get_dbdt(
)
def calculate_residual(reading: Reading, adjust_reference: bool = True):
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:
raise HTTPException(status_code=400, detail=str(e))
from typing import Optional
from .Measurement import Measurement
from pydantic import BaseModel
......@@ -14,4 +13,4 @@ class Diagnostics(BaseModel):
"""
inclination: float
meridian: float
meridian: Optional[float] = None
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment