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

Add brightest_island function #1587

Merged
merged 1 commit into from Apr 15, 2021
Merged

Add brightest_island function #1587

merged 1 commit into from Apr 15, 2021

Conversation

maxnoe
Copy link
Member

@maxnoe maxnoe commented Feb 1, 2021

No description provided.

@codecov
Copy link

codecov bot commented Feb 1, 2021

Codecov Report

Merging #1587 (f3af417) into master (776b403) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1587      +/-   ##
==========================================
+ Coverage   90.43%   90.44%   +0.01%     
==========================================
  Files         186      186              
  Lines       13862    13882      +20     
==========================================
+ Hits        12536    12556      +20     
  Misses       1326     1326              
Impacted Files Coverage Δ
ctapipe/image/__init__.py 100.00% <ø> (ø)
ctapipe/image/morphology.py 55.17% <100.00%> (+7.17%) ⬆️
ctapipe/image/tests/test_morphology.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 776b403...f3af417. Read the comment docs.

ctapipe/image/morphology.py Outdated Show resolved Hide resolved
island_brightness = np.zeros(n_islands + 1)
np.add.at(island_brightness, island_labels[mask], image[mask])

brightest_island = np.argmax(island_brightness)
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't name your variable brightest_island, as that is also the function name

Copy link
Member

Choose a reason for hiding this comment

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

maybe brightest_label?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's actually not a problem, since it only assigns a variable in the local scope of the function (and the function is not recursive).

However, to avoid confusion, I changed the variable name.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks. it was more to avoid confusion and the linter complaining

ctapipe/image/morphology.py Show resolved Hide resolved
island_brightness = np.zeros(n_islands + 1)
np.add.at(island_brightness, island_labels[mask], image[mask])

brightest_island = np.argmax(island_brightness)
Copy link
Member

Choose a reason for hiding this comment

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

maybe brightest_label?

@maxnoe maxnoe added this to the v0.11.0 milestone Apr 6, 2021
@maxnoe maxnoe merged commit 10ee4bd into master Apr 15, 2021
@maxnoe maxnoe deleted the brightest_island branch April 15, 2021 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants