def transform(contours, wcs_in, wcs_out, filled=False): system_in, equinox_in, units_in = wcs_util.system(wcs_in) system_out, equinox_out, units_out = wcs_util.system(wcs_out) for contour in contours.collections: polygons_out = [] for polygon in contour.get_paths(): xp_in = polygon.vertices[:, 0] yp_in = polygon.vertices[:, 1] xw, yw = wcs_util.pix2world(wcs_in, xp_in, yp_in) xw, yw = wcs_util.convert_coords(xw, yw, input=(system_in, equinox_in), output=(system_out, equinox_out)) xp_out, yp_out = wcs_util.world2pix(wcs_out, xw, yw) if filled: polygons_out.append(Path(np.array(zip(xp_out, yp_out)),codes=polygon.codes)) else: polygons_out.append(zip(xp_out, yp_out)) if filled: contour.set_paths(polygons_out) else: contour.set_verts(polygons_out) contour.apl_converted = True
def __init__(self, parent): # Store references to axes self._ax1 = parent._ax1 self._ax2 = parent._ax2 self._wcs = parent._wcs self._figure = parent._figure # Set font self._label_fontproperties = FontProperties() self._ax2.yaxis.set_label_position('right') self._ax2.xaxis.set_label_position('top') system, equinox, units = wcs_util.system(self._wcs) if system == 'equatorial': if equinox == 'b1950': self.set_xtext('RA (B1950)') self.set_ytext('Dec (B1950)') else: self.set_xtext('RA (J2000)') self.set_ytext('Dec (J2000)') elif system == 'galactic': self.set_xtext('Galactic Longitude') self.set_ytext('Galactic Latitude') else: self.set_xtext('Ecliptic Longitude') self.set_ytext('Ecliptic Latitude') self.set_xposition('bottom') self.set_yposition('left')
def __init__(self, parent): # Store references to axes self._ax1 = parent._ax1 self._ax2 = parent._ax2 self._wcs = parent._wcs self._figure = parent._figure # Set font self._label_fontproperties = FontProperties() self.set_style('plain') system, equinox, units = wcs_util.system(self._wcs) # Set default label format if system == 'equatorial': self.set_xformat("hh:mm:ss.ss") self.set_yformat("dd:mm:ss.s") else: self.set_xformat("ddd.dddd") self.set_yformat("dd.dddd") # Set major tick formatters fx1 = WCSFormatter(wcs=self._wcs, coord='x') fy1 = WCSFormatter(wcs=self._wcs, coord='y') self._ax1.xaxis.set_major_formatter(fx1) self._ax1.yaxis.set_major_formatter(fy1) fx2 = mpl.NullFormatter() fy2 = mpl.NullFormatter() self._ax2.xaxis.set_major_formatter(fx2) self._ax2.yaxis.set_major_formatter(fy2)
def __init__(self, parent): # Store references to axes self._ax1 = parent._ax1 self._ax2 = parent._ax2 self._wcs = parent._wcs self._figure = parent._figure # Set font self._label_fontproperties = FontProperties() self.set_style("plain") system, equinox, units = wcs_util.system(self._wcs) # Set default label format if system == "equatorial": self.set_xformat("hh:mm:ss.ss") self.set_yformat("dd:mm:ss.s") else: self.set_xformat("ddd.dddd") self.set_yformat("dd.dddd") # Set major tick formatters fx1 = WCSFormatter(wcs=self._wcs, coord="x") fy1 = WCSFormatter(wcs=self._wcs, coord="y") self._ax1.xaxis.set_major_formatter(fx1) self._ax1.yaxis.set_major_formatter(fy1) fx2 = mpl.NullFormatter() fy2 = mpl.NullFormatter() self._ax2.xaxis.set_major_formatter(fx2) self._ax2.yaxis.set_major_formatter(fy2) # Cursor display self._ax1._cursor_world = True self._figure.canvas.mpl_connect("key_press_event", self._set_cursor_prefs)