Exemple #1
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
Exemple #2
0
    def los_corr(self, *args, array=True):
        """Takes in coordinates and returns corrected magnetic field.

        Applies the dot product between the observers unit vector and
        the heliographic radial vector to get the true magnitude of 
        the magnetic field vector. See geometric projection for
        calulations.
        """

        print("Correcting line of sight magnetic field.")
        if array:
            try:
                lonh, lath = M.deg2rad(self.lonh), M.deg2rad(self.lath)
            except AttributeError:
                self.heliographic()
                lonh, lath = M.deg2rad(self.lonh), M.deg2rad(self.lath)
        else:
            lonh, lath = M.deg2rad(self.heliographic(args[0], args[1]))

        B0 = M.deg2rad(self.B0)
        L0 = M.deg2rad(self.L0)

        Xobs = M.cos(B0)*M.cos(L0)
        Yobs = M.cos(B0)*M.sin(L0)
        Zobs = M.sin(B0)

        corr_factor = (M.cos(lath)*M.cos(lonh)*Xobs
                + M.cos(lath)*M.sin(lonh)*Yobs
                + M.sin(lath)*Zobs)

        if array:
            self.im_corr = self.im_raw_u/corr_factor
            bad_ind = np.where(self.rg > self.rsun*np.sin(75.0*np.pi/180))
            self.im_corr[bad_ind] = np.nan
            return
        else:
            return self.im_raw.data[args[0], args[1]]/corr_factor