예제 #1
0
파일: phot.py 프로젝트: timleslie/gattini
def find_center(id):
    db = MySQLdb.connect(db="test")
    cursor = MySQLdb.cursors.Cursor(db)

    sql = "SELECT X, Y from phot where star_id=%d and mag3 > 1 and err3='NoError' and err4='NoError'" % id
    cursor.execute(sql)
    data = result_to_recarray(cursor)
    res = fmin(f, (800, 600, 150), (data['X'], data['Y']))
    return res
예제 #2
0
def find_center(id):
    db = MySQLdb.connect(db="test")
    cursor = MySQLdb.cursors.Cursor(db)


    sql = "SELECT X, Y from phot where star_id=%d and mag3 > 1 and err3='NoError' and err4='NoError'" % id
    cursor.execute(sql)
    data = result_to_recarray(cursor)
    res = fmin(f, (800, 600, 150), (data['X'], data['Y']))
    return res
예제 #3
0
    def get_data(self, star):
        #print "DB"
        keys = [self.x, self.y]
        keys += [k for k in [self.z, self.s, self.c] if k]

        db = MySQLdb.connect(db="test")
        cursor = MySQLdb.cursors.Cursor(db)

        ss = ", ".join(["%s"]*len(keys))
        sql = ("SELECT %s from phot where star_id=%d and mag3 > 1 and err3='NoError' and err4='NoError'" % (ss, star))
        sql = sql % tuple(keys)
        #print sql
        cursor.execute(sql)
        data = result_to_recarray(cursor)
        return data
예제 #4
0
파일: phot.py 프로젝트: timleslie/gattini
    def get_data(self, star):
        #print "DB"
        keys = [self.x, self.y]
        keys += [k for k in [self.z, self.s, self.c] if k]

        db = MySQLdb.connect(db="test")
        cursor = MySQLdb.cursors.Cursor(db)

        ss = ", ".join(["%s"] * len(keys))
        sql = (
            "SELECT %s from phot where star_id=%d and mag3 > 1 and err3='NoError' and err4='NoError'"
            % (ss, star))
        sql = sql % tuple(keys)
        #print sql
        cursor.execute(sql)
        data = result_to_recarray(cursor)
        return data