internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: sunpy/sunpy

Issue:
Add .shape attribute to TimeSeries
It would be useful if `TimeSeries` had a .shape attribute, that returned a tuple `(nrows, ncols)`, similarly to a numpy array or pandas dataframe.

(p.s. I may have got rows and cols the wrong way round, this needs checking...)


Discussion:
I guess you can just do a `ts.data.shape` - so do you envision just having a simple function so that you can do a `ts.shape`? 

p.s. should give you (nrows, ncols) 👍 
Yeah, I think having a simple property that just returns `data.shape` would be useful (to be able to do `ts.shape`).

Resolving patch:
diff --git a/sunpy/timeseries/timeseriesbase.py b/sunpy/timeseries/timeseriesbase.py
--- a/sunpy/timeseries/timeseriesbase.py
+++ b/sunpy/timeseries/timeseriesbase.py
@@ -141,6 +141,13 @@ def index(self):
         """
         return self.data.index
 
+    @property
+    def shape(self):
+        """
+        The shape of the data, a tuple (nrows, ncols).
+        """
+        return self.data.shape
+
     @property
     def time_range(self):
         """


Test patch:
diff --git a/sunpy/timeseries/tests/test_timeseriesbase.py b/sunpy/timeseries/tests/test_timeseriesbase.py
--- a/sunpy/timeseries/tests/test_timeseriesbase.py
+++ b/sunpy/timeseries/tests/test_timeseriesbase.py
@@ -771,6 +771,10 @@ def test_ts_index(generic_ts):
     assert (generic_ts.index == generic_ts.data.index).all()
 
 
+def test_ts_shape(generic_ts):
+    assert generic_ts.shape == generic_ts.data.shape
+
+
 def test_ts_sort_index(generic_ts):
     assert generic_ts.sort_index().data.equals(generic_ts.data.sort_index())
Repository: sunpy/sunpy

Issue:
Add missing ASDF schemas for new coordinate frames in 1.1
Whoops


Discussion:

Resolving patch:
diff --git a/sunpy/io/special/asdf/tags/coordinates/frames.py b/sunpy/io/special/asdf/tags/coordinates/frames.py
--- a/sunpy/io/special/asdf/tags/coordinates/frames.py
+++ b/sunpy/io/special/asdf/tags/coordinates/frames.py
@@ -3,7 +3,9 @@
 
 from astropy.io.misc.asdf.tags.coordinates.frames import BaseCoordType
 
-import sunpy.coordinates
+from sunpy.coordinates import frames
+
+sunpy_frames = list(map(lambda name: getattr(frames, name), frames.__all__))
 
 from ...types import SunPyType
 
@@ -39,12 +41,7 @@ def _get_frames():
 class SunPyCoordType(BaseCoordType, SunPyType):
     _tag_prefix = "coordinates/frames/"
     name = ["coordinates/frames/" + f for f in _get_frames()]
-    types = [
-        sunpy.coordinates.HeliographicCarrington,
-        sunpy.coordinates.HeliographicStonyhurst,
-        sunpy.coordinates.Heliocentric,
-        sunpy.coordinates.Helioprojective,
-    ]
+    types = sunpy_frames
     requires = ['sunpy', 'astropy>=3.1']
     version = "1.0.0"
 


Test patch:
diff --git a/sunpy/io/special/asdf/tags/tests/test_coordinate_frames.py b/sunpy/io/special/asdf/tags/tests/test_coordinate_frames.py
--- a/sunpy/io/special/asdf/tags/tests/test_coordinate_frames.py
+++ b/sunpy/io/special/asdf/tags/tests/test_coordinate_frames.py
@@ -4,39 +4,37 @@
 import numpy as np
 import pytest
 
+from astropy.coordinates import CartesianRepresentation
 import astropy.units as u
 from asdf.tests.helpers import assert_roundtrip_tree
 
 from sunpy.tests.helpers import asdf_entry_points
