Beispiel #1
0
    def create_pointing(self, event, label_text=None):
        """Plot the sky coverage of pointing at event.x,event.y on the canvas.

        """

        (ra, dec) = self.c2p((self.canvasx(event.x),
                              self.canvasy(event.y)))
        this_camera = Camera(camera=self.camera.get())
        ccds = this_camera.getGeometry(ra, dec)
        items = []
        for ccd in ccds:
            if len(ccd) == 4:
                (x1, y1) = self.p2c((ccd[0], ccd[1]))
                (x2, y2) = self.p2c((ccd[2], ccd[3]))
                item = self.create_rectangle(x1, y1, x2, y2, stipple='gray25', fill=None)
            else:
                (x1, y1) = self.p2c((ccd[0] - ccd[2], ccd[1] - ccd[2]))
                (x2, y2) = self.p2c((ccd[0] + ccd[2], ccd[1] + ccd[2]))
                item = self.create_oval(x1, y1, x2, y2)
            items.append(item)
        label = {}
        if label_text is None:
            label_text = self.plabel.get()
        label['text'] = label_text
        label['id'] = self.label(this_camera.ra, this_camera.dec, label['text'])
        self.pointings.append({
            "label": label,
            "items": items,
            "camera": this_camera})
        self.current = len(self.pointings) - 1
        self.current_pointing(len(self.pointings) - 1)
Beispiel #2
0
    def plot_points_list(self, points):

        for point in points:
            label = {}
            try:
                not_ephem = False
                date = Time(point[0], scale='utc')
            except:
                not_ephem = True
            if not_ephem:
                label['text'] = point[0]
            else:
                label['text'] = "EPHEM"
            try:
                (ra, dec) = (ephem.hours(point[1]), ephem.degrees(point[2]))
            except:
                logging.warn("Failed to convert {} {} to RA/DEC".format(
                    point[1], point[2]))
                continue
            this_camera = Camera(camera=self.camera.get())
            ccds = this_camera.getGeometry(float(ra), float(dec))
            items = []
            for ccd in ccds:
                if len(ccd) == 4:
                    (x1, y1) = self.p2c((ccd[0], ccd[1]))
                    (x2, y2) = self.p2c((ccd[2], ccd[3]))
                    item = self.create_rectangle(x1,
                                                 y1,
                                                 x2,
                                                 y2,
                                                 stipple='gray25',
                                                 fill=None)
                else:
                    (x1, y1) = self.p2c(
                        (ccd[0] - ccd[2] / math.cos(ccd[1]), ccd[1] - ccd[2]))
                    (x2, y2) = self.p2c(
                        (ccd[0] + ccd[2] / math.cos(ccd[1]), ccd[1] + ccd[2]))
                    item = self.create_oval(x1, y1, x2, y2)
                items.append(item)
            self.pointings.append({
                "label": label,
                "items": items,
                "camera": this_camera
            })
            if not not_ephem:
                break
        self.plot_pointings()
        return
Beispiel #3
0
    def plot_points_list(self, points):

        for point in points:
            label = {}
            try:
                not_ephem = False
                date = Time(point[0], scale='utc')
            except:
                not_ephem = True
            if not_ephem:
                label['text'] = point[0]
            else:
                label['text'] = "EPHEM"
            try:
                (ra, dec) = (ephem.hours(point[1]), ephem.degrees(point[2]))
            except:
                logging.warn("Failed to convert {} {} to RA/DEC".format(point[1], point[2]))
                continue
            this_camera = Camera(camera=self.camera.get())
            ccds = this_camera.getGeometry(float(ra), float(dec))
            items = []
            for ccd in ccds:
                if len(ccd) == 4:
                    (x1, y1) = self.p2c((ccd[0], ccd[1]))
                    (x2, y2) = self.p2c((ccd[2], ccd[3]))
                    item = self.create_rectangle(x1, y1, x2, y2, stipple='gray25', fill=None)
                else:
                    (x1, y1) = self.p2c((ccd[0] - ccd[2] / math.cos(ccd[1]), ccd[1] - ccd[2]))
                    (x2, y2) = self.p2c((ccd[0] + ccd[2] / math.cos(ccd[1]), ccd[1] + ccd[2]))
                    item = self.create_oval(x1, y1, x2, y2)
                items.append(item)
            self.pointings.append({"label": label,
                                   "items": items,
                                   "camera": this_camera})
            if not not_ephem:
                break
        self.plot_pointings()
        return
Beispiel #4
0
    def create_pointing(self, event, label_text=None):
        """Plot the sky coverage of pointing at event.x,event.y on the canvas.

        """

        (ra, dec) = self.c2p((self.canvasx(event.x), self.canvasy(event.y)))
        this_camera = Camera(camera=self.camera.get())
        ccds = this_camera.getGeometry(ra, dec)
        items = []
        for ccd in ccds:
            if len(ccd) == 4:
                (x1, y1) = self.p2c((ccd[0], ccd[1]))
                (x2, y2) = self.p2c((ccd[2], ccd[3]))
                item = self.create_rectangle(x1,
                                             y1,
                                             x2,
                                             y2,
                                             stipple='gray25',
                                             fill=None)
            else:
                (x1, y1) = self.p2c((ccd[0] - ccd[2], ccd[1] - ccd[2]))
                (x2, y2) = self.p2c((ccd[0] + ccd[2], ccd[1] + ccd[2]))
                item = self.create_oval(x1, y1, x2, y2)
            items.append(item)
        label = {}
        if label_text is None:
            label_text = self.plabel.get()
        label['text'] = label_text
        label['id'] = self.label(this_camera.ra, this_camera.dec,
                                 label['text'])
        self.pointings.append({
            "label": label,
            "items": items,
            "camera": this_camera
        })
        self.current = len(self.pointings) - 1
        self.current_pointing(len(self.pointings) - 1)