import pyfits import numpy # nacteni snimku barn = pyfits.open('barnard_y_0007.fits') cts = barn[0].data barn.close() # pozadi pozadi = cts[1100-10:1100+10,840-10:840+10] back = pozadi.mean() print("Pozadi=",back) # detail hvezdy box = 4 x0 = 863 y0 = 957 detail = cts[y0-box:y0+box,x0-box:x0+box] print(detail) # wahy detail = detail - int(back) print(detail) #teziste s = 0 n = 0 for i in range(0,2*box): for j in range(0,2*box): s = s + detail[j,i]*i n = n + detail[j,i] xt = s / n print("Teziste v x:",xt) s = 0 n = 0 for i in range(0,2*box): for j in range(0,2*box): s = s + detail[j,i]*j n = n + detail[j,i] yt = s / n print("Teziste v y =",yt)