Skip to content

Making 'isophote' a sub package of 'photutils' - #532

Closed
ibusko wants to merge 0 commit into
astropy:masterfrom
ibusko:master
Closed

ibusko wants to merge 0 commit into
astropy:masterfrom
ibusko:master

Conversation

@ibusko

@ibusko ibusko commented Apr 11, 2017

Copy link
Copy Markdown
Contributor

Tests run. Not sure that the documentation builds though (I get a "no such file" sphinx error).

The tutorial notebooks where moved to astropy-tutorials.

There are a few largish test data files that I don't know where to move to.

@bsipocz

bsipocz commented Apr 11, 2017 •

Copy link
Copy Markdown
Member

@ibusko - The big data files could possibly go to the photutils-datasets repo? There are some notebooks there, too so anything that doesn't fit astropy-tutorials could go there.

@larrybradley

larrybradley commented Apr 11, 2017 •

Copy link
Copy Markdown
Member

Thanks, @ibusko. Large data could go in https://github.com/astropy/astropy-data or https://github.com/astropy/photutils-datasets

@ibusko

ibusko commented Apr 12, 2017

Copy link
Copy Markdown
Contributor Author

Moved larger data sets to photutils-datasets; modified tests so they run with the new paths.

Comment thread photutils/isophote/harmonics.py Outdated
from __future__ import (absolute_import, division, print_function, unicode_literals)

import numpy as np
from scipy.optimize import leastsq

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ibusko - scipy is currently an optional dependency of photutils, so this will fail the tests.

In other modules (e.g segmentation) this is avoided by importing scipy in the function/class rather on modul level. Corresponding tests then are skipped when no scipy install is available.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I fixed this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My initial understanding (was wrong) is that this is a requirement of the tests only. Now I notice that the code itself can't rely on scipy. But the scipy.optimize.leastsq function is at the very backbone of the entire isophote fitting idea. In a case like this, we cannot have scipy as an optional dependency; it's mandatory. Does it mean that the isophote code can't live in photutils after all?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ibusko A lot of the functionality in photutils requires scipy and scikit-image, but they are "optional" dependencies. In other words, import photutils will still work without those dependencies. However, the actual functions that need those packages will raise an ImportError if they are not installed. This mirrors the behavior in astropy, where numpy is the only "strict" dependency.

@bsipocz Perhaps we should just make scipy and scikit-image required dependencies? I don't recall if affiliated packages are not supposed to have required dependencies other than numpy and astropy.

Comment thread photutils/isophote/tests/test_angles.py Outdated
import math

import numpy as np
import unittest

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unittest is currently failing with python3.6 as we still use the astropy shipped pytest version.

@larrybradley - I already have an open PR to use system pytest, that should fix this (after an minor update), but I wonder whether we aim to have a pure pytest testing suite or mixing it with unittest is also OK?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering about that too. I can convert the unit tests to pytest if that's what we want.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be my preference to use only pytest.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I tend to lean toward py.test too, so the package better conforms to the standards used elsewhere. I guess I was just waiting for an excuse to do the change :-)

I will work on that and report here when done.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @ibusko.

@ibusko

ibusko commented Apr 18, 2017 •

Copy link
Copy Markdown
Contributor Author

Modified all tests to conform to pytest style.

It seems that all tests that depend on test data are failing because they can't find the data. Are there any examples in the photutils tests that I can use as a template for finding data files?

Comment thread photutils/isophote/tests/test_fitter.py Outdated
sample = Sample(test_data, 40.)
sample.update()

assert sample.mean == pytest.approx(200.02, abs=0.01)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are all failing at the moment, as we are still using the astropy bundled ancient version of pytest.

@larrybradley - what do you think, shall we aim to merge #491 asap or rather work around to still support pytest 2.x?

Comment thread photutils/isophote/model.py Outdated

import sys
import numpy as np
from scipy.interpolate import LSQUnivariateSpline

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in addition of moving these imports, the tests that use any code relying on scipy also need to be decorated with @pytest.mark.skipif('not HAS_SCIPY') where HAS_SCIPY is defined as

try:
    import scipy
    HAS_SCIPY = True
except ImportError:
    HAS_SCIPY = False

e.g.: photutils/segmentation/tests/test_core.py

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed this.

@ibusko

ibusko commented May 10, 2017

Copy link
Copy Markdown
Contributor Author

What is the state of this pull request? There are errors caused by failures in locating the data sets required by the tests. I understand that these data sets should live in photutils-datasets, but how exactly the packages are layered during the tests so the code can actually run and find the data files it needs?

@SaOgaz

SaOgaz commented Jun 20, 2017

Copy link
Copy Markdown
Contributor

Did anyone get back to Ivo on this? @larrybradley, @bsipocz

@larrybradley

Copy link
Copy Markdown
Member

I plan to look over this PR this week.

@pllim

pllim commented Aug 4, 2017

Copy link
Copy Markdown
Member

I kind of want to start pointing people to a Python version when I get ellipse help calls. Is this going to be merged anytime soon?

@ibusko

ibusko commented Aug 8, 2017 •

Copy link
Copy Markdown
Contributor Author

I definitely would like to to so as well.

As far as I know, this is ready to be merged. Although there still be issues with the location of large files, both for the test images, and for the images used in the tutorials.

@larrybradley

Copy link
Copy Markdown
Member

Sorry for the delay, but I plan to get to this soon. I would like to include this in the next release.

@SaOgaz

SaOgaz commented Sep 8, 2017

Copy link
Copy Markdown
Contributor

@larrybradley any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants