#!/usr/bin/env python

import sys
from desitarget import io
from desitarget.gaiamatch import write_gaia_matches
from time import time
start = time()

#import warnings
#warnings.simplefilter('error')

import multiprocessing
nproc = multiprocessing.cpu_count() // 2

from desiutil.log import get_logger
log = get_logger()

from argparse import ArgumentParser
ap = ArgumentParser(description='Match sweeps files to Gaia and rewrite files with the Gaia columns added')
ap.add_argument("src", 
                help="Sweeps file or root directory with sweeps files")
ap.add_argument("dest", 
                help="Output directory")
ap.add_argument("--numproc", type=int,
                help='number of concurrent processes to use [{}]'.format(nproc),
                default=nproc)

ns = ap.parse_args()
infiles = io.list_sweepfiles(ns.src)
if len(infiles) == 0:
    log.critical('no sweep files found')
    sys.exit(1)

log.info("running on {} processors".format(ns.numproc))

write_gaia_matches(infiles, numproc=ns.numproc, outdir=ns.dest)

log.info('Wrote sweeps files matched to Gaia to {}...t={:.1f}s'.format(ns.dest, time()-start))


ab8f3b1ce66a70c4c88ec4eb4931e7ba842cf644
<mask token>

<mask token>
ap.add_argument('src', help='Sweeps file or root directory with sweeps files')
ap.add_argument('dest', help='Output directory')
ap.add_argument('--numproc', type=int, help=
    'number of concurrent processes to use [{}]'.format(nproc), default=nproc)
<mask token>
if len(infiles) == 0:
    log.critical('no sweep files found')
    sys.exit(1)
log.info('running on {} processors'.format(ns.numproc))
write_gaia_matches(infiles, numproc=ns.numproc, outdir=ns.dest)
log.info('Wrote sweeps files matched to Gaia to {}...t={:.1f}s'.format(ns.
    dest, time() - start))

<mask token>
start = time()
<mask token>
nproc = multiprocessing.cpu_count() // 2
<mask token>
log = get_logger()
<mask token>
ap = ArgumentParser(description=
    'Match sweeps files to Gaia and rewrite files with the Gaia columns added')
ap.add_argument('src', help='Sweeps file or root directory with sweeps files')
ap.add_argument('dest', help='Output directory')
ap.add_argument('--numproc', type=int, help=
    'number of concurrent processes to use [{}]'.format(nproc), default=nproc)
ns = ap.parse_args()
infiles = io.list_sweepfiles(ns.src)
if len(infiles) == 0:
    log.critical('no sweep files found')
    sys.exit(1)
log.info('running on {} processors'.format(ns.numproc))
write_gaia_matches(infiles, numproc=ns.numproc, outdir=ns.dest)
log.info('Wrote sweeps files matched to Gaia to {}...t={:.1f}s'.format(ns.
    dest, time() - start))

import sys
from desitarget import io
from desitarget.gaiamatch import write_gaia_matches
from time import time
start = time()
import multiprocessing
nproc = multiprocessing.cpu_count() // 2
from desiutil.log import get_logger
log = get_logger()
from argparse import ArgumentParser
ap = ArgumentParser(description=
    'Match sweeps files to Gaia and rewrite files with the Gaia columns added')
ap.add_argument('src', help='Sweeps file or root directory with sweeps files')
ap.add_argument('dest', help='Output directory')
ap.add_argument('--numproc', type=int, help=
    'number of concurrent processes to use [{}]'.format(nproc), default=nproc)
ns = ap.parse_args()
infiles = io.list_sweepfiles(ns.src)
if len(infiles) == 0:
    log.critical('no sweep files found')
    sys.exit(1)
log.info('running on {} processors'.format(ns.numproc))
write_gaia_matches(infiles, numproc=ns.numproc, outdir=ns.dest)
log.info('Wrote sweeps files matched to Gaia to {}...t={:.1f}s'.format(ns.
    dest, time() - start))

#!/usr/bin/env python

import sys
from desitarget import io
from desitarget.gaiamatch import write_gaia_matches
from time import time
start = time()

#import warnings
#warnings.simplefilter('error')

import multiprocessing
nproc = multiprocessing.cpu_count() // 2

from desiutil.log import get_logger
log = get_logger()

from argparse import ArgumentParser
ap = ArgumentParser(description='Match sweeps files to Gaia and rewrite files with the Gaia columns added')
ap.add_argument("src", 
                help="Sweeps file or root directory with sweeps files")
ap.add_argument("dest", 
                help="Output directory")
ap.add_argument("--numproc", type=int,
                help='number of concurrent processes to use [{}]'.format(nproc),
                default=nproc)

ns = ap.parse_args()
infiles = io.list_sweepfiles(ns.src)
if len(infiles) == 0:
    log.critical('no sweep files found')
    sys.exit(1)

log.info("running on {} processors".format(ns.numproc))

write_gaia_matches(infiles, numproc=ns.numproc, outdir=ns.dest)

log.info('Wrote sweeps files matched to Gaia to {}...t={:.1f}s'.format(ns.dest, time()-start))

