Skip to content

Commit

Permalink
Merge pull request #3125 from nabobalis/1.0
Browse files Browse the repository at this point in the history
[1.0] 1.0.0rc2
  • Loading branch information
nabobalis committed May 22, 2019
2 parents 098b1c8 + fbcfdc2 commit e48f794
Show file tree
Hide file tree
Showing 36 changed files with 490 additions and 202 deletions.
21 changes: 19 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
Sunpy 1.0.0.RC1 (2019-05-21)
Sunpy v1.0.0rc2 (2019-05-22)
============================

Features
--------

- The new function `~sunpy.coordinates.get_horizons_coord` enables querying JPL HORIZONS for the locations of a wide range of solar-system bodies, including spacecraft. (`#3113 <https://github.com/sunpy/sunpy/pull/3113>`__)


Bug Fixes
---------

- Correctly extract observer location from MDI and EIT data (`#3067 <https://github.com/sunpy/sunpy/pull/3067>`__)
- Fixed bugs related to using `~sunpy.map.GenericMap.plot` and `~sunpy.map.GenericMap.peek` with the ``inline`` Matplotlib backend in Jupyter notebook. (`#3103 <https://github.com/sunpy/sunpy/pull/3103>`__)
- The `solar_rotate_coordinate` function returns a coordinate that accounts for the location of the new observer. (`#3123 <https://github.com/sunpy/sunpy/pull/3123>`__)


Sunpy 1.0.0rc1 (2019-05-21)
============================

Backwards Incompatible Changes
Expand Down Expand Up @@ -26,7 +43,7 @@ Backwards Incompatible Changes
- Maps no longer assume that the pixel units are arcseconds if the units aren't
explicitly set. In addition to this if critical metadata is missing from when
creating a map, the map will fail to initialize and will raise an error. (`#2847 <https://github.com/sunpy/sunpy/pull/2847>`__)
- axis_ranges kwarg of `sunpy.visualization.animator.base.ArrayAnimator`, `sunpy.visualization.animator.image.ImageAnimator` and `sunpy.visualization.animator.line.LineAnimator` now must be entered as None, [min, max] or pixel edges of each array element. Previously, pixel centers were expected. This change removes ambiguity in interpretation and ensures the extent of the plot can always be accurately derived. (`#2867 <https://github.com/sunpy/sunpy/pull/2867>`__)
- ``axis_ranges`` kwarg of `sunpy.visualization.animator.base.ArrayAnimator`, `sunpy.visualization.animator.image.ImageAnimator` and `sunpy.visualization.animator.line.LineAnimator` now must be entered as None, [min, max] or pixel edges of each array element. Previously, pixel centers were expected. This change removes ambiguity in interpretation and ensures the extent of the plot can always be accurately derived. (`#2867 <https://github.com/sunpy/sunpy/pull/2867>`__)
- All keywords have been added (with defaults) to each `~sunpy.net.helioviewer.HelioviewerClient` function.
This means that there will be some changes to the style of the PNG screenshot that is returned.
Returns for the JPEG 2000 and the other functions should be the same but not guaranteed. (`#2883 <https://github.com/sunpy/sunpy/pull/2883>`__)
Expand Down
27 changes: 16 additions & 11 deletions examples/acquiring_data/2011_06_07_sampledata_overview.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,12 @@
aia_cutout03_map = sunpy.map.Map(sample_data.AIA_193_CUTOUT03_IMAGE)
fig = plt.figure()
aia_cutout03_map.plot()
plt.show()

###############################################################################
# Let's take a look at the GOES XRS data.
goes = sunpy.timeseries.TimeSeries(sample_data.GOES_XRS_TIMESERIES)
goes.peek()
plt.show()
fig = plt.figure()
goes.plot()

###############################################################################
# Next let's investigate the AIA full disk images that are available. Please
Expand All @@ -55,23 +54,28 @@
ax = fig.add_subplot(611, projection=aia_131_map)
aia_131_map.plot(clip_interval=(0.5, 99.9)*u.percent)
aia_131_map.draw_grid()

