def fit_pb_data(self): if self.current_model.associated_data is None: self.sudden_death( "You want to fit the data, but you haven't loaded any? Try loading some first. Now there's an idea!" ) return self.current_model.model_type = self.current_model_selection self.current_model.weight_type = self.current_weight_selection output_code = self.current_model.model_fit() if output_code != '0': self.sudden_death(output_code) return else: plotting.gen_plot(self) plotting.gen_residual_plot(self)
def load_saved_model(self): options = QFileDialog.Options() filename, _ = QFileDialog.getOpenFileName(self, "Load model", "", "MODEL Files (*.model);;", options=options) if filename: try: with open(filename, 'rb') as input_model: self.current_model = pickle.load(input_model) except: self.sudden_death( 'There was an error loading the model you indicated. Try again, or check ' 'to make sure you indicated a valid .mod file.') return plotting.gen_plot(self) self.regression_type.setCurrentIndex(self.current_model.model_type) self.weight_type.setCurrentIndex(self.current_model.weight_type) self.color_palette.setCurrentIndex( self.color_index[self.current_model.plot_color])
def __init__(self, image_path): self.car_image = imread(image_path, as_grey=True) * 255 threshold_value = threshold_otsu(self.car_image) self.binary_car_image = self.car_image > threshold_value self.fig, (self.axis, self.axis1) = plotting.gen_plot(2, 1)
def change_color_palette(self, text): if text in self.color_options: self.current_model.plot_color = self.color_options[text] plotting.gen_plot(self) else: self.sudden_death('Invalid option')