def updateSensors(): # Run Diagnostics try: Diagnostics.updateDiagnostic() except Exception as exception: print("@", exception) #update sensor handler try: sensorHandler.update() except Exception as exception: print("@", exception) #update both joystick position joystick1.setBatPosition(sensorHandler.get_knob_A()) joystick2.setBatPosition((sensorHandler.get_knob_B()))
def semiGWR(semiGWRMod): """ get diagnostics for semiGWR model """ if semiGWRMod.mType == 0: # Gaussian model semiGWRMod.aic = Diagnostics.get_AIC_GWR(semiGWRMod) semiGWRMod.aicc = Diagnostics.get_AICc_GWR(semiGWRMod) semiGWRMod.bic = Diagnostics.get_BIC_GWR(semiGWRMod) semiGWRMod.cv = Diagnostics.get_CV_GWR(semiGWRMod) semiGWRMod.R2 = Diagnostics.r2_GWR(semiGWRMod) semiGWRMod.R2_adj = Diagnostics.ar2_GWR(semiGWRMod) else: semiGWRMod.aic = Diagnostics.get_AIC_GWGLM(semiGWRMod) semiGWRMod.aicc = Diagnostics.get_AICc_GWGLM(semiGWRMod) semiGWRMod.bic = Diagnostics.get_BIC_GWGLM(semiGWRMod) semiGWRMod.dev_null = Diagnostics.dev_mod_GLM(semiGWRMod) semiGWRMod.pdev = 1.0 - semiGWRMod.dev_res/semiGWRMod.dev_null summary_semiGWR(semiGWRMod)
def GWGLM(GWRMod): """ get diagnostics for GWGLM model """ if GWRMod.mType == 0: GWRMod.aic = Diagnostics.get_AIC_GWR(GWRMod) GWRMod.aicc = Diagnostics.get_AICc_GWR(GWRMod) GWRMod.bic = Diagnostics.get_BIC_GWR(GWRMod) GWRMod.cv = Diagnostics.get_CV_GWR(GWRMod) GWRMod.R2 = Diagnostics.r2_GWR(GWRMod) GWRMod.R2_adj = Diagnostics.ar2_GWR(GWRMod) else: GWRMod.aic = Diagnostics.get_AIC_GWGLM(GWRMod) GWRMod.aicc = Diagnostics.get_AICc_GWGLM(GWRMod) GWRMod.bic = Diagnostics.get_BIC_GWGLM(GWRMod) #GWGLMMod.dev_res = Diagnostics.dev_res_GWGLM(GWGLMMod) GWRMod.dev_null = Diagnostics.dev_mod_GLM(GWRMod) GWRMod.pdev = 1.0 - GWRMod.dev_res/GWRMod.dev_null summary_GWGLM(GWRMod)
def main(path): # Read excel files filepath = path + ".xlsx" currentSettings = Read_Settings.Read_Settings(filepath) res_List = Read_File.Read_File(filepath, currentSettings) opSettings = calcSettings.calcSettings(currentSettings, res_List) feasible = Diagnostics.diagnostics(currentSettings, res_List, opSettings, path) if feasible: diagScheduler.scheduler(currentSettings, res_List, opSettings, currentSettings.test_time, path, False) else: SaskScheduler.infeasibleScheduler(currentSettings, res_List, opSettings, currentSettings.test_time, path)
print('Number of time steps in the original signal:' + str(N)) print('Number of time steps in the padded array:' + str(N_pad)) print('Number of scales for the orthogonal transform:' + str(J-1)) #Prepare the arrays to hold all the moments: V_moments_vs_j = np.zeros((3,J, 3, 5)) #at 3 times, for all 3 components, versus J for 5 different moments (2nd, 3rd, 4th, 5th, 6th) vpar_moments_vs_j = np.zeros((3,J, 5)) vperp_moments_vs_j = np.zeros((3,J, 5)) scale_j = np.zeros(J) #approximate time scale corresponding to some given J in the real physical units for j in range(J): """Extract that selected scale for all the particles and all the vector components over a given time window specified by t_ind_low and t_ind_high:""" # Mu_j_full= Diagnostics.new_extract_scale(coefs_mu, j, wavelet, mode, 0 ,N) V_j_full = Diagnostics.new_extract_scale(coefs_V, j, wavelet, mode, 0, N) E_j_full = Diagnostics.new_extract_scale(coefs_E, j, wavelet, mode, 0, N) b_j_full = Diagnostics.new_extract_scale(coefs_b, j, wavelet, mode, 0, N) V_par_j_full = Diagnostics.new_extract_scale(coefs_V_par, j, wavelet, mode, 0, N) V_perp_j_full = Diagnostics.new_extract_scale(coefs_V_perp, j, wavelet, mode, 0, N) vpar_j_full = Diagnostics.new_extract_scale(coefs_vpar, j, wavelet, mode, 0, N) vperp_j_full = Diagnostics.new_extract_scale(coefs_vperp, j, wavelet, mode, 0, N) # Acc_mag_j_full = Diagnostics.new_extract_scale(coefs_Acc_mag, j, wavelet, mode ,0 ,N) # Acc_par_j_full = Diagnostics.new_extract_scale(coefs_Acc_par, j, wavelet, mode ,0 ,N) # Acc_perp1_j_full = Diagnostics.new_extract_scale(coefs_Acc_perp1, j, wavelet, mode ,0 ,N) # Acc_perp2_j_full = Diagnostics.new_extract_scale(coefs_Acc_perp2, j, wavelet, mode ,0 ,N) # scale_j[j] = time[int(N_pad//len(coefs_vpar[j][0]))] - time[0]
def GLM(GLMMod): """ get diagnostics for GLM model """ if GLMMod.mType == 0: GLMMod.t_stat = Diagnostics.tstat_GLM(GLMMod) GLMMod.f_stat = Diagnostics.fstat_OLS(GLMMod) GLMMod.r2 = Diagnostics.r2_OLS(GLMMod) GLMMod.ar2 = Diagnostics.ar2_OLS(GLMMod) GLMMod.cv = Diagnostics.get_CV_OLS(GLMMod) GLMMod.sig2ML = GLMMod.sigma2_n GLMMod.mulColli = Diagnostics.ci_OLS(GLMMod) #summary_OLS(GLMMod) else: GLMMod.dev_null = Diagnostics.dev_mod_GLM(GLMMod) GLMMod.pdev = 1.0 - GLMMod.dev_res/GLMMod.dev_null GLMMod.t_stat = Diagnostics.tstat_GLM(GLMMod, True) #GLMMod.std_err = Diagnostics.se_betas_GLM(GLMMod) GLMMod.aic = Diagnostics.get_AIC_GLM(GLMMod) GLMMod.aicc = Diagnostics.get_AICc_GLM(GLMMod) GLMMod.bic = Diagnostics.get_BIC_GLM(GLMMod) summary_GLM(GLMMod)
import sys sys.path.append('/usr/share/oslockdown') sys.path.append('/usr/share/oslockdown/lib/python') ALLOW_DISCRETE_MODULES = False #ALLOW_DISCRETE_MODULES = True try: import warnings warnings.simplefilter("ignore", DeprecationWarning) except: pass try: import Diagnostics results = Diagnostics.sbDirectories() if results != True: sys.exit(4) except ImportError, err: print "ERROR: Unable to load 'Diagnostics' module: %s" % err sys.exit(1) ############################################################################### # Don't worry if you've already loaded modules in the Diagnostics phase. # Python is pretty smart. import os import stat import time import atexit import pwd import signal