ax = fig.add_subplot(612, projection=aia_171_map)
aia_171_map.plot(clip_interval=(0.5, 99.9)*u.percent)
aia_171_map.draw_grid()

ax = fig.add_subplot(613, projection=aia_211_map)
aia_211_map.plot(clip_interval=(0.5, 99.9)*u.percent)
aia_211_map.draw_grid()

ax = fig.add_subplot(614, projection=aia_335_map)
aia_335_map.plot(clip_interval=(0.5, 99.9)*u.percent)
aia_335_map.draw_grid()

ax = fig.add_subplot(615, projection=aia_094_map)
aia_094_map.plot(clip_interval=(0.5, 99.9)*u.percent)
aia_094_map.draw_grid()

ax = fig.add_subplot(616, projection=aia_1600_map)
aia_1600_map.plot(clip_interval=(0.5, 99.9)*u.percent)
aia_1600_map.draw_grid()
plt.tight_layout(pad=6.50)
plt.show()

fig.tight_layout(pad=6.50)

###############################################################################
# We also provide a series of AIA cutouts so that you can get a sense of the
Expand All @@ -85,30 +89,31 @@
fig = plt.figure(figsize=(6, 28))
ax = fig.add_subplot(511, projection=aia_cutout01_map)
aia_cutout01_map.plot()

ax = fig.add_subplot(512, projection=aia_cutout02_map)
aia_cutout02_map.plot()

ax = fig.add_subplot(513, projection=aia_cutout03_map)
aia_cutout03_map.plot()

ax = fig.add_subplot(514, projection=aia_cutout04_map)
aia_cutout04_map.plot()

ax = fig.add_subplot(515, projection=aia_cutout05_map)
aia_cutout05_map.plot()
plt.tight_layout(pad=5.50)
plt.show()

fig.tight_layout(pad=5.50)

###############################################################################
# There are a number of other data sources, such as SWAP.
swap_map = sunpy.map.Map(sample_data.SWAP_LEVEL1_IMAGE)
fig = plt.figure()
ax = plt.subplot(projection=swap_map)
swap_map.plot()
plt.show()

###############################################################################
# As well as RHESSI.
rhessi_map = sunpy.map.Map(sample_data.RHESSI_IMAGE)
fig = plt.figure()
#ax = plt.subplot(projection=rhessi_map)
ax = plt.subplot()
rhessi_map.plot()

plt.show()
7 changes: 6 additions & 1 deletion examples/acquiring_data/skip_downloading_and_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
In this example, we show how to acquire and plot SOHO/LASCO C3 data using SunPy.
"""
# Import the required modules.
import matplotlib.pyplot as plt

from sunpy.net import Fido, attrs
import sunpy.map
from sunpy.io.file_tools import read_file
Expand Down Expand Up @@ -53,4 +55,7 @@

# Now we can pass in the data and header directly into `sunpy.map.Map`
lascomap = sunpy.map.Map(data, header)
lascomap.peek()

fig = plt.figure()
lascomap.plot()
plt.show()
6 changes: 5 additions & 1 deletion examples/acquiring_data/skip_hmi.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"""
# Start by importing the necessary modules.
import astropy.units as u
import matplotlib.pyplot as plt

import sunpy.map
from sunpy.net import Fido, attrs as a
Expand Down Expand Up @@ -56,4 +57,7 @@
###############################################################################
# Once we have created our Map, we can plot it quite simply doing:

hmi_map.peek()
fig = plt.figure()
hmi_map.plot()

