Make histogramming more robust#1029
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1029 +/- ##
==========================================
- Coverage 81.30% 81.29% -0.01%
==========================================
Files 139 139
Lines 15150 15149 -1
==========================================
- Hits 12318 12316 -2
- Misses 2832 2833 +1
Continue to review full report at Codecov.
|
|
Codecov complaint is about a line that only has whitespace changes |
|
This is fine, but users creating CVs that return len-1 arrays seems to be a recurring issue that causes problems in multiple aspects of analysis. I'll accept this PR, but in general I'd be more interested in finding ways to discourage these CVs in the first place. I'll open a PR that tries to address this by raising a warning if using the The fundamental problem is that Python (and NumPy) allow ordering of len-1 iterables, which often lets the problem slip through sampling without causing problem. However, later analyses fail when they require that these be scalars (e.g., combining them into arrays). |
Issue found by a master student:
If
cvsingletons are not unpacked theSparseHistogrammight return broken output bins, which then fail in following code that assumes it is 1D (Like in this line).This PR forces a reshape to prevent mangled output
master:
This PR:
It also fixes some pep8 issues in histogram.py