Skip to content

Comments

Fix for issue where curranking would be float, yielding an error at np.bincount in recovery.rcc2d()#7

Open
jberkh wants to merge 1 commit intoaertslab:mainfrom
jberkh:main
Open

Fix for issue where curranking would be float, yielding an error at np.bincount in recovery.rcc2d()#7
jberkh wants to merge 1 commit intoaertslab:mainfrom
jberkh:main

Conversation

@jberkh
Copy link

@jberkh jberkh commented Mar 29, 2024

I ran into an issue in pyscenic, where some values for pyscenic.prune.prun2df arguments auc_threshold and nes_threshold, it gave the following error:

File "/home/jberkh/miniconda3/envs/envScenic/lib/python3.10/site-packages/ctxcore/recovery.py", line 80, in rcc2d
    np.bincount(curranking, weights=weights)[:rank_threshold]
TypeError: Cannot cast array data from dtype('float64') to dtype('int64') according to the rule 'safe'

The error arises from the need for an integer matrix as input for np.bincount. Apparently, curranking becomes a float matrix at certain values for auc_threshold and nes_threshold. The explicit cast to int fixes this issue.

NB: I'm unsure if the broader context of the code would necessitate calling np.rint() before casting to int. If so, please edit the PR where necessary.

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.

1 participant