Giter Club home page Giter Club logo

wcsaxes's Issues

Tick marks are not clipped to axes

In rcparams.png, you can see that tick marks in the top-left, bottom-left, and bottom-rigth corners are not being clipped to the axes. Also, like in Matplotlib it would look nicer if tick marks on the edge of the plot were avoided.

Implement overlay coordinate systems

We need to implement the functionality described in the API as:

glon, glat = ax.get_coords_overlay('galactic')

which allows a different coordinate system to be plotted.

Improve performance with Cython/C

There may be places where we can improve the performance of the code by using Cython or C. Of course, we first need to figure out where the bottlenecks are :)

Create wcsaxes.datasets

@anizami - I was thinking about the fact we need test data for the tests and for the docs, and I think the cleanest thing to do would be to create a wcsaxes.datasets sub-module inside which the datasets are downloaded. Of course, we don't want to download it if the user is just importing wcsaxes, and we also don't want the user to download it every time they access wcsaxes.datasets, but Astropy allows caching, so I think you can use cache=True when calling download_file. So I think if you create a datasets.py sub-module and move the downloads to there, you can then try and see if the files are imported the first time wcsaxes.datasets is imported, then you can try and close python and open it up again, import wcsaxes.datasets, and it should then get it from the cache.

Once this works, you can change test_image.py to get the files from wcsaxes.datasets instead and then also use this when writing the docs on slicing.

Does this make sense?

Avoid repeated labels

When labels along an axis go 13:14:12 13:14:13 etc we can avoid printing out the degree and minutes each time.

Prevent overlapping labels

We should be able to use the bounding boxes of labels to detect overlap and avoid showing labels that overlap.

wcsaxes.test() not working so great with Windows and Anaconda..

When I run import wcsaxes; wcsaxes.test() in Python on my machine, all the tests pass but after that it gives this infinite loop of messages (which I can only get rid of by closing the terminal). The loop of messages (cropped) is here:
https://gist.github.com/anizami/39bb3b1e55e747185d17
I looked up the issue and it's a problem with the pyreadline package that is for Windows:
pyreadline/pyreadline#18. It's been fixed in the PR pyreadline/pyreadline#24 that hasn't been merged yet. When I cloned a copy of this PR's branch and installed that version of pyreadline, the infinite loop issue went away and all the tests pass. I don't know if this is something we can control for but can we maybe add a warning in the installation.rst docs for Windows with Anaconda users?

Sphinx warnings

Currently it looks like the API docs aren't working for WCSAxesSubplot:

<autosummary>:None: WARNING: toctree contains reference to nonexisting document u'api/wcsaxes.WCSAxesSubplot'
None:None: WARNING: toctree contains reference to nonexisting document u'api/wcsaxes.WCSAxesSubplot'
None:None: WARNING: toctree contains reference to nonexisting document u'api/wcsaxes.WCSAxesSubplot'
None:None: WARNING: toctree contains reference to nonexisting document u'api/wcsaxes.WCSAxesSubplot'
None:None: WARNING: toctree contains reference to nonexisting document u'api/wcsaxes.WCSAxesSubplot'
None:None: WARNING: toctree contains reference to nonexisting document u'api/wcsaxes.WCSAxesSubplot'
None:None: WARNING: toctree contains reference to nonexisting document u'api/wcsaxes.WCSAxesSubplot'
None:None: WARNING: toctree contains reference to nonexisting document u'api/wcsaxes.WCSAxesSubplot'
None:None: WARNING: toctree contains reference to nonexisting document u'api/wcsaxes.WCSAxesSubplot'
None:None: WARNING: toctree contains reference to nonexisting document u'api/wcsaxes.WCSAxesSubplot'
None:None: WARNING: toctree contains reference to nonexisting document u'api/wcsaxes.WCSAxesSubplot'
None:None: WARNING: toctree contains reference to nonexisting document u'api/wcsaxes.WCSAxesSubplot'
None:None: WARNING: toctree contains reference to nonexisting document u'api/wcsaxes.WCSAxesSubplot'
None:None: WARNING: toctree contains reference to nonexisting document u'api/wcsaxes.WCSAxesSubplot'
None:None: WARNING: toctree contains reference to nonexisting document u'api/wcsaxes.WCSAxesSubplot'
None:None: WARNING: toctree contains reference to nonexisting document u'api/wcsaxes.WCSAxesSubplot'
writing additional files... (4 module code pages)None:None: WARNING: toctree contains reference to nonexisting document u'api/wcsaxes.WCSAxesSubplot'
None:None: WARNING: toctree contains reference to nonexisting document u'api/wcsaxes.WCSAxesSubplot'
None:None: WARNING: toctree contains reference to nonexisting document u'api/wcsaxes.WCSAxesSubplot'
None:None: WARNING: toctree contains reference to nonexisting document u'api/wcsaxes.WCSAxesSubplot'
 _modules/index
