コード例 #1
0
ファイル: select_ring.py プロジェクト: burggraaff/gfc
parser.add_argument("-t",
                    "--threshold",
                    type=float,
                    help="Threshold angle to select stars",
                    default=2.5)
parser.add_argument("-v", "--verbose", action="store_true")
args = parser.parse_args()

time_before_reading = gfc.time()
t = gfc.io.read_csv(args.data_file)
time_after_reading = gfc.time()
if args.verbose:
    print "Finished loading data in {0:.1f} seconds".format(
        time_after_reading - time_before_reading)

gfc.add_rad(t)

amps, means, covs = gfc.io.load_PDFs(args.xd_results_folder)
if args.verbose:
    print "Finished loading XD parameters"

time_before_dot = gfc.time()
mean_coords = gfc.matrix.mean_to_coords_many(means)
dot_products = gfc.matrix.mean_coords_dot_stars(mean_coords, t["ra_rad"],
                                                t["dec_rad"])
time_after_dot = gfc.time()
if args.verbose:
    print "Calculated dot products in {0:.1f} seconds".format(time_after_dot -
                                                              time_before_dot)

crit = 1. - np.cos(args.threshold * np.pi / 180.)
コード例 #2
0
    print "Loaded TGAS/2MASS table; removed {0}/{1} rows without a TYCHO2 ID".format(
        original_length - new_length, original_length)
if args.verbose:
    print "Now loading RAVE table"
rave = gfc.io.read_csv(args.rave_file)
original_length = len(rave)
rave.remove_rows(gfc.np.where(rave["ID_TYCHO2"].mask)[0])
new_length = len(rave)
if args.verbose:
    print "Loaded RAVE table; removed {0}/{1} rows without a TYCHO2 ID".format(
        original_length - new_length, original_length)
if args.verbose:
    print "Now performing cross-match"
j = gfc.table.join(rave, t, keys="ID_TYCHO2")
del rave, t
if args.verbose:
    print "Cross-match done: {0} rows included".format(len(j))
if args.remove_columns:
    gfc.remove_unused_columns(j)
if args.add_velocities:
    gfc.add_rad(j)
    gfc.matrix.add_w(j, v_r_col="HRV", components=False)
    gfc.matrix.add_A(j)
    gfc.matrix.add_R(j)
    gfc.matrix.add_UVW(j, vector=False)
    j.remove_columns(("R", "A", "R^-1", "w_vec", "ra_rad", "dec_rad",
                      "ra_rad_error", "dec_rad_error"))
gfc.io.write_csv(j, args.save_to)
if args.verbose:
    print "Cross-matched table written"