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

Result of np.sum() fails isinstance(s, int) #119

Open
clorton opened this issue Feb 3, 2025 · 0 comments
Open

Result of np.sum() fails isinstance(s, int) #119

clorton opened this issue Feb 3, 2025 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@clorton
Copy link
Contributor

clorton commented Feb 3, 2025

It is reasonable to use np.sum() to determine the required capacity of a LaserFrame. However, the result of np.sum() is of type numpy.int64 which does not pass the test of isinstance(s, int).

That means the following test fails and it is a hassle to have to cast the result of np.sum() to a Python int to create a LaserFrame:

https://github.com/InstituteforDiseaseModeling/laser/blob/main/src/laser_core/laserframe.py#L59

The test should include NumPy integer types, e.g.

isinstance(capacity, [int, np.integer])

This is probably true for the test of initial_count as well.

@clorton clorton added the enhancement New feature or request label Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants