Ejemplo n.º 1
0
 def __init__(self, nrho, rss, gong_map=sunpy.map.Map(get_gong_map())):
     self._nrho = nrho
     self._rss = rss
     self.gong_map = gong_map
     self.input = pfsspy.Input(self.gong_map, self.nrho, self.rss)
     self._output = pfsspy.pfss(self.input)
     self.tracer = tracing.PythonTracer()
Ejemplo n.º 2
0
# First, import required modules
import astropy.constants as const
import astropy.units as u
import matplotlib.pyplot as plt
import numpy as np
import sunpy.map
from astropy.coordinates import SkyCoord

import pfsspy
from pfsspy import coords, tracing
from pfsspy.sample_data import get_gong_map

###############################################################################
# Load a GONG magnetic field map. If 'gong.fits' is present in the current
# directory, just use that, otherwise download a sample GONG map.
gong_fname = get_gong_map()

###############################################################################
# We can now use SunPy to load the GONG fits file, and extract the magnetic
# field data.
#
# The mean is subtracted to enforce div(B) = 0 on the solar surface: n.b. it is
# not obvious this is the correct way to do this, so use the following lines
# at your own risk!
gong_map = sunpy.map.Map(gong_fname)
# Remove the mean
gong_map = sunpy.map.Map(gong_map.data - np.mean(gong_map.data), gong_map.meta)

###############################################################################
# The PFSS solution is calculated on a regular 3D grid in (phi, s, rho), where
# rho = ln(r), and r is the standard spherical radial coordinate. We need to