def readpeaks(self, peaksfilename, imagefile): """ read in peaks found with peaksearch (ImageD11) """ self.lines = open(peaksfilename, "r").readlines() self.images = {} i = -1 for line in self.lines: i += 1 if line[0:6] == "# File": name = line.split()[-1] self.images[name] = i # stem, numb, filetype = deconstruct_filename(imagefile) fsobj = filename_series(imagefile) start = self.images[imagefile] try: end = self.images[next(fsobj)] except: end = len(self.lines) i = start + 1 line = self.lines[i] for line in self.lines[start:end]: if line[0] != '#' and len(line) > 10: try: [npixels, yt, ypos, zpos] = line.split()[0:4] self.peaks.append([npixels, ypos, zpos]) except: pass
def test_with_filename_series(self): first_filename = self.get_filename("image_c_000.edf") filenames = filename_series(first_filename) serie = FileSeries(filenames=filenames) self.assertEqual(serie.nframes, 10) serie.close()