def prepare_file(self,infile): outfile = os.path.splitext(os.path.basename(self._infile))[0] outfile += '_sel.fits' outfile = os.path.join(self._workdir,outfile) print outfile print self._workdir # if re.search('^(?!\@)(.+)(\.txt|\.lst)$',infile): # infile = '@'+infile gtselect = SelectorTask(infile,outfile, config=self.config['gtselect']) # workdir=self._workdir,savedata=True) pprint.pprint(gtselect.config) gtselect.run() return outfile
print "Output argument only valid with 1 file argument." sys.exit(1) for f in args.files: if args.output is None: m = re.search("(.+)\.fits?", f) if m: outfile = m.group(1) + "_sel.fits" else: outfile = os.path.splitext(f)[0] + "_sel.fits" else: outfile = args.output gt_task = SelectorTask(f, outfile, opts=args) gt_task.run() sys.exit(0) files = [] for i in range(1, len(args)): files.append(os.path.abspath(args[i])) cwd = os.getcwd() tmpdir = tempfile.mkdtemp(prefix=os.environ["USER"] + ".", dir="/scratch") os.chdir(tmpdir) fd, file_list = tempfile.mkstemp(dir=tmpdir)
if len(args.files) > 1 and args.output: print 'Output argument only valid with 1 file argument.' sys.exit(1) for f in args.files: if args.output is None: m = re.search('(.+)\.fits?',f) if m: outfile = m.group(1) + '_sel.fits' else: outfile = os.path.splitext(f)[0] + '_sel.fits' else: outfile = args.output gt_task = SelectorTask(f,outfile,opts=args) gt_task.run() sys.exit(0) files = [] for i in range(1,len(args)): files.append(os.path.abspath(args[i])) cwd = os.getcwd() tmpdir = tempfile.mkdtemp(prefix=os.environ['USER'] + '.', dir='/scratch') os.chdir(tmpdir) fd, file_list = tempfile.mkstemp(dir=tmpdir)