Skip to content

Commit

Permalink
Fix Windows/dtypes bug by replacing np.integer and np.floating. (#90)
Browse files Browse the repository at this point in the history
These checks may be too strict, in the long run, but this should work for now and get Windows up and running.
  • Loading branch information
Tyler authored Feb 8, 2024
1 parent 4afb566 commit 55548bf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions epymorph/initializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def _default_compartments(ctx: InitContext) -> NDArray[SimDType]:

def _check_population(ctx: InitContext) -> None:
try:
check_ndarray(ctx.geo['population'], dtype=np.integer, shape=(ctx.dim.nodes,))
check_ndarray(ctx.geo['population'], dtype=[np.int64], shape=(ctx.dim.nodes,))
except KeyError as e:
raise InitException.for_arg('population', 'No such value in the geo.') from e
except NumpyTypeError as e:
Expand All @@ -95,7 +95,7 @@ def explicit(ctx: InitContext, initials: NDArray[SimDType]) -> NDArray[SimDType]
return initials.copy()


def proportional(ctx: InitContext, ratios: NDArray[np.integer | np.floating]) -> NDArray[SimDType]:
def proportional(ctx: InitContext, ratios: NDArray[np.int64 | np.float64]) -> NDArray[SimDType]:
"""
Set all compartments as a proportion of their population according to the geo.
The parameter array provided to this initializer will be normalized, then multiplied
Expand All @@ -107,7 +107,7 @@ def proportional(ctx: InitContext, ratios: NDArray[np.integer | np.floating]) ->

_, N, C, _ = ctx.dim.TNCE
try:
check_ndarray(ratios, dtype=[np.integer, np.floating], shape=[(C,), (N, C)])
check_ndarray(ratios, dtype=[np.int64, np.float64], shape=[(C,), (N, C)])
except NumpyTypeError as e:
raise InitException.for_arg('ratios') from e

Expand Down

0 comments on commit 55548bf

Please sign in to comment.