def __init__(self,parent, padX, padY): LabelFrame.__init__(self,parent,borderwidth=0) # Total volume self.totalEstimatedVolume_L = Label(self,text="Estimated total volume (km\u00B3): ") self.totalEstimatedVolume_E = CustomEntry(self,width=10,justify="right") self.totalEstimatedVolume_E.setUserEditable(False) self.totalEstimatedVolume_E.grid(row=0,column=1,padx=10,pady=padY,sticky="E") self.totalEstimatedVolume_L.grid(row=0,column=0,sticky="W",padx=10) # Relative squared error self.relativeSquaredError_L = Label(self,text="Mean relative squared error: ") self.relativeSquaredError_L.grid(row=1,column=0,sticky="W",padx=10,pady=padY) self.relativeSquaredError_E = CustomEntry(self,width=10,justify="right") self.relativeSquaredError_E.grid(row=1,column=1,padx=10,sticky="E") self.relativeSquaredError_E.setUserEditable(False) # Equation self.equation_L = Label(self,text="Equation: ") self.equation_E = CustomEntry(self,width=10,justify="right") self.equation_E.setUserEditable(False) # General self.parameters_L = Label(self,text="Parameters:") self.calculate_B = Button(self,text="Recalculate",width=12) self.reset_B = Button(self,text="Reset",width=8) ######### ## Exp ## ######### # Segment combobox self.expSeg_CB = Combobox(self,state="readonly",width=10) # Segment volume self.expSegVolume_L = Label(self,text="Segment volume (km\u00B3): ") self.expSegVolume_E = CustomEntry(self, width=10, justify="right") self.expSegVolume_E.setUserEditable(False) # Segment start self.expSegStartLimit_L = Label(self,text="Start of segment: ") self.expSegStartLimit_E = NumericEntry(self, width=10, justify="right") self.expSegStartLimit_E.setSF(NUMBER_OF_SF) # Segment end self.expSegEndLimit_L = Label(self,text="End of segment: ") self.expSegEndLimit_E = NumericEntry(self, width=10, justify="right") self.expSegEndLimit_E.setSF(NUMBER_OF_SF) # Segment coefficient self.expSegCoefficent_L = Label(self,text="Segment coefficient, c: ") self.expSegCoefficent_E = NumericEntry(self, width=10, justify="right") self.expSegCoefficent_E.setSF(NUMBER_OF_SF) # Segment exponent self.expSegExponent_L = Label(self,text="Segment exponent, m: ") self.expSegExponent_E = NumericEntry(self, width=10, justify="right") self.expSegExponent_E.setSF(NUMBER_OF_SF) ######### ## Pow ## ######### # Coefficient self.powCoefficient_L = Label(self,text="Coefficient, c: ") self.powCoefficient_E = NumericEntry(self,width=10, justify="right") self.powCoefficient_E.setSF(NUMBER_OF_SF) # Exponent self.powExponent_L = Label(self,text="Exponent, m: ") self.powExponent_E = NumericEntry(self,width=10, justify="right") self.powExponent_E.setSF(NUMBER_OF_SF) # Proximal limit self.powProximalLimit_L = Label(self,text="Proximal limit: ") self.powProximalLimit_E = NumericEntry(self,width=10, justify="right") self.powProximalLimit_E.setSF(NUMBER_OF_SF) # Distal limit self.powDistalLimit_L = Label(self,text="Distal limit: ") self.powDistalLimit_E = NumericEntry(self,width=10, justify="right") self.powDistalLimit_E.setSF(NUMBER_OF_SF) # Suggested proximal limit self.powSuggestedProximalLimit_L = Label(self,text="Suggested proximal limit: ") self.powSuggestedProximalLimit_E = CustomEntry(self,width=10, justify="right") self.powSuggestedProximalLimit_E.setUserEditable(False) ######### ## Wei ## ######### # lambda self.weiLambdaL = Label(self,text="Estimated \u03BB: ") self.weiLambdaE = NumericEntry(self,width=10, justify="right") self.weiLambdaE.setSF(NUMBER_OF_SF) # k self.weiKL = Label(self,text="Estimated k: ") self.weiKE = NumericEntry(self,width=10, justify="right") self.weiKE.setSF(NUMBER_OF_SF) # theta self.weiThetaL = Label(self,text="Estimated \u03B8: ") self.weiThetaE = NumericEntry(self,width=10, justify="right") self.weiThetaE.setSF(NUMBER_OF_SF) self.components = { Model.EXP : [ self.expSeg_CB, self.expSegVolume_L, self.expSegVolume_E, self.expSegStartLimit_L, self.expSegStartLimit_E, self.expSegEndLimit_L, self.expSegEndLimit_E, self.expSegCoefficent_L, self.expSegCoefficent_E, self.expSegExponent_L, self.expSegExponent_E ], Model.POW : [ self.powCoefficient_L, self.powCoefficient_E, self.powExponent_L, self.powExponent_E, self.powProximalLimit_L, self.powProximalLimit_E, self.powDistalLimit_L, self.powDistalLimit_E, self.powSuggestedProximalLimit_L, self.powSuggestedProximalLimit_E ], Model.WEI : [ self.weiLambdaL, self.weiLambdaE, self.weiKL, self.weiKE, self.weiThetaL, self.weiThetaE, ], }
class StatsFrame(LabelFrame): def __init__(self,parent, padX, padY): LabelFrame.__init__(self,parent,borderwidth=0) # Total volume self.totalEstimatedVolume_L = Label(self,text="Estimated total volume (km\u00B3): ") self.totalEstimatedVolume_E = CustomEntry(self,width=10,justify="right") self.totalEstimatedVolume_E.setUserEditable(False) self.totalEstimatedVolume_E.grid(row=0,column=1,padx=10,pady=padY,sticky="E") self.totalEstimatedVolume_L.grid(row=0,column=0,sticky="W",padx=10) # Relative squared error self.relativeSquaredError_L = Label(self,text="Mean relative squared error: ") self.relativeSquaredError_L.grid(row=1,column=0,sticky="W",padx=10,pady=padY) self.relativeSquaredError_E = CustomEntry(self,width=10,justify="right") self.relativeSquaredError_E.grid(row=1,column=1,padx=10,sticky="E") self.relativeSquaredError_E.setUserEditable(False) # Equation self.equation_L = Label(self,text="Equation: ") self.equation_E = CustomEntry(self,width=10,justify="right") self.equation_E.setUserEditable(False) # General self.parameters_L = Label(self,text="Parameters:") self.calculate_B = Button(self,text="Recalculate",width=12) self.reset_B = Button(self,text="Reset",width=8) ######### ## Exp ## ######### # Segment combobox self.expSeg_CB = Combobox(self,state="readonly",width=10) # Segment volume self.expSegVolume_L = Label(self,text="Segment volume (km\u00B3): ") self.expSegVolume_E = CustomEntry(self, width=10, justify="right") self.expSegVolume_E.setUserEditable(False) # Segment start self.expSegStartLimit_L = Label(self,text="Start of segment: ") self.expSegStartLimit_E = NumericEntry(self, width=10, justify="right") self.expSegStartLimit_E.setSF(NUMBER_OF_SF) # Segment end self.expSegEndLimit_L = Label(self,text="End of segment: ") self.expSegEndLimit_E = NumericEntry(self, width=10, justify="right") self.expSegEndLimit_E.setSF(NUMBER_OF_SF) # Segment coefficient self.expSegCoefficent_L = Label(self,text="Segment coefficient, c: ") self.expSegCoefficent_E = NumericEntry(self, width=10, justify="right") self.expSegCoefficent_E.setSF(NUMBER_OF_SF) # Segment exponent self.expSegExponent_L = Label(self,text="Segment exponent, m: ") self.expSegExponent_E = NumericEntry(self, width=10, justify="right") self.expSegExponent_E.setSF(NUMBER_OF_SF) ######### ## Pow ## ######### # Coefficient self.powCoefficient_L = Label(self,text="Coefficient, c: ") self.powCoefficient_E = NumericEntry(self,width=10, justify="right") self.powCoefficient_E.setSF(NUMBER_OF_SF) # Exponent self.powExponent_L = Label(self,text="Exponent, m: ") self.powExponent_E = NumericEntry(self,width=10, justify="right") self.powExponent_E.setSF(NUMBER_OF_SF) # Proximal limit self.powProximalLimit_L = Label(self,text="Proximal limit: ") self.powProximalLimit_E = NumericEntry(self,width=10, justify="right") self.powProximalLimit_E.setSF(NUMBER_OF_SF) # Distal limit self.powDistalLimit_L = Label(self,text="Distal limit: ") self.powDistalLimit_E = NumericEntry(self,width=10, justify="right") self.powDistalLimit_E.setSF(NUMBER_OF_SF) # Suggested proximal limit self.powSuggestedProximalLimit_L = Label(self,text="Suggested proximal limit: ") self.powSuggestedProximalLimit_E = CustomEntry(self,width=10, justify="right") self.powSuggestedProximalLimit_E.setUserEditable(False) ######### ## Wei ## ######### # lambda self.weiLambdaL = Label(self,text="Estimated \u03BB: ") self.weiLambdaE = NumericEntry(self,width=10, justify="right") self.weiLambdaE.setSF(NUMBER_OF_SF) # k self.weiKL = Label(self,text="Estimated k: ") self.weiKE = NumericEntry(self,width=10, justify="right") self.weiKE.setSF(NUMBER_OF_SF) # theta self.weiThetaL = Label(self,text="Estimated \u03B8: ") self.weiThetaE = NumericEntry(self,width=10, justify="right") self.weiThetaE.setSF(NUMBER_OF_SF) self.components = { Model.EXP : [ self.expSeg_CB, self.expSegVolume_L, self.expSegVolume_E, self.expSegStartLimit_L, self.expSegStartLimit_E, self.expSegEndLimit_L, self.expSegEndLimit_E, self.expSegCoefficent_L, self.expSegCoefficent_E, self.expSegExponent_L, self.expSegExponent_E ], Model.POW : [ self.powCoefficient_L, self.powCoefficient_E, self.powExponent_L, self.powExponent_E, self.powProximalLimit_L, self.powProximalLimit_E, self.powDistalLimit_L, self.powDistalLimit_E, self.powSuggestedProximalLimit_L, self.powSuggestedProximalLimit_E ], Model.WEI : [ self.weiLambdaL, self.weiLambdaE, self.weiKL, self.weiKE, self.weiThetaL, self.weiThetaE, ], } def getParameters(self, model): if model == Model.EXP: return { "c" : helper_functions.validateValue(self.expSegCoefficent_E.get(), "Coefficient, c, must be a number", "float"), "m" : helper_functions.validateValue(self.expSegExponent_E.get(), "Exponent, m, must be a number", "float"), "segStart" : helper_functions.validateValue(self.expSegStartLimit_E.get(), "'Start of segment' must be a number > 0", "float", lowerBound=0), "segEnd" : helper_functions.validateValue(self.expSegEndLimit_E.get(), "'End of segment' must be a number greater than the 'Start of segment'","float", strictLowerBound=float(self.expSegStartLimit_E.get())), } elif model == Model.POW: return { "c" : helper_functions.validateValue(self.powCoefficient_E.get(), "coefficient, c, must be a number", "float"), "m" : helper_functions.validateValue(self.powExponent_E.get(), "exponent, m, must be a number", "float") } elif model == Model.WEI: return { "lambda" : helper_functions.validateValue(self.weiLambdaE.get(), "\u03BB must be a positive number", "float", strictLowerBound=0), "k" : helper_functions.validateValue(self.weiKE.get(), "k must be a positive number", "float", strictLowerBound=0), "theta" : helper_functions.validateValue(self.weiThetaE.get(), "\u03B8 must be a positive number", "float", strictLowerBound=0) }