예제 #1
0
    def _grid(self, corners=False):
        """Create an xy grid of coordinates for heliographic array.

        Uses meshgrid. If corners is selected, this function will shift
        the array by half a pixel in both directions so that the corners
        of the normal array can be accessed easily.
        """
        # Retrieve integer dimensions and create arrays holding
        # x and y coordinates of each pixel
        xDim = np.int(np.floor(self.im_raw.dimensions[0].value))
        yDim = np.int(np.floor(self.im_raw.dimensions[1].value))
        
        if corners:
            xRow = (np.arange(0, xDim + 1) - self.X0 - 0.5)*self.xScale
            yRow = (np.arange(0, yDim + 1) - self.Y0 - 0.5)*self.yScale
            xg, yg = M.meshgrid(xRow, yRow)
            rg = M.sqrt(xg**2 + yg**2)
            self.Rg = rg
        else:
            xRow = (np.arange(0, xDim) - self.X0)*self.xScale
            yRow = (np.arange(0, yDim) - self.Y0)*self.yScale
            xg, yg = M.meshgrid(xRow, yRow)
            rg = M.sqrt(xg**2 + yg**2)
            self.xg = xg
            self.yg = yg
            self.rg = rg

        return xg, yg
예제 #2
0
    def _hpc_hcc(self, x, y):
        """Converts hpc coordinates to hcc coordinates. 

        x -- x coordinate in arcseconds
        y -- y coordinate in arcseconds
        Calculations taken and shortened from sunpy.wcs.
        """
        x *= np.deg2rad(1)/3600.0
        y *= np.deg2rad(1)/3600.0

        q = self.dsun * M.cos(y) * M.cos(x)
        distance = q**2 - self.dsun**2 + self.RSUN_METERS**2
        distance = q - M.sqrt(distance)
        
        rx = distance * M.cos(y) * M.sin(x)
        ry = distance * M.sin(y)
        rz = M.sqrt(self.RSUN_METERS**2 - rx**2 - ry**2)

        return rx, ry, rz
예제 #3
0
    def _hcc_hg(self, x, y, z):
        """Converts hcc coordinates to Stonyhurst heliographic. 

        x - x coordinate in meters
        y - y coordinate in meters 
        z - z coordinate in meters
        Calculations taken and shortened
        from sunpy.wcs.
        """
        cosb = M.cos(M.deg2rad(self.B0))
        sinb = M.sin(M.deg2rad(self.B0))

        hecr = M.sqrt(x**2 + y**2 + z**2)
        hgln = M.arctan2(x, z*cosb - y*sinb) \
                + M.deg2rad(self.L0)
        hglt = M.arcsin((y * cosb + z * sinb)/hecr)

        return hgln*180/np.pi, hglt*180/np.pi