-from sunpy.coordinates.frames import (Heliocentric, HeliographicCarrington,
-                                      HeliographicStonyhurst, Helioprojective)
+import sunpy.coordinates.frames as frames
+
+sunpy_frames = list(map(lambda name: getattr(frames, name), frames.__all__))
 
 asdf = pytest.importorskip('asdf', '2.0.2')
 
 
-@pytest.fixture(
-    params=(Heliocentric, HeliographicCarrington, HeliographicStonyhurst,
-            Helioprojective))
+@pytest.fixture(params=sunpy_frames)
 @asdf_entry_points
 def coordframe_scalar(request):
     frame = request.param
 
-    narg = 2
-    if frame is Heliocentric:
-        narg = 3
+    if frame._default_representation is CartesianRepresentation:
+        data = np.random.random(3) * u.km
+    else:
+        data = np.random.random(2) * u.arcsec
 
-    data = np.random.random((narg, 1)) * u.arcsec
     return frame(*data, obstime='2018-01-01T00:00:00')
 
 
-@pytest.fixture(
-    params=(Heliocentric, HeliographicCarrington, HeliographicStonyhurst,
-            Helioprojective))
+@pytest.fixture(params=sunpy_frames)
 @asdf_entry_points
 def coordframe_array(request):
     frame = request.param
 
-    if frame is Heliocentric:
+    if frame._default_representation is CartesianRepresentation:
         data = np.random.random((3, 10)) * u.km
     else:
         data = np.random.random((2, 10)) * u.arcsec
Repository: sunpy/sunpy

Issue:
MapFactory seems to to call `expanduser` on path-like strings
i.e. `~/sunpy/data/aia*` doesn't work


Discussion:
This happens because `glob.glob` does not have any expanduser-like functionality. Passing the pattern you mention above to `glob.glob` returns an empty list which is why it is not getting caught by the glob pattern case in the factory.

I suspect this never worked?? Even before my fix in #3416. 

Resolving patch:
diff --git a/sunpy/map/map_factory.py b/sunpy/map/map_factory.py
--- a/sunpy/map/map_factory.py
+++ b/sunpy/map/map_factory.py
@@ -222,8 +222,8 @@ def _parse_args(self, *args, **kwargs):
                     raise ValueError(f'{path} is neither a file nor a directory')
 
             # Glob
-            elif isinstance(arg, str) and glob.glob(arg):
-                for afile in sorted(glob.glob(arg)):
+            elif isinstance(arg, str) and glob.glob(os.path.expanduser(arg)):
+                for afile in sorted(glob.glob(os.path.expanduser(arg))):
                     data_header_pairs += self._read_file(afile, **kwargs)
 
             # Already a Map


Test patch:
Repository: sunpy/sunpy

Issue:
Error in documentation for "Finding bright regions with ndimage" example.
<!-- This comments are hidden when you submit the issue so you do not need to remove them!
Please be sure to check out our contributing guidelines: https://github.com/sunpy/sunpy/blob/master/CONTRIBUTING.rst
Please be sure to check out our code of conduct:
https://github.com/sunpy/sunpy/blob/master/CODE_OF_CONDUCT.rst -->

<!-- Please have a search on our GitHub repository to see if a similar issue has already been posted.
If a similar issue is closed, have a quick look to see if you are satisfied by the resolution.
If not please go ahead and open an issue! -->

### Description
<!-- Provide a general description of the bug. -->
There seems to be an error in the documentation for the "Finding bright regions with ndimage" example.

In the part where a mask is made, the surrounding text states: " We choose the criterion that the data should be at least 5% of the maximum value. " However, if you look at the code immediately below, the threshold is based off 10% the max value:
`mask = aiamap.data < aiamap.max() * 0.10`

### Expected behavior
<!-- What did you expect to happen. -->

Documentation needs to be modified to reflect that the threshold is based off a 10% threshold. 


Discussion:
Thanks for the issue @neerajkulk :smile: 
no problem :) I'll submit a PR for this in a couple days

