Skip to content
Snippets Groups Projects
Commit c0b76a48 authored by Coda Phillips's avatar Coda Phillips
Browse files

Add covariance check

parent 37baa732
No related branches found
No related tags found
No related merge requests found
from util import BaseCheckList
import sklearn.covariance
import scipy.stats
import numpy as np
def thermal_correlation_check(frame, parameters):
return frame
def hbb_covariance_check(frame, parameters):
hbbb_mean = parameters.get('HBBbottomTemp_mean', 333.101)
hbbt_mean = parameters.get('HBBtopTemp_mean', 332.993)
hbba_mean = parameters.get('HBBapexTemp_mean', 332.818)
hbb_contamination = parameters.get('hbb_contamination', .01)
envelope = sklearn.covariance.EllipticEnvelope(store_precision=False, contamination=hbb_contamination)
envelope.location_ = np.array([hbbb_mean, hbbt_mean, hbba_mean])
envelope.covariance_ = np.array([[ 0.0179306 , 0.0164418 , 0.01817402],
[ 0.0164418 , 0.01898899, 0.02326341],
[ 0.01817402, 0.02326341, 0.02968953]])
distances = envelope.mahalanobis(frame[['HBBbottomTemp','HBBtopTemp','HBBapexTemp']]) ** .5
frame['hbb_covariance_check'] = (distances > 6) * 1
return frame
class CheckList(BaseCheckList):
checks = [ thermal_correlation_check ]
checks = [ thermal_correlation_check , hbb_covariance_check]
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