plt.show()
6 changes: 5 additions & 1 deletion examples/map/composite_map_AIA_HMI.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"""

# Start by importing the necessary modules.
import matplotlib.pyplot as plt
import sunpy.map
import sunpy.data.sample

Expand Down Expand Up @@ -43,4 +44,7 @@
# present on the AIA image and how they correspond to the line of sight
# magnetic field.

comp_map.peek()
fig = plt.figure()
comp_map.plot()

plt.show()
8 changes: 5 additions & 3 deletions examples/map/map_from_numpy_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
##############################################################################
# SunPy Maps store 2D data in a numpy array and additional data in a metadata
# dictionary giving information relating to the data and instrument.
data = np.random.rand(20,15)
data = np.random.rand(20, 15)
header = {'cunit1': 'arcsec', 'cunit2': 'arcsec'}
manual_map = sunpy.map.Map((data, header))

Expand All @@ -30,6 +30,8 @@
print(manual_map.coordinate_system)

##############################################################################
# You can quickly plot a map using the peek method:
manual_map.peek()
# You can quickly plot a map using the plot method:
fig = plt.figure()
manual_map.plot()

plt.show()
14 changes: 12 additions & 2 deletions examples/map/map_resampling_and_superpixels.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@
# specifying the dimensions as an Astropy Quantity in pixels:
dimensions = u.Quantity([40, 40], u.pixel)
aia_resampled_map = aia_map.resample(dimensions)
aia_resampled_map.peek(draw_limb=True, draw_grid=True)

fig = plt.figure()
aia_resampled_map.plot()
aia_resampled_map.draw_grid()
aia_resampled_map.draw_limb()

# Note that this uses linear interpolation, you can change this using the method
# (‘neighbor’, ‘nearest’, ‘linear’ or ‘spline’) keyword argument option.

Expand All @@ -49,5 +54,10 @@
# example you can reduce the AIA map resolution by a factor of 16 using:
dimensions = u.Quantity(aia_map.dimensions) / 16
aia_superpixel_map = aia_map.superpixel(dimensions)
aia_superpixel_map.peek(draw_limb=True, draw_grid=True)

fig = plt.figure()
aia_superpixel_map.plot()
aia_superpixel_map.draw_grid()
aia_superpixel_map.draw_limb()

plt.show()
11 changes: 8 additions & 3 deletions examples/map/map_rotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,15 @@
##############################################################################
# Maps can also be rotated by using the `~sunpy.map.GenericMap.rotate` method
# with a specified angle, supplied as an Astropy Quantity with angular units:
aia_rotated = aia_map.rotate(angle = 30 * u.deg)
aia_rotated.peek(draw_limb=True, draw_grid=True)
aia_rotated = aia_map.rotate(angle=30 * u.deg)

plt.figure()
aia_rotated.plot()
aia_rotated.draw_limb()
aia_rotated.draw_grid()

# Or using Radians
aia_rotated = aia_map.rotate(angle = 0.5 * u.rad)
aia_rotated = aia_map.rotate(angle=0.5 * u.rad)
# Note: the data array is expanded so that none of the original data is lost
# through clipping.
# Also note that subsequent rotations are not compunded, the map is only rotated
Expand Down
31 changes: 23 additions & 8 deletions examples/map/maps_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
# naxis details that correspond to the array used for the data.

##############################################################################
# You can quickly plot a map using the peek method:

manual_map.peek()
# You can quickly plot a map using the plot method:
fig = plt.figure()
manual_map.plot()

##############################################################################
# SunPy Maps have a number of attributes that can be accessed easily.
Expand All @@ -58,7 +58,9 @@
# returns the location of the given FITS file.

aia_map = sunpy.map.Map(sunpy.data.sample.AIA_171_IMAGE)
aia_map.peek(draw_limb=True)
fig = plt.figure()
aia_map.plot()
aia_map.draw_limb()

##############################################################################
# This has comprehensive metadata:
Expand Down Expand Up @@ -88,16 +90,22 @@
bottom_left = aia_map.bottom_left_coord
top_right = SkyCoord(0 * u.arcsec, 0 * u.arcsec, frame=aia_map.coordinate_frame)
aia_submap = aia_map.submap(bottom_left, top_right)
aia_submap.peek(draw_limb=True)

fig = plt.figure()
aia_submap.plot()
aia_submap.draw_limb()
##############################################################################
# Similarly, if you want to reduce the angular resolution of the map you can use
# the `~sunpy.map.GenericMap.resample` method, specifying the dimensions as an
# Astropy Quantity in pixels:

dimensions = u.Quantity([50, 50], u.pixel)
aia_resampled_map = aia_map.resample(dimensions)
aia_resampled_map.peek(draw_limb=True, draw_grid=True)

fig = plt.figure()
aia_resampled_map.plot()
aia_resampled_map.draw_grid()
aia_resampled_map.draw_limb()

##############################################################################
# Similar to resampling you can use the `~sunpy.map.GenericMap.superpixel`
Expand All @@ -108,13 +116,20 @@

dimensions = u.Quantity(aia_map.dimensions) / 16
aia_superpixel_map = aia_map.superpixel(dimensions)
aia_superpixel_map.peek(draw_limb=True)

fig = plt.figure()
aia_superpixel_map.plot()
aia_superpixel_map.draw_limb()

##############################################################################
# Maps can also be rotated using the `~sunpy.map.GenericMap.rotate` method:

aia_rotated_submap = aia_submap.rotate(angle=10 * u.deg)
aia_rotated_submap.peek(draw_limb=True, draw_grid=True)

fig = plt.figure()
aia_rotated_submap.plot()
aia_rotated_submap.draw_limb()
aia_rotated_submap.draw_grid()

# Note: the data array is expanded so that none of the original data is lost
# through clipping.
Expand Down
14 changes: 9 additions & 5 deletions examples/map/submaps_and_cropping.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
"""
=========================================
====================
Submaps and Cropping
=========================================
====================
In this example we demonstrate how to get a submap of a map.
"""
Expand Down Expand Up @@ -38,9 +38,13 @@
# To crop the data you create a submap, specifying the top right and bottom
# left as SkyCoord objects.

top_right = SkyCoord(0*u.arcsec, -200 * u.arcsec, frame=swap_map.coordinate_frame)
top_right = SkyCoord(0 * u.arcsec, -200 * u.arcsec, frame=swap_map.coordinate_frame)
bottom_left = SkyCoord(-900 * u.arcsec, -900 * u.arcsec, frame=swap_map.coordinate_frame)
swap_submap = swap_map.submap(bottom_left, top_right)
swap_submap.peek(draw_limb=True, draw_grid=True)
plt.tight_layout(pad=1.00)

fig = plt.figure()
swap_submap.plot()
swap_submap.draw_limb()
swap_submap.draw_grid()

plt.show()
3 changes: 2 additions & 1 deletion examples/plotting/aia_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
###############################################################################
# Now we do a quick plot.

aiamap.peek()
fig = plt.figure()
aiamap.plot()
plt.show()
15 changes: 9 additions & 6 deletions examples/time_series/goes_hek_m25.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,13 @@
###############################################################################
# Finally lets plot everything together

goes.peek()
plt.axvline(parse_time(flares_hek[0].get('event_peaktime')).plot_date)
plt.axvspan(parse_time(flares_hek[0].get('event_starttime')).plot_date,
parse_time(flares_hek[0].get('event_endtime')).plot_date,
alpha=0.2, label=flares_hek[0].get('fl_goescls'))
plt.legend(loc=2)
fig, ax = plt.subplots()
goes.plot()
ax.axvline(parse_time(flares_hek[0].get('event_peaktime')).plot_date)
ax.axvspan(parse_time(flares_hek[0].get('event_starttime')).plot_date,
parse_time(flares_hek[0].get('event_endtime')).plot_date,
alpha=0.2, label=flares_hek[0].get('fl_goescls'))
ax.legend(loc=2)
ax.set_yscale('log')

plt.show()

0 comments on commit e48f794

Please sign in to comment.