Exemplo n.º 1
0
    def process_data(cur):
        stars = get_stars_with_no_amplitudes(cur)

        def process_curves(cur2):
            for s in stars:
                i = s[0]
                survey = s[1]
                cluster = s[2]
                period = s[3]

                print(i, cluster, survey, period)

                for band in ["I", "V"]:
                    print(band)
                    curve = get_light_curve(cur2, i, survey, cluster, band)

                    for c in curve:
                        lc = database.unpack_curve(c)

                        results = process((lc, period))

                        save_results(cur, s, band, results)

                print("")

        database.with_database(database_file, process_curves)
Exemplo n.º 2
0
def main():
    """
    python3 add.py ../../rrab.sqlite RRab.csv curves.csv
    """
    database_file = sys.argv[1]
    survey = "Ferro_2012"
    cluster = "M53"
    catalog_file = sys.argv[2]
    curves_file = sys.argv[3]

    oost = "II"
    survey_info = pd.read_csv(catalog_file)

    ID = "VName"
    PERIOD = "Per"

    lc_ids = np.array([i.strip() for i in survey_info[ID]])
    periods = np.array(survey_info[PERIOD])

    data = np.column_stack((lc_ids, periods))

    def process_data(cur):
        database.add_survey(cur, survey, cluster, oost)

        for row in data:
            i = row[0]
            period = row[1]

            database.add_star(cur, i, survey, cluster, period)

            curves = pd.read_csv(curves_file)

            for band in ["I", "V"]:
                curve = get_light_curve(curves, band, i)

                print(i, band)
                database.add_light_curve(cur, i, survey, cluster, band,
                        curve)

    database.with_database(database_file, process_data)
Exemplo n.º 3
0
def main():
    """
    light_curve = numpy vector where dim 1 are the observations and in dim 2
    there are time mag magerr

    python3 calculate_amplitude.py rrab.sqlite
    """
    database_file = sys.argv[1]

    def process_data(cur):
        stars = get_stars_with_no_amplitudes(cur)

        def process_curves(cur2):
            for s in stars:
                i = s[0]
                survey = s[1]
                cluster = s[2]
                period = s[3]

                print(i, cluster, survey, period)

                for band in ["I", "V"]:
                    print(band)
                    curve = get_light_curve(cur2, i, survey, cluster, band)

                    for c in curve:
                        lc = database.unpack_curve(c)

                        results = process((lc, period))

                        save_results(cur, s, band, results)

                print("")

        database.with_database(database_file, process_curves)

    database.with_database(database_file, process_data)