def main(): for name in ("sp", "line", "depth", "mapping", "undefined", "streamline"): filename = curdir / "spectra_files" / "{0}.wdf".format(name) print("Testing: ", filename.as_posix()) # if debug=True, debug information will show in stderr reader = WDFReader(filename, debug=True) assert reader is not None # Explicitly print into stdout reader.print_info() reader.close() return
def read_spectra(self): # renishawWiRE is imported here so that its API changes would not block spectroscopy from renishawWiRE import WDFReader # pylint: disable=import-outside-toplevel wdf_file = WDFReader(self.filename) try: if wdf_file.measurement_type == 1: # single point spectra table = self.single_reader(wdf_file) elif wdf_file.measurement_type == 2: # series scan table = self.series_reader(wdf_file) elif wdf_file.measurement_type == 3: # line scan table = self.map_reader(wdf_file) finally: wdf_file.close() return table