Пример #1
0
def test_query_bt_info(start, composition_key, wavelength_key, expect):
    config = mod.query_bt_info(start,
                               composition_key=composition_key,
                               wavelength_key=wavelength_key,
                               default_composition="Ni")
    pdfconfig = PDFConfig(**config)
    assert (pdfconfig.composition, pdfconfig.wavelength) == expect
Пример #2
0
 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)
Пример #3
0
 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)
Пример #4
0
 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)