コード例 #1
0
ファイル: dark.py プロジェクト: california43/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
コード例 #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
ファイル: browser.py プロジェクト: california43/gattini
 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)