Resolving patch:
diff --git a/examples/map/image_bright_regions_gallery_example.py b/examples/map/image_bright_regions_gallery_example.py
--- a/examples/map/image_bright_regions_gallery_example.py
+++ b/examples/map/image_bright_regions_gallery_example.py
@@ -22,7 +22,7 @@
 
 ##############################################################################
 # First we make a mask, which tells us which regions are bright. We
-# choose the criterion that the data should be at least 5% of the maximum
+# choose the criterion that the data should be at least 10% of the maximum
 # value. Pixels with intensity values greater than this are included in the
 # mask, while all other pixels are excluded.
 mask = aiamap.data < aiamap.max() * 0.10
@@ -63,7 +63,7 @@
 ##############################################################################
 # Finally, we plot the smoothed bright image data, along with the estimate of
 # the number of distinct regions. We can see that approximately 6 distinct hot
-# regions are present above the 5% of the maximum level.
+# regions are present above the 10% of the maximum level.
 plt.figure()
 ax = plt.subplot(projection=aiamap)
 aiamap.plot()


Test patch:
Repository: sunpy/sunpy

Issue:
Database search() method missing returns documentation
See https://docs.sunpy.org/en/latest/api/sunpy.database.Database.html#sunpy.database.Database.search - the return type of `search()` is currently not documented.


