File: merge-columns

package info (click to toggle)
astrometry.net 0.76%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 18,120 kB
  • sloc: ansic: 161,636; python: 19,915; makefile: 1,439; awk: 159; cpp: 78; pascal: 67; sh: 61; perl: 9
file content (39 lines) | stat: -rwxr-xr-x 1,006 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#! /usr/bin/env python3
# This file is part of the Astrometry.net suite.
# Licensed under a 3-clause BSD style license - see LICENSE
from __future__ import print_function
import sys

# Assume this script is in $(INSTALL_DIR)/bin/ and the
# python base directory is in $(INSTALL_DIR)/lib/python/ .
try:
    # If the PYTHONPATH is already set up, don't mess with it.
    import astrometry.util.fits
except:
    import os
    sys.path.insert(1, os.path.normpath(os.path.join(os.path.dirname(__file__), '..', 'lib', 'python')))

from astrometry.util.fits import fits_table

import optparse
parser = optparse.OptionParser(prog='[input files] [output file]')
opt,args = parser.parse_args()
if len(args) < 2:
    parser.print_usage()
    sys.exit(-1)
infns = args[:-1]
outfn = args[-1]
print('Writing to output file', outfn)
T = None
for fn in infns:
    print('Reading input', fn)
    Ti = fits_table(fn)
    if T is None:
        T = Ti
    else:
        T.add_columns_from(Ti)
T.writeto(outfn)