Skip to content

Commit 834636e

Browse files
committed
resyncing to bring inline
1 parent 8ae54a1 commit 834636e

File tree

4 files changed

+45
-6
lines changed

4 files changed

+45
-6
lines changed

galaxydetect.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@
1717

1818
#galaxy detection
1919
x = 0
20-
while x<5000:
20+
while x<10000:
2121

2222
starloc = s.FindBrightest()
2323
if s.img[starloc]<3500:
2424
print "hit background level in count"
2525
break
2626
galradius=s.FindGalaxyRadius(starloc)
2727
galcount=s.MaskGalaxy(starloc, Gradius=galradius)
28-
galflux=s.flux(starloc)
28+
galflux=s.count_to_flux(galcount)
2929
stars.append({'coords':starloc, 'count':galcount, 'flux':galflux}) #adds star's paramters to catalogue
30-
print x, " ",s.img[starloc], " ", starloc, " ", galflux, " ", galradius
30+
print x, " ",starloc, " ",s.img[starloc], " ", galcount, " ", galflux, " ", galradius
3131
x=x+1
3232

3333
#print stars
@@ -50,4 +50,4 @@
5050
plt.semilogy()
5151
#ax = plt
5252
#ax.set_yscale('log')
53-
plt.show()
53+
plt.show()

plotter.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,40 @@
3131
top = bottom + n
3232

3333

34+
# we need a (numrects x numsides x 2) numpy array for the path helper
35+
# function to build a compound path
36+
XY = np.array([[left,left,right,right], [bottom,top,top,bottom]]).T
37+
38+
# get the Path object
39+
barpath = path.Path.make_compound_path_from_polys(XY)
40+
41+
# make a patch out of it
42+
patch = patches.PathPatch(barpath, facecolor='blue', edgecolor='blue', alpha=0.8)
43+
ax.add_patch(patch)
44+
45+
# update the view limits
46+
ax.set_xlim(left[0], right[-1])
47+
ax.set_ylim(bottom.min(), top.max())
48+
ax.set_yscale('log') #sets log scale for y-axis
49+
plt.show()
50+
51+
#s.img=s.img-3400
52+
s.ConvertFlux()
53+
54+
55+
fig, ax = plt.subplots()
56+
57+
# histogram our data with numpy
58+
59+
n, bins = np.histogram(s.img, 10000) # indjusts the numbe of bins.
60+
61+
# get the corners of the rectangles for the histogram
62+
left = np.array(bins[:-1])
63+
right = np.array(bins[1:])
64+
bottom = np.zeros(len(left))
65+
top = bottom + n
66+
67+
3468
# we need a (numrects x numsides x 2) numpy array for the path helper
3569
# function to build a compound path
3670
XY = np.array([[left,left,right,right], [bottom,top,top,bottom]]).T

stardetect.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,5 @@
3030

3131
plt.clf()
3232
plt.imshow(s.masked)
33-
plt.show()
33+
plt.show()
34+

starprocessor.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ def __init__(self):
1515

1616
def ConvertFlux(self):
1717
#converts whole image to flux
18+
print self.header['MAGZPT']
19+
print self.header['MAGZRR']
1820
self.img = -2.5*np.log10(self.img)
1921
self.img += self.header['MAGZPT']
2022
self.RecalculateMasked()
@@ -152,10 +154,12 @@ def MaskGalaxy(self, coords, Gradius = 12, Bradius=50):
152154
avecount = avecount-localbck
153155
localmask = np.logical_not(gal)
154156
#print "true <count>", avecount
157+
if avecount<0:
158+
avecount=0
155159
self.mask = np.logical_and(self.mask, localmask)
156160
self.RecalculateMasked()
157161
return avecount
158-
162+
159163
def RecalculateMasked(self):
160164
self.masked = self.img*self.mask
161165

0 commit comments

Comments
 (0)