Exemple #1
0
 def __init__(self, pts=None, file="turtleall.txt"):
     """Initialize mapper.  If no points given, reads from file instead."""
     # Points to use in simulation
     if pts is None:
         self.sim = SimSim(file)
     else:
         self.sim = SimPts(pts)
     
     self.imagename = "__example1.fits"
     
     rbounds, dbounds = self.findBounds()
     self.size = [rbounds[1]-rbounds[0], dbounds[1]-dbounds[0]]
     
     # format center pos: HH MM SS
     center = [celestial.lon2hms(sum(rbounds)/2.0), celestial.lat2dms(sum(dbounds)/2.0)]
     self.position = [re.sub("[hdms]|\.\w+", " ", c).strip() for c in center]
     
     if DEBUG:
         print 'bounds are',rbounds,'and',dbounds
         print 'which correspond to',[celestial.lon2hms(rb) for rb in rbounds],
         print 'and',[celestial.lat2dms(db) for db in dbounds]
         print 'got size',self.size
         print 'got position',self.position
         print '---------------------------'
Exemple #2
0
 def plot_beam(self, cb):
     """Plot current beam point"""
     ra, dec, offset = self.sim.getNextPoint()
     
     if not self.sim.hasNextPoint():
         self.sim.endSim()
         cb.deschedule()
         return
     
     if offset == "None":
         offset = ('00:00:00','00:00:00')
     else:
         offset = offset[offset.find("(")+1:offset.find(")")].split(", ")
     offra, offdec = offset
     
     ra = self.getDegFromHMS(ra) + self.getDegFromHMS(offra)
     dec = self.getDegFromDMS(dec) + self.getDegFromDMS(offdec)
     
     #centerfreq = float(row[29])
     #beamsize = (self.gbtbeamsize(centerfreq)/60/60)
     # not sure how to find this from simulation, hard-coding for now
     beamsize = 0.01
     color = 'r'
     if DEBUG:
         print '---------------------------'
         print 'count',cb.count
         print 'ra,dec',ra,dec,'or',celestial.lon2hms(ra),celestial.lat2dms(dec)
         print 'beamsize', beamsize
         #print 'target ra,dec',celestial.lon2hms(ra_targ),celestial.lat2dms(dec_targ)
     
     #oldra, olddec = cb.lastpt
     #cb.lastpt = (ra, dec)
     beam = cb.annim.Beam(beamsize, beamsize/2, 0, xc=ra, yc=dec, #pos=pos,
                       fc=color, fill=True, alpha=.5)
     
     background = cb.canvas.copy_from_bbox(cb.annim.frame.bbox)
     cb.annim.objlist = [beam]
     cb.canvas.restore_region(background)
     cb.canvas.blit(cb.annim.frame.bbox)
     cb.annim.plot()
 
     for beam in cb.annim.frame.patches:
         cb.annim.frame.draw_artist(beam)
     
     cb.annim.frame.patches = []
     cb.count = cb.count + 1