예제 #1
0
def analyse_darks(cam):    
    """
    Try to fit a linear model to dark frames.
    """

    # Collect the data
    groups = group_darks(cam, "EXPTIME", "SETTEMP")
    print cam
    data = []
    for time in groups:
        for temp in groups[time]:
            for image in groups[time][temp]:
                data.append([image.MEAN, time, temp])
             
    # Do the regression
    beta0, beta1, beta2 = regress(data)
    print "count = %f + %ft + %fT" % (beta0, beta1, beta2)

    # Calculate residuals
    resids = []
    key_sorted = groups.keys()
    key_sorted.sort()
    for time in key_sorted:
        res = []
        key2_sorted = groups[time].keys()
        key2_sorted.sort()
        for temp in key2_sorted:
            r = []
            for image in groups[time][temp]:
                r.append(image.MEAN - (beta0 + beta1*time + beta2*temp))
            res.append(avg(r))
        resids.append(res)


    # Display residual results
    print resids
    print key_sorted, key2_sorted
예제 #2
0
파일: dark.py 프로젝트: timleslie/gattini
def analyse_darks(cam):
    """
    Try to fit a linear model to dark frames.
    """

    # Collect the data
    groups = group_darks(cam, "EXPTIME", "SETTEMP")
    print cam
    data = []
    for time in groups:
        for temp in groups[time]:
            for image in groups[time][temp]:
                data.append([image.MEAN, time, temp])

    # Do the regression
    beta0, beta1, beta2 = regress(data)
    print "count = %f + %ft + %fT" % (beta0, beta1, beta2)

    # Calculate residuals
    resids = []
    key_sorted = groups.keys()
    key_sorted.sort()
    for time in key_sorted:
        res = []
        key2_sorted = groups[time].keys()
        key2_sorted.sort()
        for temp in key2_sorted:
            r = []
            for image in groups[time][temp]:
                r.append(image.MEAN - (beta0 + beta1 * time + beta2 * temp))
            res.append(avg(r))
        resids.append(res)

    # Display residual results
    print resids
    print key_sorted, key2_sorted
예제 #3
0
 def plot_regression(self, ax, X, Y):
     dat = N.vstack((Y, X)).transpose()
     b, m = regress(dat)
     print b, m
     xs = N.linspace(X.min(), X.max(), 10)
     ax.plot(xs, b + m*xs, linewidth=2)