Example #1
0
def verify_arguments():
    if len(sys.argv) != 3:
        return False

    if not os.path.isfile(sys.argv[1]):
        return False

    if not utils_str.to_int(sys.argv[2]):
        return False

    return True
Example #2
0
        print(
            "Found comoving group of size %d. %d/%d done. Time left: %.001f hours"
            % (group_size, total_stars_processed, total_stars, time_left_h))

    db_connection_cache.remove_unused(open_db_connections)


# Traverse the x/y/z/cell.db directory structure and call find_comoving_stars_in_cell for each cell.db
for ix_str in os.listdir(db_folder):
    ix_folder = utils_path.append(db_folder, ix_str)

    if not os.path.isdir(ix_folder):
        continue

    ix = utils_str.to_int(ix_str)  # ix as in integer x

    if ix == None:
        continue

    for iy_str in os.listdir(ix_folder):
        iy_folder = utils_path.append(ix_folder, iy_str)

        if not os.path.isdir(iy_folder):
            continue

        iy = utils_str.to_int(iy_str)

        if iy == None:
            continue
# Author: Karl Zylinski, Uppsala University

# Do thing x after y seconds

import sys
import time
import os
import utils_str

def verify_arguments():
    if len(sys.argv) != 3:
        return False

    return True

assert verify_arguments(), "Usage: do_later.py command seconds"

cmd = sys.argv[1]
t = utils_str.to_int(sys.argv[2])

assert t != None, "Incorrect time supplied"

time.sleep(t)
os.system(cmd)
found_groups = cg["groups"]

cols = cg["columns"]
i_ra = cols.index("ra")
i_dec = cols.index("dec")
i_pmra = cols.index("pmra")
i_pmdec = cols.index("pmdec")
i_distance = cols.index("distance")

found_groups.sort(key=lambda x: x["size"])
clusters = []

id_to_look_for = None

if len(sys.argv) == 3:
    id_to_look_for = utils_str.to_int(sys.argv[2])

for fp in found_groups:
    gid = fp["id"]
    if id_to_look_for != None and gid != id_to_look_for:
        continue

    size = fp["size"]
    if size < min_size:
        continue

    avg_ra = 0
    avg_dec = 0
    avg_dist = 0

    for s in fp["stars"]: