def load(self): """Save this fit, so it be reloaded quickly next time.""" self.speak('attempting to load from {0}'.format(self.directory)) #self.speak(' the PDF') self.pdf = PDF.load(self.directory + 'pdf.npy') #self.speak(' the fitting notes') self.notes = np.load(self.directory + 'fitting_notes.npy')[()] #self.speak(' the best-fit model') self.model.load(self.directory)
def load(self): """load a fit from a file, including parameters and LC modifcations""" self.speak("attempting to load from {0}".format(self.directory)) # self.speak(' the PDF') self.pdf = PDF.load(self.directory + "pdf.npy") # self.speak(' the fitting notes') # pick up the covariance matrix self.covariance = self.pdf.covariance for i in range(self.m): match = np.array(self.pdf.names) == self.parameters[i]["code"] for p in self.parameters[i]["parameter"]: loaded = np.array(self.pdf.parameters)[match] assert len(loaded) == 1 loaded = loaded[0] p.value = loaded.value p.uncertainty = loaded.uncertainty # incorporate all modifications that were made to the light curves # KLUDGE! if self.__class__.__name__ == "MCMC": filename = self.directory + "lm/modifications.npy" else: filename = self.directory + "modifications.npy" modifications = np.load(filename) self.speak("loaded TLC modifications from {0}".format(filename)) assert len(modifications) == len(self.tlcs) # loop over the modications, and apply them for i in range(len(self.tlcs)): this = modifications[i] tlc = self.tlcs[i] assert tlc.name == this["name"] tlc.rescaling = this["rescaling"] tlc.bad = this["ok"] == False assert tlc.bad.shape == tlc.flux.shape self.speak("applied the outlier clipping and rescaling")