Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructure TS map computation #215

Merged
merged 1 commit into from Dec 11, 2014

Conversation

@adonath
Copy link
Member

@adonath adonath commented Dec 3, 2014

As close to final as it could get today.

"""
def test_compute_ts_map():
"""Test compute_ts_map"""
from ...datasets import
Copy link
Member

@cdeil cdeil Dec 3, 2014

Choose a reason for hiding this comment

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

This makes travis-ci fail:
https://travis-ci.org/gammapy/gammapy/jobs/42900392#L724

Put all imports at the top for test files.

Loading

@cdeil
Copy link
Member

@cdeil cdeil commented Dec 3, 2014

Great ... I'll have a closer look when travis-ci passes. ;-)

Loading

@adonath adonath force-pushed the ts_map_calculator_parallel branch 3 times, most recently from c752421 to fe798c5 Dec 4, 2014
@@ -1 +1 @@
Subproject commit 5fd32d0edc34f94de9640fd20865cfe5d605e499
Subproject commit 956d39893123b593abe588524ed4490641a8d920
Copy link
Member

@cdeil cdeil Dec 4, 2014

Choose a reason for hiding this comment

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

This is re-setting the astropy-helpers git subproject pointer to an older version:

$ git show -s --format=%ci 5fd32d0edc34f94de9640fd20865cfe5d605e499
2014-10-22 22:26:11 +0100
$ git show -s --format=%ci 956d39893123b593abe588524ed4490641a8d920
2014-09-04 12:53:43 -0400

Did you do this by accident?

Loading

Copy link
Member

@cdeil cdeil Dec 9, 2014

Choose a reason for hiding this comment

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

@adonath Here's the info how you can reset the git submodule pointer:
https://github.com/astropy/astropy/pull/3091/files#diff-c72977d514af3c4ae1f5dd7abcdfe892R170

Loading

@cdeil
Copy link
Member

@cdeil cdeil commented Dec 4, 2014

Why did you change test_statistic.py to teststatistics.py?
Usually in Astropy and Gammapy we use singular and separate words by underscores, i.e. if you don't mind much, could you please rename back to test_statistic.py?

Also you have test_teststatistic.py, i.e. without the plural s.
Simply always having test_ prepended seems simpler to me.

Loading

from ...detect import compute_ts_map
from ...datasets import load_poisson_stats_image

from astropy.tests.helper import pytest
Copy link
Member

@cdeil cdeil Dec 4, 2014

Choose a reason for hiding this comment

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

Always sort imports like this:

  • Python built-in
  • Scientific Python
  • Astropy
  • Gammapy

Loading

@cdeil
Copy link
Member

@cdeil cdeil commented Dec 4, 2014

I'm getting this test error for test_compute_ts_map with Python 3.4 on Mac:
https://gist.github.com/cdeil/45051376b76f9cf0c9f1

Any idea what's going on or how to fix it?

Loading

@adonath adonath force-pushed the ts_map_calculator_parallel branch from fe798c5 to 8bca495 Dec 4, 2014
-------
TS : array
TS map.
amplitude : array (optional)
Copy link
Member

@cdeil cdeil Dec 4, 2014

Choose a reason for hiding this comment

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

Optionally returning a different number of things often leads to usage errors and is not extensible.

Returning a dict is better.

Best would be to return a TSMapResult object which is like a dict, but supports attribute access and has the attributes documented. You can copy this class and rename it to document what you return.
https://github.com/scipy/scipy/blob/v0.14.0/scipy/optimize/optimize.py#L71

Loading

@cdeil
Copy link
Member

@cdeil cdeil commented Dec 4, 2014

I'm now getting this error:

gammapy/detect/tests/test_test_statistic.py:6: in <module>
>   from ...detect import ts_image, TSMapCalculator
E   ImportError: cannot import name 'ts_image'

Loading

@cdeil
Copy link
Member

@cdeil cdeil commented Dec 4, 2014

The test is not running on travis-ci because scipy is not installed.
I'm fixing .travis.yml in a separate PR now and will then restart the tests here.

Loading

"""
Down sample image by a power of two.
The image is downsampled using `scikit-image.measure.block_reduce`. Only
Copy link
Member

@cdeil cdeil Dec 9, 2014

Choose a reason for hiding this comment

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

You have to write skimage instead of scikit-image here so that the Sphinx reference is created:
https://github.com/gammapy/gammapy/blob/master/docs/conf.py#L70

Loading

@adonath adonath force-pushed the ts_map_calculator_parallel branch 6 times, most recently from 6a2e9cf to c4acefa Dec 10, 2014
@cdeil
Copy link
Member

@cdeil cdeil commented Dec 10, 2014

41d2e90 in master should fix the unrelated apt-get error on travis-ci.

Loading

@adonath adonath force-pushed the ts_map_calculator_parallel branch from c4acefa to 66f2869 Dec 10, 2014
@adonath adonath force-pushed the ts_map_calculator_parallel branch from 66f2869 to 2f4708a Dec 10, 2014
@coveralls
Copy link

@coveralls coveralls commented Dec 10, 2014

Coverage Status

Coverage remained the same when pulling c4acefa on adonath:ts_map_calculator_parallel into 41d2e90 on gammapy:master.

Loading

@coveralls
Copy link

@coveralls coveralls commented Dec 10, 2014

Coverage Status

Coverage remained the same when pulling 66f2869 on adonath:ts_map_calculator_parallel into 41d2e90 on gammapy:master.

Loading

@coveralls
Copy link

@coveralls coveralls commented Dec 10, 2014

Coverage Status

Coverage remained the same when pulling 66f2869 on adonath:ts_map_calculator_parallel into 41d2e90 on gammapy:master.

Loading

@cdeil
Copy link
Member

@cdeil cdeil commented Dec 10, 2014

@adonath You want to hit the merge button?
Or was there something else you wanted to change here?

Loading

adonath added a commit that referenced this issue Dec 11, 2014
@adonath adonath merged commit 3e0f978 into gammapy:master Dec 11, 2014
1 of 2 checks passed
Loading
@cdeil cdeil mentioned this pull request Feb 5, 2015
10 tasks
@cdeil cdeil changed the title Restructured TS map computation Restructure TS map computation Apr 8, 2015
@cdeil cdeil added the feature label Apr 8, 2015
@cdeil cdeil added this to the 0.2 milestone Apr 8, 2015
@adonath adonath deleted the ts_map_calculator_parallel branch Nov 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants