Exemplo n.º 1
0
import math

stardb = stars.loadStars()


# riegel - 0.18 = 20 degrees
# epsilon ori 1.69 = 15 degrees
# 3/2 = 15/20
# min(mg1, mg2)


#THRESHOLD = math.cos(20.0/360.0*2.0*math.pi)
stardb = stars.loadStars()
#stardb = filter(lambda x: x['mg']<=6, stardb)

for star1 in stardb:
#    print star1['n']
    if star1['mg']<1:
        THRESHOLD = math.cos(20/360.0*2.0*math.pi)
    elif star1['mg']<3:
        THRESHOLD = math.cos(20/360.0*2.0*math.pi)
    else:       
        THRESHOLD = math.cos(10/360.0*2.0*math.pi)
    for star2 in stardb:
        if star1['n']==star2['n']:
            continue
        t = stars.dot(star1, star2)
        if t>=THRESHOLD :
            a = stars.length(stars.cross(star1, star2))
            print star1['n'], star2['n'], a 
Exemplo n.º 2
0
print "importing"
import stars
import sys
import math

if len(sys.argv)!= 4:
    print "usage:"
    print " lookup.py  Ra De Angle"
    exit()


stardb = stars.loadStars()

ra = sys.argv[1]
de = sys.argv[2]
angle = float(sys.argv[3])
direction = {}
direction['x'] = math.cos(stars.ra2rad_(ra))*math.cos(stars.de2rad_(de))
direction['y'] = math.sin(stars.ra2rad_(ra))*math.cos(stars.de2rad_(de))    
direction['z'] = math.sin(stars.de2rad_(de))

print "direction:", direction
threshold = math.cos(angle/360*2*math.pi)
print "threshold:", threshold
result = filter (lambda x: stars.dot(x, direction)>=threshold, stardb)

print "stars in angle", angle, " close to ", ra, de
for star in result:
    print star['n'], "ra", star['ra'], "de", star['de'], "mg", star['mg']
    
Exemplo n.º 3
0
"""
pairsdict = dict(((a,b),l) for (a,b,l) in pairs)
#print len(pairs), "pairs"

cnt = 0
for i in range(len(pairs)):
    j = i+1
    while j<len(pairs) and pairs[i][0] == pairs[j][0]:
        if float(pairs[j][2])>0 :
            a,b = pairs[i][1], pairs[j][1]
            if (a,b) in pairsdict:
                l = pairsdict[(a,b)]
            elif (b,a) in pairsdict:
                l = pairsdict[(b, a)]
            else:
                l = stars.dot (stardict[a], stardict[b])
            # check triangle direction. it must be CCW
            star1 = stardict[a]
            star2 = stardict[b]
            star0 = stardict[pairs[i][0]]
            CCW = stars.dot(stars.cross(stars.minus(star1, star0), stars.minus(star2, star0)), star0)<0
               
            if float(pairs[j][2])>0:
                print float(pairs[i][2])/float(pairs[j][2]), pairs[i][0], pairs[i][1], pairs[j][1], pairs[i][2], pairs[j][2], l
            # two variants
            if float(pairs[i][2])>0:
                print float(pairs[j][2])/float(pairs[i][2]), pairs[i][0], pairs[j][1], pairs[i][1], pairs[j][2], pairs[i][2], l
            
            cnt +=2
        j += 1