parser.add_argument('inputfile', type=str, help="input catalogue fits file")
parser.add_argument('outputfile', help='output catalogue fits file')

# parsing arguments
args = parser.parse_args()

outfile = args.outputfile
filename = args.inputfile
radius = args.radius

print('opening', filename)
inputfitsfile = pyfits.open(filename)
header_hdu = inputfitsfile[0]
table = inputfitsfile[1].data

ra_key = match.get_tablekeys(table, 'RA')
print('    using RA  column: %s' % ra_key)
dec_key = match.get_tablekeys(table, 'DEC')
print('    using DEC column: %s' % dec_key)

ra_orig = table[ra_key]
dec_orig = table[dec_key]
ra = ra_orig + 0
dec = dec_orig + 0
n = len(ra_orig)

i_select = numpy.random.randint(0, n, size=400)
ra_test = ra[i_select]
dec_test = dec[i_select]
phi_test = ra_test / 180 * pi
theta_test = dec_test / 180 * pi + pi / 2.
Exemple #2
0
print('  finding position columns ...')
# table is in arcsec, and therefore separations is in arcsec
separations = []
for ti, a in enumerate(table_names):
	row = []
	for tj, b in enumerate(table_names):
		if ti < tj:
			k = 'Separation_%s_%s' % (b, a)
			assert k in table.dtype.names, 'ERROR: Separation column for "%s" not in merged table. Have columns: %s' % (k, ', '.join(table.dtype.names))
			row.append(table[k])
		else:
			row.append(numpy.ones(len(table)) * numpy.nan)
	separations.append(row)

print('  building primary_id index ...')
primary_id_key = match.get_tablekeys(tables[0], 'ID')
primary_id_key = '%s_%s' % (table_names[0], primary_id_key)

primary_ids = []
primary_id_start = []
last_primary_id = None
primary_id_column = table[primary_id_key]
for i, pid in enumerate(primary_id_column):
	if pid != last_primary_id:
		last_primary_id = pid
		primary_ids.append(pid)
		primary_id_start.append(i)

primary_id_end = primary_id_start[1:] + [len(primary_id_column)]

# compute n-way position evidence
Exemple #3
0
            else:
                row.append(numpy.ones(len(table)) * numpy.nan)
        separations.append(row)
    return separations


separations = make_separation_table_matrix('Separation_%s_%s', table,
                                           table_names)
if not simple_errors:
    separations_ra = make_separation_table_matrix('Separation_%s_%s_ra', table,
                                                  table_names)
    separations_dec = make_separation_table_matrix('Separation_%s_%s_dec',
                                                   table, table_names)

print('  building primary_id index ...')
primary_id_key = match.get_tablekeys(tables[0], 'ID', tablename=table_names[0])
primary_id_key = '%s_%s' % (table_names[0], primary_id_key)

primary_ids = []
primary_id_start = []
last_primary_id = None
primary_id_column = table[primary_id_key]
for i, pid in enumerate(primary_id_column):
    if pid != last_primary_id:
        last_primary_id = pid
        primary_ids.append(pid)
        primary_id_start.append(i)

primary_id_end = primary_id_start[1:] + [len(primary_id_column)]

# compute n-way position evidence