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

Fix bad NA value Issue #41

Merged
merged 4 commits into from
Aug 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion docs/_sources/changelog.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
- Reduces duplicate code for handling NumPy and CuPy arrays conditionally.
- [Merged PR 36](https://github.com/Eve-ning/glcm-cupy/pull/36)
- Implement NaN Handling by ignoring contribution to GLCM

## 1.9

- [Merged PR 10](https://github.com/Eve-ning/glcm-cupy/pull/10)
Expand All @@ -40,6 +40,9 @@
- Fix `test_from_2d_image` failing due to missing 3rd dimension
- Remove `test_image_tiff` as it's redundant
- Fix reference `GLCM._binner` to `binner` in `utils`
- [Merged PR 41](https://github.com/Eve-ning/glcm-cupy/pull/41)
- Resolved issue where NA replacement value was incorrectly set to `bin_from`
- Resolved issue where NA summing used `.sum` instead of `np.nansum`

## 1.8

Expand Down
6 changes: 6 additions & 0 deletions docs/changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,12 @@ <h2>1.9<a class="headerlink" href="#id2" title="Permalink to this heading">¶</a
<li><p>Fix reference <code class="docutils literal notranslate"><span class="pre">GLCM._binner</span></code> to <code class="docutils literal notranslate"><span class="pre">binner</span></code> in <code class="docutils literal notranslate"><span class="pre">utils</span></code></p></li>
</ul>
</li>
<li><p><a class="reference external" href="https://github.com/Eve-ning/glcm-cupy/pull/41">Merged PR 41</a></p>
<ul>
<li><p>Resolved issue where NA replacement value was incorrectly set to <code class="docutils literal notranslate"><span class="pre">bin_from</span></code></p></li>
<li><p>Resolved issue where NA summing used <code class="docutils literal notranslate"><span class="pre">.sum</span></code> instead of <code class="docutils literal notranslate"><span class="pre">np.nansum</span></code></p></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="id3">
Expand Down
2 changes: 1 addition & 1 deletion docs/searchindex.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions glcm_cupy/glcm_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def glcm_cells(self, im: cp.ndarray) -> float:
@property
def nan_replacement(self):
""" Replacement Value for NaN """
return self.bin_from
return self.bin_to

def run(self, im: ndarray):
""" Executes running GLCM. Returns the GLCM Feature array
Expand Down Expand Up @@ -340,8 +340,8 @@ def glcm_ij(self,
self.ar_features,
True)
)
self.ar_glcm /= self.ar_glcm.sum(
axis=(1, 2)
self.ar_glcm /= np.nansum(
self.ar_glcm, axis=(1, 2)
)[..., np.newaxis, np.newaxis]
if self.do_stage(0): self.glcm_feature_kernel_0(**feature_args)
if self.do_stage(1): self.glcm_feature_kernel_1(**feature_args)
Expand Down
Binary file modified sphinx/build/doctrees/changelog.doctree
Binary file not shown.
Binary file modified sphinx/build/doctrees/environment.pickle
Binary file not shown.
5 changes: 4 additions & 1 deletion sphinx/build/html/_sources/changelog.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
- Reduces duplicate code for handling NumPy and CuPy arrays conditionally.
- [Merged PR 36](https://github.com/Eve-ning/glcm-cupy/pull/36)
- Implement NaN Handling by ignoring contribution to GLCM

## 1.9

- [Merged PR 10](https://github.com/Eve-ning/glcm-cupy/pull/10)
Expand All @@ -40,6 +40,9 @@
- Fix `test_from_2d_image` failing due to missing 3rd dimension
- Remove `test_image_tiff` as it's redundant
- Fix reference `GLCM._binner` to `binner` in `utils`
- [Merged PR 41](https://github.com/Eve-ning/glcm-cupy/pull/41)
- Resolved issue where NA replacement value was incorrectly set to `bin_from`
- Resolved issue where NA summing used `.sum` instead of `np.nansum`

## 1.8

Expand Down
6 changes: 6 additions & 0 deletions sphinx/build/html/changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,12 @@ <h2>1.9<a class="headerlink" href="#id2" title="Permalink to this heading">¶</a
<li><p>Fix reference <code class="docutils literal notranslate"><span class="pre">GLCM._binner</span></code> to <code class="docutils literal notranslate"><span class="pre">binner</span></code> in <code class="docutils literal notranslate"><span class="pre">utils</span></code></p></li>
</ul>
</li>
<li><p><a class="reference external" href="https://github.com/Eve-ning/glcm-cupy/pull/41">Merged PR 41</a></p>
<ul>
<li><p>Resolved issue where NA replacement value was incorrectly set to <code class="docutils literal notranslate"><span class="pre">bin_from</span></code></p></li>
<li><p>Resolved issue where NA summing used <code class="docutils literal notranslate"><span class="pre">.sum</span></code> instead of <code class="docutils literal notranslate"><span class="pre">np.nansum</span></code></p></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="id3">
Expand Down
2 changes: 1 addition & 1 deletion sphinx/build/html/searchindex.js

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion sphinx/src/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
- Reduces duplicate code for handling NumPy and CuPy arrays conditionally.
- [Merged PR 36](https://github.com/Eve-ning/glcm-cupy/pull/36)
- Implement NaN Handling by ignoring contribution to GLCM

## 1.9

- [Merged PR 10](https://github.com/Eve-ning/glcm-cupy/pull/10)
Expand All @@ -40,6 +40,9 @@
- Fix `test_from_2d_image` failing due to missing 3rd dimension
- Remove `test_image_tiff` as it's redundant
- Fix reference `GLCM._binner` to `binner` in `utils`
- [Merged PR 41](https://github.com/Eve-ning/glcm-cupy/pull/41)
- Resolved issue where NA replacement value was incorrectly set to `bin_from`
- Resolved issue where NA summing used `.sum` instead of `np.nansum`

## 1.8

Expand Down
7 changes: 0 additions & 7 deletions tests/integration_tests/test_padding.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,3 @@ def test_signature_match():
fn = dict(inspect.signature(glcm).parameters)
del fn['im']
assert cls == fn

def test_padding():
""" Tests if class & function signatures match """
cls = dict(inspect.signature(GLCM).parameters)
fn = dict(inspect.signature(glcm).parameters)
del fn['im']
assert cls == fn