None:None: WARNING: toctree contains reference to nonexisting document u'api/wcsaxes.WCSAxesSubplot'
 genindexNone:None: WARNING: toctree contains reference to nonexisting document u'api/wcsaxes.WCSAxesSubplot'
 py-modindexNone:None: WARNING: toctree contains reference to nonexisting document u'api/wcsaxes.WCSAxesSubplot'
 searchNone:None: WARNING: toctree contains reference to nonexisting document u'api/wcsaxes.WCSAxesSubplot'

@eteq - do you have any ideas why this might be happening?

Add rotated ticks

Support the rotation of tick marks along the grid lines. This should be trivial.

Ticks marks point in wrong direction and are not clipped to axes

The following test script produces some unusual results:

#!/usr/bin/env python
from matplotlib import pyplot as plt
from wcsaxes import WCSAxes
import astropy.wcs

wcs = astropy.wcs.WCS()
wcs.wcs.ctype = ['RA---TAN', 'DEC--TAN']
wcs.wcs.crval = [90, 70]
wcs.wcs.cdelt = [16, 16]
wcs.wcs.crpix = [1, 1]
wcs.wcs.radesys = 'ICRS'
wcs.wcs.equinox = 2000.0
fig = plt.figure(figsize=(3, 3), dpi=72)
ax = WCSAxes(fig, [0.1, 0.1, 0.8, 0.8], wcs=wcs)
fig.add_axes(ax)
ax.set_xlim(1, -1)
ax.set_ylim(-1, 1)
ax.grid()
fig.savefig('test.png', dpi=72)

test

The ticks are pointing in the wrong direction with respect to the axes, and are not being clipped to the axes rect.

Some image tests are not marked as 'remote_data'

Some image tests are not currently marked with the remote_data decorator - @anizami, could you fix this? The tests should run (but skip over these tests) for:

python setup.py test

At the moment, this crashes with an error saying some of the tests tried to access the internet.

Sometimes the axes fail to wrap around 0 degrees latitude

Hi,

I found that sometimes, WCSAxes fails to properly wrap around zero. Attached are two examples showing (a) when it works and (b) when it doesn't. The WCS headers and data that are needed to reproduce this are found here:

Failing data: https://dl.dropboxusercontent.com/u/3294908/slice_of_galaxy_image.txt
Failing WCS: https://dl.dropboxusercontent.com/u/3294908/galaxy_2d_header.fits
Passing data: https://dl.dropboxusercontent.com/u/3294908/slice_of_oph_image.txt
Passing WCS: https://dl.dropboxusercontent.com/u/3294908/ophiuchus_2d_header.fits

These cases broadly follow the example from this notebook: http://nbviewer.ipython.org/github/astrofrog/wcsaxes-examples/blob/master/WCSAxes%20Demo.ipynb

Failing case:
galaxy_wcsaxes

galaxy = np.loadtxt('slice_of_galaxy_image.txt')
fig = plt.figure()
In [15]: ax = WCSAxes(fig, [0.1, 0.1, 0.8, 0.8], wcs=WCS('galaxy_2d_header.fits'))
WARNING: FITSFixedWarning: The WCS transformation has more axes (2) than the image it is associated with (0) [astropy.wcs.wcs]

In [16]: fig.add_axes(ax)

In [16]: ax.imshow(galaxy, origin='lower')
Out[16]: <matplotlib.image.AxesImage at 0x4dcb490>

