Skip to content

Make to_np_int32 generic for all dtypes - #245

Merged
jeromekelleher merged 3 commits into
tskit-dev:masterfrom
hyanwong:safe-numpy-int-casting
Jun 24, 2019
Merged

jeromekelleher merged 3 commits into
tskit-dev:masterfrom
hyanwong:safe-numpy-int-casting

Conversation

@hyanwong

Copy link
Copy Markdown
Member

Function to address #192

Comment thread python/tskit/util.py Resolved
Comment thread python/tests/test_util.py Resolved
Comment thread python/tskit/util.py Resolved
@codecov

codecov Bot commented Jun 21, 2019 •

Copy link
Copy Markdown

Codecov Report

Merging #245 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #245      +/-   ##
==========================================
+ Coverage   86.58%   86.59%   +0.01%     
==========================================
  Files          16       17       +1     
  Lines        9393     9402       +9     
  Branches     1704     1706       +2     
==========================================
+ Hits         8133     8142       +9     
  Misses        750      750              
  Partials      510      510
Flag Coverage Δ
#c_tests 86.59% <100%> (+0.01%) ⬆️
#python_tests 98.22% <100%> (ø) ⬆️
Impacted Files Coverage Δ
python/tskit/util.py 100% <100%> (ø)
python/tskit/trees.py 98.66% <100%> (ø) ⬆️
python/tskit/tables.py 99.79% <100%> (-0.01%) ⬇️

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 57ff0ab...dabf00c. Read the comment docs.

@jeromekelleher

Copy link
Copy Markdown
Member

Excellent, thanks @hyanwong. This is a very useful addition.

@hyanwong

Copy link
Copy Markdown
Member Author

@jeromekelleher - did you see my comment above. There's a weirdness at e.g.

flattened = util.safe_np_int_cast(np.hstack(sample_sets), np.int32)
where 3 lines above the array is formed as uint32, then cast into int32. I'm not sure why this is, but it seems wrong. There are a few further places in the same file where this happens too.

@jeromekelleher

Copy link
Copy Markdown
Member

I can't find the comment, but this is correct. It's two different arrays, right (sample_sets and sample_set_sizes)?

@hyanwong

Copy link
Copy Markdown
Member Author

Sorry, you are right. I'm being thick.

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.

2 participants