Exemple #1
0
def predict(abg,date,obs=568):
    """Run GB's predict using an ABG file as input."""
    import orbfit
    import RO.StringUtil
    (ra,dec,a,b,ang) = orbfit.predict(abg,date,obs)
    obj['RA']=ra
    obj['DEC']=dec
    obj['dRA']=a
    obj['dDEC']=b
    obj['dANG']=ang
    return obj
Exemple #2
0
def predict(abg, date, obs=568):
    """Run GB's predict using an ABG file as input."""
    import orbfit
    import RO.StringUtil
    (ra, dec, a, b, ang) = orbfit.predict(abg, date, obs)
    obj['RA'] = ra
    obj['DEC'] = dec
    obj['dRA'] = a
    obj['dDEC'] = b
    obj['dANG'] = ang
    return obj
Exemple #3
0
def do_objs(kbos):
    """Draw the actual plot"""

    import orbfit, ephem, math
    import re
    re_string=w.FilterVar.get()
    vlist=[]
    for name in kbos:
        if not re.search(re_string,name):
            continue
        vlist.append(name)
        if type(kbos[name])==type(ephem.EllipticalBody()):
	    kbos[name].compute(w.date.get())
	    ra=kbos[name].ra
	    dec=kbos[name].dec
	    a=math.radians(10.0/3600.0)
	    b=a
	    ang=0.0
	    color='blue'
            yoffset=+10
	    xoffset=+10
        else:
            yoffset=-10
            xoffset=-10
            file=kbos[name]
	    jdate=ephem.julian_date(w.date.get())
	    obs=568
 	    try:
	        position=orbfit.predict(file,jdate,obs)
	    except:
		continue
	    ra=math.radians(position[0])
	    dec=math.radians(position[1])
	    a=math.radians(position[2]/3600.0)
	    b=math.radians(position[3]/3600.0)
	    ang=math.radians(position[4])
	    if ( a> math.radians(1.0) ):
	        color='green'
            else:
	        color='black'
	if w.show_ellipse.get()==1 :
            if ( a < math.radians(5.0) ): 
	        w.create_ellipse(ra,dec,a,b,ang)
        if ( a < math.radians(1.0) ): 
            w.create_point(ra,dec,size=2,color=color)
	if w.show_labels.get()==1:
	    w.label(ra,dec,name,offset=[xoffset,yoffset])
    vlist.sort()
    for v in vlist:
        w.objList.insert(END,v)
    w.plot_pointings()
Exemple #4
0
    def relocate(self):
        """Move to the postion of self.SearchVar"""

        name=self.SearchVar.get()
        if kbos.has_key(name):
	    import orbfit,ephem,math

	    jdate=ephem.julian_date(w.date.get())
 	    try:
	        (ra,dec,a,b,ang)=orbfit.predict(kbos[name],jdate,568)
	    except:
		return
	    ra=math.radians(ra)
	    dec=math.radians(dec)
	elif mpc_objs.has_key(name):
	    ra=mpc_objs[name].ra
	    dec=mpc_objs[name].dec
	self.recenter(ra,dec)
	self.create_point(ra,dec,color='blue',size=4)
Exemple #5
0
fitsImages = sys.argv[2:]

for fitsImage in fitsImages:
    f = pyfits.open(fitsImage)
    sdate = f[0].header.get('DATE-OBS', None)
    if sdate is None:
        mjdate = f[0].header['MEANMJD']
    else:
        sdate = sdate.replace("-", "/")
        mjdate = f[0].header['MJD-OBS']
    #   date=ephem.julian_date(sdate)+dfrac
    date = mjdate + 2400000.5
    dfrac = mjdate - math.floor(mjdate)

    (ra, dec, dra, ddec, dang) = orbfit.predict(
        "/home/cadc/kavelaar/dbase/TNOdb/dbase/data/orbb/" + name + ".abg",
        date, obs)

    window = max(dra / 0.18 + 100, ddec / 0.18 + 100, 1000.)

    wcsObject = wcsutil.WCSObject(f[0].header)
    (x, y) = wcsObject.rd2xy((ra, dec))
    print fitsImage, ra, dec, x, y, dra, ddec, dang
    x1 = math.floor(max(x - window, 1))
    x2 = math.floor(min(x + window, f[0].header['NAXIS1']))
    y1 = math.floor(max(y - window, 1))
    y2 = math.floor(min(y + window, f[0].header['NAXIS2']))
    if not (x1 < f[0].header['NAXIS1'] and x2 > 0
            and y1 < f[0].header['NAXIS2'] and y2 > 0):
        continue
Exemple #6
0
obs = 568
fitsImages=sys.argv[2:]

for fitsImage in fitsImages:
    f = pyfits.open(fitsImage)
    sdate=f[0].header.get('DATE-OBS',None)
    if sdate is None:
       mjdate= f[0].header['MEANMJD']
    else:
       sdate=sdate.replace("-","/")
       mjdate=f[0].header['MJD-OBS']
    #   date=ephem.julian_date(sdate)+dfrac
    date = mjdate + 2400000.5
    dfrac = mjdate-math.floor(mjdate)
    
    (ra,dec,dra,ddec,dang)=orbfit.predict("/home/cadc/kavelaar/dbase/TNOdb/dbase/data/orbb/"+name+".abg",
                                          date,obs)

    window = max(dra/0.18+100,ddec/0.18+100,1000.)

    wcsObject = wcsutil.WCSObject(f[0].header)
    (x,y)=wcsObject.rd2xy((ra,dec))
    print fitsImage,ra,dec, x,y,dra, ddec, dang    
    x1=math.floor(max(x-window,1))
    x2=math.floor(min(x+window,f[0].header['NAXIS1']))
    y1=math.floor(max(y-window,1))
    y2=math.floor(min(y+window,f[0].header['NAXIS2']))
    if not (x1< f[0].header['NAXIS1'] and x2 > 0 and y1 < f[0].header['NAXIS2'] and y2 >0 ):
        continue

    cmd='imcopy %s[%d:%d,%d:%d] - | xpaset ds9 fits new ' % ( fitsImage,x1,x2,y1,y2)
    print cmd