In [17]: fig.canvas.draw()
/home/tom/anaconda/lib/python2.7/site-packages/WCSAxesExperimental-0.0.0-py2.7.egg/wcsaxes/coordinate_range.py:49: RuntimeWarning: invalid value encountered in greater
/home/tom/anaconda/lib/python2.7/site-packages/WCSAxesExperimental-0.0.0-py2.7.egg/wcsaxes/coordinate_range.py:57: RuntimeWarning: invalid value encountered in greater
/home/tom/anaconda/lib/python2.7/site-packages/WCSAxesExperimental-0.0.0-py2.7.egg/wcsaxes/coordinate_range.py:10: RuntimeWarning: invalid value encountered in greater
/home/tom/anaconda/lib/python2.7/site-packages/WCSAxesExperimental-0.0.0-py2.7.egg/wcsaxes/coordinate_helpers.py:345: RuntimeWarning: invalid value encountered in greater
/home/tom/anaconda/lib/python2.7/site-packages/WCSAxesExperimental-0.0.0-py2.7.egg/wcsaxes/coordinate_helpers.py:346: RuntimeWarning: invalid value encountered in greater
/home/tom/anaconda/lib/python2.7/site-packages/WCSAxesExperimental-0.0.0-py2.7.egg/wcsaxes/coordinate_helpers.py:357: RuntimeWarning: invalid value encountered in greater
/home/tom/anaconda/lib/python2.7/site-packages/WCSAxesExperimental-0.0.0-py2.7.egg/wcsaxes/coordinate_helpers.py:358: RuntimeWarning: invalid value encountered in greater
/home/tom/anaconda/lib/python2.7/site-packages/WCSAxesExperimental-0.0.0-py2.7.egg/wcsaxes/coordinate_helpers.py:371: RuntimeWarning: invalid value encountered in less

Passing case:
ophiuchus_wcsaxes

 # (replace `galaxy` with `ophiuchus` in the above code)

Shift between axis frame and ticks / image

I wanted to try out wcsaxes, so I pasted the examples from the docs into a notebook (located here.
As you can see the axis frame is often shifted from the ticks and image, i.e. it doesn't work for me (wcsaxes version a44c658, matplotlib version 1.3.1).

@astrofrog Do you plan to maintain the WCSAxes Demo notebook?
If yes, could you include a command to download the example FITS files (or include them in the notebook if that is possible) so that one can start playing with wcsaxes?

cc @anizami

tight_layout mode is broken

I've been using the WCSAxesSubplot with fig.set_tight_layout(True), which resizes axes as needed to fill available space. However, this is currently broken:

from wcsaxes import WCSAxesSubplot
import matplotlib.pyplot as plt
from astropy.io import fits
from astropy.wcs import WCS

data = fits.getdata('w5.fits')
wcs = WCS('w5.fits')


f = plt.figure()
f.set_tight_layout(True)
ax = WCSAxesSubplot(f, 111)
ax.set_xlabel('x')
ax.set_ylabel('y')
f.add_subplot(ax)

ax.imshow(data)
plt.show()

I think that d0e8a3c introduced the problem (hooray, git bisect!). Generally, the issue is probably that get_tightbbox is not properly taking axis labels into account.

Always put axis labels below tick labels

wcsaxes currently tries to put axis labels as close as possible to the axis, without overlapping any other text. This means that sometimes the label is inline with the ticklabels, and sometimes it's below:

image

image

This is kind of jarring when interactively panning using tight_axes, since snapping between these two layouts causes the image size to change abruptly

I would prefer that the axis labels are always placed below the tick labels, and that they never "jump up"

Enable replacement of the WCS object

This one is a little random. I would like to be able to plot a WCSAxes object and then change the WCS object (i.e. replace it with different instance) and have the Axes refresh on a re-draw command.

i.e.

ax = WCSAxes(..., wcs=WCS())
ax.wcs = WCS2()
ax.draw()

The reason for this is animating a series of images, the data is easy to change but the WCS information needs to be updated as well.

I would be happy to work on this as time allows, but some guidance would be nice.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.