Changelog¶
0.5.0¶
Changes to outputted maps¶
This release largely sees a transition to leveraging Sunpy Map objects. As such, the following changes have been made:
pfsspy.Input now must take a sunpy.map.GenericMap as an
input boundary condition (as opposed to a numpy array). To convert a numpy array
to a GenericMap, the helper function
pfsspy.carr_cea_wcs_header() can be used:
map_date = datetime(...)
br = np.array(...)
header = pfsspy.carr_cea_wcs_header(map_date, br.shape)
m = sunpy.map.Map((br, header))
pfss_input = pfsspy.Input(m, ...)
pfsspy.Output.source_surface_br now returns a GenericMap
instead of an array. To get the data array use source_surface_br.data.
The new pfsspy.Output.source_surface_pils returns the coordinates of
the polarity inversion lines on the source surface.
In favour of directly using the plotting functionality built into SunPy, the following plotting functionality has been removed:
pfsspy.Input.plot_input. InsteadInputhas a newmapproperty, which returns a SunPy map, which can easily be plotted usingsunpy.map.GenericMap.plot.pfsspy.Output.plot_source_surface. A map of \(B_{r}\) on the source surface can now be obtained usingpfsspy.Output.source_surface_br, which again returns a SunPy map.pfsspy.Output.plot_pil. The coordinates of the polarity inversion lines on the source surface can now be obtained usingpfsspy.Output.source_surface_pils, which can then be plotted usingax.plot_coord(pil[0])etc. See the examples section for an example.
Specifying tracing seeds¶
In order to make specifying seeds easier, they must now be a
SkyCoord object. The coordinates are internally
transformed to the Carrington frame of the PFSS solution, and then traced.
This should make specifying coordinates easier, as lon/lat/r coordinates can be created using:
seeds = astropy.coordinates.SkyCoord(lon, lat, r, frame=output.coordinate_frame)
To convert from the old x, y, z array used for seeds, do:
r, lat, lon = pfsspy.coords.cart2sph
r = r * astropy.constants.R_sun
lat = (lat - np.pi / 2) * u.rad
lon = lon * u.rad
seeds = astropy.coordinates.SkyCoord(lon, lat, r, frame=output.coordinate_frame)
Note that the latitude must be in the range \([-\pi/2, \pi/2]\).
GONG and ADAPT map sources¶
pfsspy now comes with built in sunpy map sources for GONG and ADAPT synoptic
maps, which automatically fix some non-compliant FITS header values. To use
these, just import pfsspy and load the .FITS files as normal with sunpy.
Tracing seeds¶
pfsspy.tracing.Tracer no longer has a transform_seeds helper method, which
has been replaced by coords_to_xyz and
xyz_to_coords. These new methods convert
between SkyCoord objects, and Cartesian xyz coordinates
of the internal magnetic field grid.
0.4.3¶
Improved the error thrown when trying to use :class`pfsspy.tracing.FotranTracer` without the
streamtracermodule installed.Fixed some layout issues in the documentation.
0.4.2¶
Fix a bug where :class`pfsspy.tracing.FotranTracer` would overwrite the magnetic field values in an
Outputeach time it was used.
0.4.1¶
Reduced the default step size for the
FortranTracerfrom 0.1 to 0.01 to give more resolved field lines by default.
0.4.0¶
New fortran field line tracer¶
pfsspy.tracing contains a new tracer,
FortranTracer. This requires and uses the
streamtracer package
which does streamline tracing rapidly in python-wrapped
fortran code. For large numbers of field lines this results in an ~50x
speedup compared to the PythonTracer.
Changing existing code to use the new tracer is as easy as swapping out
tracer = pfsspy.tracer.PythonTracer() for
tracer = pfsspy.tracer.FortranTracer(). If you notice any issues with the
new tracer, please report them at https://github.com/dstansby/pfsspy/issues.
Changes to field line objects¶
pfsspy.FieldLinesandpfsspy.FieldLinehave moved topfsspy.fieldline.FieldLinesandpfsspy.fieldline.FieldLine.FieldLinesno longer hassource_surface_feetandsolar_feetproperties. Instead these have moved to the newpfsspy.fieldline.OpenFieldLinesclass. All the open field lines can be accessed from aFieldLinesinstance using the newopen_field_linesproperty.
Changes to Output¶
pfsspy.Output.bgis now returned as a 4D array instead of three 3D arrays. The final index now indexes the vector components; see the docstring for more information.
0.3.2¶
Fixed a bug in
pfsspy.FieldLine.is_open, where some open field lines were incorrectly calculated to be closed.
0.3.1¶
Fixed a bug that incorrectly set closed line field polarities to -1 or 1 (instead of the correct value of zero).
FieldLine.footpointshas been removed in favour of the newpfsspy.FieldLine.solar_footpointandpfsspy.FieldLine.source_surface_footpoint. These each return a single footpoint. For a closed field line, see the API docs for further details on this.pfsspy.FieldLineshas been added, as a convenience class to store a collection of field lines. This means convenience attributes such aspfsspy.FieldLines.source_surface_feetcan be used, and their values are cached greatly speeding up repeated use.
0.3.0¶
The API for doing magnetic field tracing has changed. The new
pfsspy.tracingmodule containsTracerclasses that are used to perform the tracing. Code needs to be changed from:fline = output.trace(x0)
to:
tracer = pfsspy.tracing.PythonTracer() tracer.trace(x0, output) flines = tracer.xs
Additionally
x0can be a 2D array that contains multiple seed points to trace, taking advantage of the parallelism of some solvers.The
pfsspy.FieldLineclass no longer inherits fromSkyCoord, but theSkyCoordcoordinates are now stored inpfsspy.FieldLine.coordsattribute.pfsspy.FieldLine.expansion_factornow returnsnp.naninstead ofNoneif the field line is closed.pfsspy.FieldLinenow has a~pfsspy.FieldLine.footpointsattribute that returns the footpoint(s) of the field line.
0.2.0¶
pfsspy.Inputandpfsspy.Outputnow take the optional keyword argument dtime, which stores the datetime on which the magnetic field measurements were made. This is then propagated to the obstime attribute of computed field lines, allowing them to be transformed in to coordinate systems other than Carrington frames.pfsspy.FieldLineno longer overrrides the SkyCoord__init__; this should not matter to users, as FieldLine objects are constructed internally by callingpfsspy.Output.trace
0.1.5¶
Output.plot_source_surfacenow accepts keyword arguments that are given to Matplotlib to control the plotting of the source surface.
0.1.4¶
Added more explanatory comments to the examples
Corrected the dipole solution calculation
Added
pfsspy.coords.sph2cart()to transform from spherical to cartesian coordinates.
0.1.3¶
pfsspy.Output.plot_pilnow accepts keyword arguments that are given to Matplotlib to control the style of the contour.pfsspy.FieldLine.expansion_factoris now cached, and is only calculated once if accessed multiple times.