Esempio n. 1
0
def fitGaussianX(img, m, b, bright, offset, starX, starY, starR, gX, gY, gR, hotX, hotY):
    parDist,perpDist = GT.getDistancesHorizontal(m, b, img.shape[1], img.shape[0], offset)
    parF,perpF,imgF = getTrailBand(parDist, perpDist, img, 6)
    x,y = GT.getXY(parF,perpF,m,b,offset)
    
    trailScaled = imgF/bright(parF)

    fig,axes = plt.subplots(1,2,sharex = True, sharey = True)

    axes[0].plot(perpF,trailScaled,"bo")
    axes[0].set_title("Trail Gaussian With Stars")

    mask = getValueMask(img, x, y, starX, starY, starR, gX, gY, gR, hotX, hotY, 1)
    perpF = perpF[mask]
    trailScaled = trailScaled[mask]
    

    axes[1].plot(perpF,trailScaled,"bo")
    axes[1].set_title("Trail Gaussian Without Stars")

    plt.show()


    sDev = cf(gauss, perpF, trailScaled)[0][0]


    x = np.arange(-5,5,0.1)
    
    plt.plot(perpF,trailScaled,"bo",label = "Pixel Brightnesses")
    plt.plot(x,gauss(x,sDev), label = "Gaussian Fit")
    plt.title("Gaussian Fit")
    plt.show()

    return sDev
Esempio n. 2
0
def fitBrightnessSDev(img, m, b, offset, starX, starY, starR, gX, gY, gR, hotX, hotY, trailSize):
    parDist,perpDist = GT.getDistancesHorizontal(m, b, img.shape[1], img.shape[0], offset)
    parDistF,perpDistF,imgF = getTrailBand(parDist, perpDist, img, trailSize)
    x,y = GT.getXY(parDistF,perpDistF,m,b,offset)

    mask = getValueMask(img, x, y, starX, starY, starR, gX, gY, gR, hotX, hotY, 1)
    par = parDistF[mask]
    perp = perpDistF[mask]
    band = imgF[mask]

    b1, b2, b3, b4, b5, sDev = cf(GT.gaussian2, [par, perp], band, bounds = ([-math.inf,-math.inf,-math.inf,-math.inf,-math.inf,0],[math.inf,math.inf,math.inf,math.inf,math.inf,trailSize]))[0]

    return [np.poly1d([b1, b2, b3, b4, b5]), sDev]
Esempio n. 3
0
def estimateBackground(img, m, b, offset, starX, starY, starR, gX, gY, gR, hotX, hotY):
    parDist,perpDist = GT.getDistancesHorizontal(m, b, img.shape[1], img.shape[0], offset)
    par,perp,band = getNonTrailBand(parDist, perpDist, img, 10, 20)
    x,y = GT.getXY(par,perp,m,b,offset)

    mask = getValueMask(img, x, y, starX, starY, starR, gX, gY, gR, hotX, hotY, 1)
    par = par[mask]
    band = band[mask]

    mean = np.mean(band)

    plt.plot(par,band,"bo",label = "Background Pixel Brightnesses")
    plt.plot([par[0],par[-1]],[mean, mean],label = "Average Background Brightness: "+str(np.round(mean,decimals = 3)))
    plt.title("Background Estimate")
    plt.legend()
    plt.show()

    print(mean)
    return mean