コード例 #1
0
ファイル: nxreduce.py プロジェクト: pat-gardner/nxrefine
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()
コード例 #2
0
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()