Пример #1
0
def make_summary(star, factor=2.5, clear=True):
    """
    Update the database with a summary for the given star using the given factor.
    """
    if clear:
        sql =  "DELETE FROM summaries where factor = %f and ID = %d" % (factor, star)
        run_sql(sql)

    if len(get_summary_data(star, factor)) > 0:
        print "returning??"
        return

    points = make_radial_ratio_data(star)    
    buckets = [[] for _ in range(int(360/factor))]

    for mag3, mag4, angle, radius, time in points:
        buckets[int(angle/factor)].append((mag3, mag4, radius))

    for angle, bucket in enumerate(buckets):
        if bucket:            
            bucket = recarray_wrap(bucket, names=["ratio3", "ratio4", "r"])
            mags3 = bucket["ratio3"]
            mags4 = bucket["ratio4"]
            radii = bucket["r"]
        else:
            mags3, mags4, radii = [0], [0], [0]
        sql = "INSERT INTO summaries VALUES " + \
              "(%d, %d, %f, %f, %f, %f, %f, %f, %f)" % \
              (star, angle, factor, mean(mags3), std(mags3),
               mean(mags4), std(mags4), mean(radii), std(radii))
        run_sql(sql)
Пример #2
0
def make_summary(star, factor=2.5, clear=True):
    """
    Update the database with a summary for the given star using the given factor.
    """
    if clear:
        sql = "DELETE FROM summaries where factor = %f and ID = %d" % (factor,
                                                                       star)
        run_sql(sql)

    if len(get_summary_data(star, factor)) > 0:
        print "returning??"
        return

    points = make_radial_ratio_data(star)
    buckets = [[] for _ in range(int(360 / factor))]

    for mag3, mag4, angle, radius, time in points:
        buckets[int(angle / factor)].append((mag3, mag4, radius))

    for angle, bucket in enumerate(buckets):
        if bucket:
            bucket = recarray_wrap(bucket, names=["ratio3", "ratio4", "r"])
            mags3 = bucket["ratio3"]
            mags4 = bucket["ratio4"]
            radii = bucket["r"]
        else:
            mags3, mags4, radii = [0], [0], [0]
        sql = "INSERT INTO summaries VALUES " + \
              "(%d, %d, %f, %f, %f, %f, %f, %f, %f)" % \
              (star, angle, factor, mean(mags3), std(mags3),
               mean(mags4), std(mags4), mean(radii), std(radii))
        run_sql(sql)
Пример #3
0
def process(star, factor=2.5):
    """
    Process a single star using the given factor. Returns a recarray
    with the data summary and another with the outliers.
    """
    points = make_radial_ratio_data(star)    
    summary = get_summary_data(star, factor)
    outliers = get_outliers(summary, points, factor)
    return summary, outliers
Пример #4
0
def process(star, factor=2.5):
    """
    Process a single star using the given factor. Returns a recarray
    with the data summary and another with the outliers.
    """
    points = make_radial_ratio_data(star)
    summary = get_summary_data(star, factor)
    outliers = get_outliers(summary, points, factor)
    return summary, outliers