def start(self, doc, _md=None): io.server_message("Read the start of {}".format(doc["uid"])) self.clear_cache() # copy the default config and read the user config self.config = copy.deepcopy(self.init_config) self.config.read_user_config(doc.get("user_config", {})) # record start doc for later use self.start_doc = doc # find ai try: self.ai = from_start.query_ai( doc, calibration_md_key=self.config.calibration_md_key) except ValueNotFoundError as error: self.ai = None io.server_message("Failed to find calibration data: " + str(error)) # find bt info try: self.bt_info = from_start.query_bt_info( doc, composition_key=self.config.composition_key, wavelength_key=self.config.wavelength_key, default_composition="Ni") except ValueNotFoundError as error: self.bt_info = {} io.server_message("Info is missing: " + str(error)) # create new start new_start = dict(**doc, an_config=self.config.to_dict(), pdfstream_version=pdfstream.__version__) return super(AnalysisStream, self).start(new_start)
def start(self, doc, _md=None): self.cache = dict() self.cache["start"] = doc self.cache["ai"] = from_start.query_ai( doc, calibration_md_key=self.config.calibration_md_key) self.cache["bt_info"] = from_start.query_bt_info( doc, composition_key=self.config.composition_key, wavelength_key=self.config.wavelength_key, default_composition="Ni") self.cache["indeps"] = from_start.get_indeps(doc, exclude={"time"}) new_start = dict(**doc, an_config=self.config.to_dict()) super(AnalysisStream, self).start(new_start)
def start(self, doc, _md=None): self.cache = dict() self.cache["start"] = doc self.cache["ai"] = from_start.query_ai( doc, calibration_md_key=self.config.calibration_md_key) self.cache["bt_info"] = from_start.query_bt_info( doc, composition_key=self.config.composition_key, wavelength_key=self.config.wavelength_key, default_composition="Ni") self.cache["indeps"] = from_start.get_indeps(doc, exclude={"time"}) # load user config user_config = UserConfig(allow_no_value=True) user_config.read_start_doc(doc) self.cache["user_config"] = user_config # create new start new_start = dict(**doc, an_config=self.config.to_dict(), pdfstream_version=pdfstream.__version__) super(AnalysisStream, self).start(new_start)
def test_query_ai(db_with_dark_and_light): db = db_with_dark_and_light start = mod.get_start_of_run(db[-1]) mod.query_ai(start, "calibration_md")
def test_query_ai(db_with_dark_and_light): db = db_with_dark_and_light start = db[-1].metadata["start"] mod.query_ai(start, "calibration_md")