def main(): parser = argparse.ArgumentParser( description="Find maximum counts of the signal in the specified path") parser.add_argument('-d', '--directory', required=True, help='scan directory') parser.add_argument('-e', '--entries', default=['f1', 'f2', 'f3'], nargs='+', help='names of entries to be processed') parser.add_argument('-f', '--first', type=int, help='first frame') parser.add_argument('-l', '--last', type=int, help='last frame') parser.add_argument('-o', '--overwrite', action='store_true', help='overwrite existing maximum') parser.add_argument('-q', '--queue', action='store_true', help='add to server task queue') args = parser.parse_args() for entry in args.entries: reduce = NXReduce(entry, args.directory, maxcount=True, first=args.first, last=args.last, overwrite=args.overwrite) if args.queue: reduce.queue() else: reduce.nxmax()
def main(): parser = argparse.ArgumentParser( description="Link data and metadata to NeXus file") parser.add_argument('-d', '--directory', required=True, help='scan directory') parser.add_argument('-e', '--entries', nargs='+', help='names of entries to be searched') parser.add_argument('-o', '--overwrite', action='store_true', help='overwrite existing peaks') parser.add_argument('-q', '--queue', action='store_true', help='add to server task queue') args = parser.parse_args() if args.entries: entries = args.entries else: entries = NXMultiReduce(args.directory).entries for entry in entries: reduce = NXReduce(entry, args.directory, link=True, overwrite=args.overwrite) if args.queue: reduce.queue('nxlink', args) else: reduce.nxlink()
def main(): parser = argparse.ArgumentParser( description="Refine lattice parameters and goniometer angles") parser.add_argument('-d', '--directory', required=True, help='scan directory') parser.add_argument('-e', '--entries', default=['f1', 'f2', 'f3'], nargs='+', help='names of entries to be processed') parser.add_argument('-l', '--lattice', action='store_true', help='refine lattice parameters') parser.add_argument('-o', '--overwrite', action='store_true', help='overwrite existing maximum') parser.add_argument('-q', '--queue', action='store_true', help='add to server task queue') args = parser.parse_args() for i, entry in enumerate(args.entries): if i == 0: lattice = args.lattice else: lattice = False reduce = NXReduce(entry, args.directory, refine=True, lattice=lattice, overwrite=args.overwrite) if args.queue: reduce.queue() else: reduce.nxrefine()
def main(): parser = argparse.ArgumentParser( description="Find peaks within the NeXus data") parser.add_argument('-d', '--directory', required=True, help='scan directory') parser.add_argument('-e', '--entries', default=['f1', 'f2', 'f3'], nargs='+', help='names of entries to be searched') parser.add_argument('-t', '--threshold', type=float, help='peak threshold - defaults to maximum counts/10') parser.add_argument('-f', '--first', type=int, help='first frame') parser.add_argument('-l', '--last', type=int, help='last frame') parser.add_argument('-o', '--overwrite', action='store_true', help='overwrite existing peaks') parser.add_argument('-p', '--parent', default=None, help='The parent .nxs file to use') parser.add_argument('-q', '--queue', action='store_true', help='add to server task queue') args = parser.parse_args() for entry in args.entries: reduce = NXReduce(entry, args.directory, find=True, threshold=args.threshold, first=args.first, last=args.last, overwrite=args.overwrite) if args.queue: reduce.queue() else: reduce.nxfind()
def main(): parser = argparse.ArgumentParser(description="Perform CCTW transform") parser.add_argument('-d', '--directory', required=True, help='scan directory') parser.add_argument('-e', '--entries', default=['f1', 'f2', 'f3'], nargs='+', help='names of entries to be processed') parser.add_argument('-m', '--mask', action='store_true', help='use 3D mask') parser.add_argument('-qh', nargs=3, help='Qh - min, step, max') parser.add_argument('-qk', nargs=3, help='Qk - min, step, max') parser.add_argument('-ql', nargs=3, help='Ql - min, step, max') parser.add_argument('-r', '--radius', default=200, help='radius of mask around each peak (in pixels)') parser.add_argument('-w', '--width', default=3, help='width of masked region (in frames)') parser.add_argument('-o', '--overwrite', action='store_true', help='overwrite existing transforms') parser.add_argument('-q', '--queue', action='store_true', help='add to server task queue') args = parser.parse_args() for entry in args.entries: reduce = NXReduce(entry, args.directory, transform=True, mask=args.mask, Qh=args.qh, Qk=args.qk, Ql=args.ql, radius=args.radius, width=args.width, overwrite=args.overwrite) if args.mask: if args.queue: reduce.queue() else: reduce.nxmasked_transform() else: if args.queue: reduce.queue() else: reduce.nxtransform()
def main(): parser = argparse.ArgumentParser( description="Find peaks within the NeXus data") parser.add_argument('-d', '--directory', required=True, help='scan directory') parser.add_argument('-e', '--entries', nargs='+', help='names of entries to be searched') parser.add_argument('-t', '--threshold', type=float, help='peak threshold') parser.add_argument('-f', '--first', type=int, help='first frame') parser.add_argument('-l', '--last', type=int, help='last frame') parser.add_argument('-P', '--pixels', type=int, help='minimum pixels in a peak') parser.add_argument('-o', '--overwrite', action='store_true', help='overwrite existing peaks') parser.add_argument('-p', '--parent', default=None, help='The parent .nxs file to use') parser.add_argument('-m', '--monitor', action='store_true', help='monitor progress in the command line') parser.add_argument('-q', '--queue', action='store_true', help='add to server task queue') args = parser.parse_args() if args.entries: entries = args.entries else: entries = NXMultiReduce(args.directory).entries for entry in entries: reduce = NXReduce(entry, args.directory, find=True, threshold=args.threshold, first=args.first, last=args.last, min_pixels=args.pixels, overwrite=args.overwrite, monitor_progress=args.monitor) if args.queue: reduce.queue('nxfind', args) else: reduce.nxfind()
def main(): parser = argparse.ArgumentParser(description="Perform CCTW transform") parser.add_argument('-d', '--directory', required=True, help='scan directory') parser.add_argument('-e', '--entries', nargs='+', help='names of entries to be processed') parser.add_argument('-qh', nargs=3, help='Qh - min, step, max') parser.add_argument('-qk', nargs=3, help='Qk - min, step, max') parser.add_argument('-ql', nargs=3, help='Ql - min, step, max') parser.add_argument('-R', '--regular', action='store_true', help='perform regular transform') parser.add_argument('-M', '--mask', action='store_true', help='perform transform with 3D mask') parser.add_argument('-o', '--overwrite', action='store_true', help='overwrite existing transforms') parser.add_argument('-q', '--queue', action='store_true', help='add to server task queue') args = parser.parse_args() if args.entries: entries = args.entries else: entries = NXMultiReduce(args.directory).entries for entry in entries: reduce = NXReduce(entry, args.directory, transform=True, Qh=args.qh, Qk=args.qk, Ql=args.ql, regular=args.regular, mask=args.mask, overwrite=args.overwrite) if args.queue: reduce.queue('nxtransform', args) else: if reduce.regular: reduce.nxtransform() if reduce.mask: reduce.nxtransform(mask=True)
def main(): parser = argparse.ArgumentParser( description="Refine lattice parameters and goniometer angles") parser.add_argument('-d', '--directory', required=True, help='scan directory') parser.add_argument('-e', '--entries', nargs='+', help='names of entries to be processed') parser.add_argument('-l', '--lattice', action='store_true', help='refine lattice parameters') parser.add_argument('-o', '--overwrite', action='store_true', help='overwrite existing maximum') parser.add_argument('-q', '--queue', action='store_true', help='add to server task queue') args = parser.parse_args() if args.entries: entries = args.entries else: entries = NXMultiReduce(args.directory).entries for i, entry in enumerate(entries): if i == 0: lattice = args.lattice else: lattice = False reduce = NXReduce(entry, args.directory, refine=True, lattice=lattice, overwrite=args.overwrite) if args.queue: reduce.queue('nxrefine', args) else: reduce.nxrefine()
def main(): parser = argparse.ArgumentParser( description="Find maximum counts of the signal in the specified path") parser.add_argument('-d', '--directory', required=True, help='scan directory') parser.add_argument('-e', '--entries', nargs='+', help='names of entries to be processed') parser.add_argument('-f', '--first', type=int, help='first frame') parser.add_argument('-l', '--last', type=int, help='last frame') parser.add_argument('-o', '--overwrite', action='store_true', help='overwrite existing maximum') parser.add_argument('-m', '--monitor', action='store_true', help='monitor progress in the command line') parser.add_argument('-q', '--queue', action='store_true', help='add to server task queue') args = parser.parse_args() if args.entries: entries = args.entries else: entries = NXMultiReduce(args.directory).entries for entry in entries: reduce = NXReduce(entry, args.directory, maxcount=True, first=args.first, last=args.last, overwrite=args.overwrite, monitor_progress=args.monitor) if args.queue: reduce.queue('nxmax', args) else: reduce.nxmax()
def main(): parser = argparse.ArgumentParser( description="Prepare 3D mask around Bragg peaks") parser.add_argument('-d', '--directory', required=True, help='scan directory') parser.add_argument('-e', '--entries', default=['f1', 'f2', 'f3'], nargs='+', help='names of entries to be processed') parser.add_argument('-o', '--overwrite', action='store_true', help='overwrite existing mask') parser.add_argument('-q', '--queue', action='store_true', help='add to server task queue') args = parser.parse_args() for entry in args.entries: reduce = NXReduce(entry, args.directory, prepare=True, overwrite=args.overwrite) if args.queue: reduce.queue() else: reduce.nxprepare()
def main(): parser = argparse.ArgumentParser( description="Perform CCTW transform") parser.add_argument('-d', '--directory', required=True, help='scan directory') parser.add_argument('-e', '--entries', default=['f1', 'f2', 'f3'], nargs='+', help='names of entries to be processed') parser.add_argument('-m', '--mask', action='store_true', help='use 3D mask') parser.add_argument('-qh', nargs=3, help='Qh - min, step, max') parser.add_argument('-qk', nargs=3, help='Qk - min, step, max') parser.add_argument('-ql', nargs=3, help='Ql - min, step, max') parser.add_argument('-r', '--radius', default=200, help='radius of mask around each peak (in pixels)') parser.add_argument('-w', '--width', default=3, help='width of masked region (in frames)') parser.add_argument('-o', '--overwrite', action='store_true', help='overwrite existing transforms') parser.add_argument('-q', '--queue', action='store_true', help='add to server task queue') args = parser.parse_args() for entry in args.entries: reduce = NXReduce(entry, args.directory, transform=True, mask=args.mask, Qh=args.qh, Qk=args.qk, Ql=args.ql, radius=args.radius, width=args.width, overwrite=args.overwrite) if args.mask: if args.queue: reduce.queue() else: reduce.nxmasked_transform() else: if args.queue: reduce.queue() else: reduce.nxtransform()
def main(): parser = argparse.ArgumentParser( description="Copy instrument parameters from a parent file") parser.add_argument('-d', '--directory', required=True, help='scan directory') parser.add_argument('-e', '--entries', default=['f1', 'f2', 'f3'], nargs='+', help='names of entries to be searched') parser.add_argument('-p', '--parent', help='file name of file to copy from') parser.add_argument('-o', '--overwrite', action='store_true', help='overwrite existing peaks') parser.add_argument('-q', '--queue', action='store_true', help='add to server task queue') args = parser.parse_args() for entry in args.entries: reduce = NXReduce(entry, args.directory, parent=args.parent, copy=True, overwrite=args.overwrite) if args.queue: reduce.queue() else: reduce.nxcopy()
def add_tasks(self): if self.grid is None: raise NeXusError('Need to update status') for scan in self.enabled_scans: for entry in self.entries: reduce = NXReduce(entry, scan) if self.selected(scan, 'link'): reduce.link = True if self.selected(scan, 'max'): reduce.maxcount = True if self.selected(scan, 'find'): reduce.find = True if self.selected(scan, 'copy'): reduce.copy = True if self.selected(scan, 'refine'): reduce.refine = True if self.selected(scan, 'prepare'): reduce.prepare = True if self.selected(scan, 'transform'): reduce.transform = True if self.selected(scan, 'masked_transform'): reduce.mask = True if self.selected(scan, 'overwrite'): reduce.overwrite = True reduce.queue() if self.selected(scan, 'link'): self.queued(scan, 'link') if self.selected(scan, 'max'): self.queued(scan, 'max') if self.selected(scan, 'find'): self.queued(scan, 'find') if self.selected(scan, 'copy'): self.queued(scan, 'copy') if self.selected(scan, 'refine'): self.queued(scan, 'refine') if self.selected(scan, 'prepare'): self.queued(scan, 'prepare') if self.selected(scan, 'transform'): self.queued(scan, 'transform') if self.selected(scan, 'masked_transform'): self.queued(scan, 'masked_transform') if self.selected(scan, 'combine'): reduce = NXMultiReduce(scan, self.entries) if self.selected(scan, 'overwrite'): reduce.overwrite = True reduce.queue() self.queued(scan, 'combine') if self.selected(scan, 'masked_combine'): reduce = NXMultiReduce(scan, self.entries, mask=True) if self.selected(scan, 'overwrite'): reduce.overwrite = True reduce.queue() self.queued(scan, 'masked_combine') self.scans[scan] self.deselect_all()
def add_tasks(self): if self.grid is None: raise NeXusError('Need to update status') for scan in self.enabled_scans: for entry in self.entries: reduce = NXReduce(entry, scan) if self.selected(scan, 'link'): reduce.link = True if self.selected(scan, 'max'): reduce.maxcount = True if self.selected(scan, 'find'): reduce.find = True if self.selected(scan, 'copy'): reduce.copy = True if self.selected(scan, 'refine'): reduce.refine = True if self.selected(scan, 'transform'): reduce.transform = True if self.selected(scan, 'masked_transform'): reduce.mask = True if self.selected(scan, 'overwrite'): reduce.overwrite = True reduce.queue() if self.selected(scan, 'link'): self.queued(scan, 'link') if self.selected(scan, 'max'): self.queued(scan, 'max') if self.selected(scan, 'find'): self.queued(scan, 'find') if self.selected(scan, 'copy'): self.queued(scan, 'copy') if self.selected(scan, 'refine'): self.queued(scan, 'refine') if self.selected(scan, 'transform'): self.queued(scan, 'transform') if self.selected(scan, 'masked_transform'): self.queued(scan, 'masked_transform') if self.selected(scan, 'combine'): reduce = NXMultiReduce(scan, self.entries) if self.selected(scan, 'overwrite'): reduce.overwrite = True reduce.queue() self.queued(scan, 'combine') if self.selected(scan, 'masked_combine'): reduce = NXMultiReduce(scan, self.entries, mask=True) if self.selected(scan, 'overwrite'): reduce.overwrite = True reduce.queue() self.queued(scan, 'masked_combine') self.scans[scan] self.deselect_all()
def main(): parser = argparse.ArgumentParser( description="Perform data reduction on entries") parser.add_argument('-d', '--directory', required=True, help='scan directory') parser.add_argument('-e', '--entries', default=['f1', 'f2', 'f3'], nargs='+', help='names of entries to be processed') parser.add_argument('-l', '--link', action='store_true', help='link wrapper file to raw data') parser.add_argument('-m', '--max', action='store_true', help='find maximum counts') parser.add_argument('-f', '--find', action='store_true', help='find peaks') parser.add_argument('-c', '--copy', action='store_true', help='copy parameters') parser.add_argument('-r', '--refine', action='store_true', help='refine lattice parameters') parser.add_argument('-t', '--transform', action='store_true', help='perform CCTW transforms') parser.add_argument('-M', '--mask', action='store_true', help='perform CCTW transforms with 3D mask') parser.add_argument('-b', '--combine', action='store_true', help='combine CCTW transforms') parser.add_argument('-o', '--overwrite', action='store_true', help='overwrite existing maximum') parser.add_argument('-q', '--queue', action='store_true', help='add to server task queue') args = parser.parse_args() for entry in args.entries: reduce = NXReduce(entry, args.directory, link=args.link, maxcount=args.max, find=args.find, copy=args.copy, refine=args.refine, transform=args.transform, mask=args.mask, overwrite=args.overwrite) if args.queue: reduce.queue() else: reduce.nxreduce() if args.combine: reduce = NXMultiReduce(args.directory, entries=args.entries, mask=args.mask, overwrite=args.overwrite) if args.queue: reduce.queue() else: reduce.nxcombine()
def main(): parser = argparse.ArgumentParser( description="Prepare 3D mask around Bragg peaks") parser.add_argument('-d', '--directory', required=True, help='scan directory') parser.add_argument('-e', '--entries', nargs='+', help='names of entries to be processed') parser.add_argument('--t1', type=float, default=2, help='threshold for smaller convolution') parser.add_argument('--h1', type=int, default=11, help='size of smaller convolution') parser.add_argument('--t2', type=float, default=0.8, help='threshold for larger convolution') parser.add_argument('--h2', type=int, default=51, help='size of larger convolution') parser.add_argument('-o', '--overwrite', action='store_true', help='overwrite existing mask') parser.add_argument('-m', '--monitor', action='store_true', help='monitor progress in the command line') parser.add_argument('-q', '--queue', action='store_true', help='add to server task queue') args = parser.parse_args() if args.entries: entries = args.entries else: entries = NXMultiReduce(args.directory).entries for entry in entries: reduce = NXReduce(entry, args.directory, prepare=True, overwrite=args.overwrite, monitor_progress=args.monitor) reduce.mask_parameters['threshold_1'] = args.t1 reduce.mask_parameters['horizontal_size_1'] = args.h1 reduce.mask_parameters['threshold_2'] = args.t2 reduce.mask_parameters['horizontal_size_2'] = args.h2 if args.queue: reduce.queue('nxprepare', args) else: reduce.nxprepare()
def main(): parser = argparse.ArgumentParser( description="Perform data reduction on entries") parser.add_argument('-d', '--directory', required=True, help='scan directory') parser.add_argument('-e', '--entries', nargs='+', help='names of entries to be processed') parser.add_argument('-l', '--link', action='store_true', help='link wrapper file to raw data') parser.add_argument('-m', '--max', action='store_true', help='find maximum counts') parser.add_argument('-f', '--find', action='store_true', help='find peaks') parser.add_argument('-c', '--copy', action='store_true', help='copy parameters') parser.add_argument('-r', '--refine', action='store_true', help='refine lattice parameters') parser.add_argument('-p', '--prepare', action='store_true', help='prepare 3D masks') parser.add_argument('-t', '--transform', action='store_true', help='perform CCTW transforms') parser.add_argument('-C', '--combine', action='store_true', help='combine CCTW transforms') parser.add_argument('-P', '--pdf', action='store_true', help='perform PDF transforms') parser.add_argument('-R', '--regular', action='store_true', help='perform regular CCTW transforms') parser.add_argument('-M', '--mask', action='store_true', help='perform CCTW transforms with 3D mask') parser.add_argument('-o', '--overwrite', action='store_true', help='overwrite existing maximum') parser.add_argument('-q', '--queue', action='store_true', help='add to server task queue') args = parser.parse_args() if args.entries: entries = args.entries else: entries = NXMultiReduce(args.directory).entries for entry in entries: reduce = NXReduce(entry=entry, directory=args.directory, link=args.link, maxcount=args.max, find=args.find, copy=args.copy, refine=args.refine, prepare=args.prepare, transform=args.transform, combine=args.combine, pdf=args.pdf, regular=args.regular, mask=args.mask, overwrite=args.overwrite) if args.queue: reduce.queue('nxreduce', args) else: reduce.combine = reduce.pdf = False reduce.nxreduce() if (args.combine or args.pdf) and not args.queue: reduce = NXMultiReduce(args.directory, combine=args.combine, pdf=args.pdf, regular=args.regular, mask=args.mask, overwrite=args.overwrite) reduce.nxreduce()