Discussion:
I want to work on this issue @dstansby can you help me what changes I have to make 
![11](https://user-images.githubusercontent.com/42106787/70388047-df653580-19d2-11ea-966a-75c254d46044.JPG)
means I have to make it like this `search(*query,sortby)`?
I think the issue (and dstanby will correct me if I am off the mark) is that the doc string for search has no returns section.

(Would go further and say the entire database package needs a review of its documentation strings) 
can you help me what I supposed to return is it a `list of database entries` @nabobalis 
You will need to fill in the returns section of the documentation string following this style: https://numpydoc.readthedocs.io/en/latest/format.html#sections 

If you go to part 5. Returns. 

Resolving patch:
diff --git a/sunpy/database/database.py b/sunpy/database/database.py
--- a/sunpy/database/database.py
+++ b/sunpy/database/database.py
@@ -578,6 +578,12 @@ def search(self, *query, **kwargs):
             :class:`sunpy.database.tables.DatabaseEntry` for a list of all
             possible values.
 
+        Returns
+        -------
+        table : `list`
+            List of `sunpy.database.tables.DatabaseEntry` objects that
+            satisfy all of the given attributes.
+
         Raises
         ------
         TypeError


Test patch:
Repository: sunpy/sunpy

Issue:
MapSequence has poor documentation for the `sortby` keyword
MapSequence has a `sortby` keyword which has the following code:
```python
# Optionally sort data
if sortby is not None:
    if sortby == 'date':
        self.maps.sort(key=self._sort_by_date())
    else:
        raise ValueError("Only sort by date is supported")
```

But the docstring says:
```
sortby : `datetime.datetime`
    Method by which the MapSequence should be sorted along the z-axis.
```

The problems with the docstring are:
- It doesn't state that `None` as a valid input to disable sorting
- It doesn't state that the default is `'date'`
- It doesn't state that `'date'` is the only currently supported sorting strategy
- The valid input types are `str` or `None`, not `datetime.datetime`


Discussion:

Resolving patch:
diff --git a/sunpy/map/mapsequence.py b/sunpy/map/mapsequence.py
--- a/sunpy/map/mapsequence.py
+++ b/sunpy/map/mapsequence.py
@@ -28,8 +28,10 @@ class MapSequence:
     ----------
     args : `list`
         A list of Map instances
-    sortby : `datetime.datetime`
+    sortby : { "date" | `None`}
         Method by which the MapSequence should be sorted along the z-axis.
+        Defaults to sorting by: "date" and is the only supported sorting strategy.
+        Passing `None` will disable sorting.
     derotate : `bool`
         Apply a derotation to the data. Default to False.
 


Test patch:
Repository: sunpy/sunpy

Issue:
Formatting of remote data manager example
The [remote data manager example](https://docs.sunpy.org/en/latest/generated/gallery/remote_data_manager.html#sphx-glr-generated-gallery-remote-data-manager-py) is listed on its own instead of in one of the other example gallery categories (e.g. "Map", "Acquiring Data"). Is this intentional?

Additionally, the one line description just below the header is formatted a bit strange (i.e. there's some bold type in there and extra line breaks) compared to the other examples.


Discussion:

Resolving patch:
diff --git a/examples/remote_data_manager.py b/examples/remote_data_manager.py
--- a/examples/remote_data_manager.py
+++ b/examples/remote_data_manager.py
@@ -6,9 +6,10 @@
 This is an example to show how to use remote data manager to
 handle remote data in Sunpy.
 """
+
 ##############################################################################
 # Remote data manager is used to handle the usage of remote files in the code
-#  base with file verification using hashes.
+# base with file verification using hashes.
 
 from sunpy.data import manager
 


Test patch:
Repository: sunpy/sunpy

Issue:
What's New in 1.1
Before the release of 1.1 we need to write the what's new section. Please add comments to this issue (or edit it if you have permissions) with the things you think we should cover in the what's new.

- Remote Data Manager (#3124)
- New coordinate frames (#3212)
- SUVI support (#3269 / #3301)
- Reduce the import time of sunpy.map by ~40%. (#3495)
- Initial support for WISPR data (#3501)

pinging @sunpy/sunpy-maintainers  and @drsophiemurray


Discussion:
Map now accepts filenames and directories as pathlib.Path objects. (#3408) too maybe? (along with sunpy.io.write_file() now accepts Path objects as filename inputs. (#3469))
What does "initial support" for WISPR mean? Since there isn't a map source what does this really provide a user? They might think they can actually open a WISPR file. Can they?
Works for me... (using the example at https://github.com/sunpy/sunpy/issues/3496 and `.peek()`:)

<img width="860" alt="Screenshot 2019-12-02 at 21 48 37" src="https://user-images.githubusercontent.com/6197628/69998096-823e2f80-154d-11ea-89f5-6367ed5e98b1.png">

So it reads it into a genericmap but no custom map yet. cool and thanks @dstansby!
A good test eventually will be trying to reproduce one of the figures in their first results paper that comes out on Weds.
> What does "initial support" for WISPR mean? 

More technically it means we support generating a WCS from their more complex projection information in the headers.

(but yes, reads into a generic map)

Resolving patch:
diff --git a/sunpy/data/data_manager/__init__.py b/sunpy/data/data_manager/__init__.py
--- a/sunpy/data/data_manager/__init__.py
+++ b/sunpy/data/data_manager/__init__.py
@@ -0,0 +1,4 @@
+from sunpy.data.data_manager.cache import Cache
+from sunpy.data.data_manager.downloader import ParfiveDownloader
+from sunpy.data.data_manager.manager import DataManager
+from sunpy.data.data_manager.storage import SqliteStorage


Test patch:
Repository: sunpy/sunpy

Issue:
Removing astropy_helpers section in CONTRIBUTING.rst
<!-- This comments are hidden when you submit the issue so you do not need to remove them!
Please be sure to check out our contributing guidelines: https://github.com/sunpy/sunpy/blob/master/CONTRIBUTING.rst
Please be sure to check out our code of conduct:
https://github.com/sunpy/sunpy/blob/master/CODE_OF_CONDUCT.rst -->

<!-- Please have a search on our GitHub repository to see if a similar issue has already been posted.
If a similar issue is closed, have a quick look to see if you are satisfied by the resolution.
If not please go ahead and open an issue! -->

### Description
<!-- Provide a general description of the bug. -->
As of PR https://github.com/sunpy/sunpy/pull/3598, sunpy no longer needs `astropy_helpers`, and even it is removed from the package.
I think there should not be a section of Astropy Helpers in contribution guidelines as well.


Discussion:
Good point, that section and anywhere else its mentioned should be removed. 

Resolving patch:
diff --git a/sunpy/version.py b/sunpy/version.py
deleted file mode 100644
--- a/sunpy/version.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# This file is for compatibility with astropy_helpers
-version = 'unknown.dev'
-try:
-    from importlib_metadata import version as _version, PackageNotFoundError
-    version = _version('sunpy')
-except ImportError:
-    from pkg_resources import get_distribution, DistributionNotFound
-    try:
-        version = get_distribution("sunpy").version
-    except DistributionNotFound:
-        pass
-except PackageNotFoundError:
-    pass


Test patch:
Repository: sunpy/sunpy

Issue:
Reduce import time for `sunpy.image.transform`
(I was getting annoyed by our import times, and was inspired by astropy/astropy#4598 to look deeper.)

This one's easy.  Importing `sunpy.image.transform` takes 1.7 seconds on my machine (see below).  0.7 seconds is spent importing `skimage.transform`.  We should defer that import to run-time.

(see #3445 for dealing with `pkg_resources`)

```
python -X importtime -c "import sunpy.image.transform" 2> transform.log
tuna transform.log
```
![transform](https://user-images.githubusercontent.com/991759/67576249-34433a00-f70c-11e9-9cef-4f7b3804e66c.png)


Discussion:

Resolving patch:
diff --git a/sunpy/image/transform.py b/sunpy/image/transform.py
--- a/sunpy/image/transform.py
+++ b/sunpy/image/transform.py
@@ -8,15 +8,6 @@
 
 from sunpy.util.exceptions import SunpyUserWarning
 
-try:
-    import skimage.transform
-    scikit_image_not_found = False
-except ImportError:
-    warnings.warn("scikit-image could not be imported. Image rotation will use scipy",
-                  ImportWarning)
-    scikit_image_not_found = True
-
-
 __all__ = ['affine_transform']
 
 
@@ -84,7 +75,7 @@ def affine_transform(image, rmatrix, order=3, scale=1.0, image_center=None,
     algorithm to map the original to target pixel values.
     """
     rmatrix = rmatrix / scale
-    array_center = (np.array(image.shape)[::-1]-1)/2.0
+    array_center = (np.array(image.shape)[::-1] - 1) / 2.0
 
     # Make sure the image center is an array and is where it's supposed to be
     if image_center is not None:
@@ -100,14 +91,20 @@ def affine_transform(image, rmatrix, order=3, scale=1.0, image_center=None,
 
     displacement = np.dot(rmatrix, rot_center)
     shift = image_center - displacement
-
-    if use_scipy or scikit_image_not_found:
+    if not use_scipy:
+        try:
+            import skimage.transform
+        except ImportError:
+            warnings.warn("scikit-image could not be imported. Image rotation will use scipy",
+                          ImportWarning)
+            use_scipy = True
+    if use_scipy:
         if np.any(np.isnan(image)):
             warnings.warn("Setting NaNs to 0 for SciPy rotation.", SunpyUserWarning)
         # Transform the image using the scipy affine transform
         rotated_image = scipy.ndimage.interpolation.affine_transform(
-                np.nan_to_num(image).T, rmatrix, offset=shift, order=order,
-                mode='constant', cval=missing).T
+            np.nan_to_num(image).T, rmatrix, offset=shift, order=order,
+            mode='constant', cval=missing).T
     else:
         # Make the rotation matrix 3x3 to include translation of the image
         skmatrix = np.zeros((3, 3))


Test patch:
Repository: sunpy/sunpy

Issue:
Plot titles and x-labels overlapping in example
The plot titles and labels overlap in the 3rd image of https://docs.sunpy.org/en/latest/generated/gallery/acquiring_data/2011_06_07_sampledata_overview.html#sphx-glr-generated-gallery-acquiring-data-2011-06-07-sampledata-overview-py (see below). I'm guessing the tight-layout just needs tweaking.
![sphx_glr_2011_06_07_sampledata_overview_003](https://user-images.githubusercontent.com/6197628/57301262-821da480-70d0-11e9-83aa-50838ee4e693.png)



Discussion:
This is a bit of a flaw in the way the title is positioned, although not one I am sure is fixable. 

When you overplot a HGS grid the plotting code moves the title up more to allow space for the ticks to appear on the top of the axis if they are drawn there (when zoomed in). I don't know if we can conditionally move the title on rendering (probably not easily).
Even with the title moved up, I would have thought `tight_layout()` without any arugments could deal with it. If not it might be a maptlotlib bug.
It turns out `plt.tight_layout()` with a `wcs` projection actually makes things worse! I've filed a bug upstream at https://github.com/astropy/astropy/issues/8703
My guess on that would be that it's related to the fact `WCSAxes` draws its own ticks rather than using the normal tick drawing in mpl, but I assume Tom will know.

We should fix this issue in the docs irrespective of the upstream issues with `tight_layout`.

Resolving patch:
diff --git a/examples/acquiring_data/2011_06_07_sampledata_overview.py b/examples/acquiring_data/2011_06_07_sampledata_overview.py
--- a/examples/acquiring_data/2011_06_07_sampledata_overview.py
+++ b/examples/acquiring_data/2011_06_07_sampledata_overview.py
@@ -78,7 +78,7 @@
 aia_1600_map.plot(clip_interval=(0.5, 99.9)*u.percent)
 aia_1600_map.draw_grid()
 
-fig.tight_layout(pad=6.50)
+fig.tight_layout(pad=8.50)
 plt.show()
 
 ###############################################################################


Test patch:
Repository: sunpy/sunpy

Issue:
Error parsing time in VSO search filtering 
<!-- This comments are hidden when you submit the issue so you do not need to remove them!
Please be sure to check out our contributing guidelines: https://github.com/sunpy/sunpy/blob/master/CONTRIBUTING.rst
Please be sure to check out our code of conduct:
https://github.com/sunpy/sunpy/blob/master/CODE_OF_CONDUCT.rst -->

<!-- Please have a search on our GitHub repository to see if a similar issue has already been posted.
If a similar issue is closed, have a quick look to see if you are satisfied by the resolution.
If not please go ahead and open an issue! -->

### Description
<!-- Provide a general description of the bug. -->
VSO fails to filter results having Time as Attribute. The bug lies in the imoplementation for filtering time specifically in the line (in `vso/attrs.py`) - 
`attr.min <= _attrs.Time.strptime(it.time.end, _TIMEFORMAT)`
The comparison is occuring between a string and a Time object. Moreover, there is no attribute named `strptime` in Time attribute. 

### Expected behavior
<!-- What did you expect to happen. -->
The Time attribute would have been successfully filtered with the new query.

### Actual behavior
<!-- What actually happened. -->
<!-- Was the output confusing or poorly described? -->
See gist link below.

### Steps to Reproduce
<!-- Ideally a code example could be provided so we can run it ourselves. -->
<!-- If you are pasting code, use tripe backticks (```) around your code snippet. -->
Gist link - https://gist.github.com/aribalam/4aef458ebaeeb7cb23d45720f61ced2f


Discussion:

Resolving patch:
diff --git a/sunpy/net/vso/attrs.py b/sunpy/net/vso/attrs.py
--- a/sunpy/net/vso/attrs.py
+++ b/sunpy/net/vso/attrs.py
@@ -23,8 +23,10 @@
 from functools import singledispatch as _singledispatch
 
 import astropy.units as u
+from astropy.time import Time as AstropyTime
 
 from sunpy.util.exceptions import SunpyDeprecationWarning
+
 from .. import _attrs
 from .. import attr as _attr
 
@@ -337,11 +339,11 @@ def _(attr, results):
         if
         it.time.end is not None
         and
-        attr.min <= _attrs.Time.strptime(it.time.end, _TIMEFORMAT)
+        attr.min <= AstropyTime.strptime(it.time.end, _TIMEFORMAT)
         and
         it.time.start is not None
         and
-        attr.max >= _attrs.Time.strptime(it.time.start, _TIMEFORMAT)
+        attr.max >= AstropyTime.strptime(it.time.start, _TIMEFORMAT)
     }
 
 


Test patch: