Skip to content

Commit

Permalink
Merge pull request #17 from Advestis/refactoring
Browse files Browse the repository at this point in the history
Replace np.int (deprecated) by np.int_
  • Loading branch information
chgeissler authored Nov 29, 2023
2 parents ea0d552 + fc39719 commit 526e61d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions adnmtf/nmtf_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@

def init(m, mmis, nc):
n, p = m.shape
mmis = mmis.astype(np.int)
mmis = mmis.astype(np.int_)
n_mmis = mmis.shape[0]
if n_mmis == 0:
missing_values_indexes = np.where(np.isnan(m) == 1)
n_mmis = missing_values_indexes[0].size
if n_mmis > 0:
mmis = np.isnan(m) == 0
mmis = mmis.astype(np.int)
mmis = mmis.astype(np.int_)
m[mmis == 0] = 0
else:
m[mmis == 0] = 0
Expand Down Expand Up @@ -443,14 +443,14 @@ def r_ntf_solve(
cancel_pressed,
)

mmis = mmis.astype(np.int)
mmis = mmis.astype(np.int_)
n_mmis = mmis.shape[0]
if n_mmis == 0:
missing_values_indexes = np.where(np.isnan(m) == 1)
n_mmis = missing_values_indexes[0].size
if n_mmis > 0:
mmis = np.isnan(m) == 0
mmis = mmis.astype(np.int)
mmis = mmis.astype(np.int_)
m[mmis == 0] = 0
else:
m[mmis == 0] = 0
Expand Down Expand Up @@ -646,12 +646,12 @@ def init_factorization(m, n_components):
n, p = m.shape
# Identify missing values
mmis = np.array([])
mmis = mmis.astype(np.int)
mmis = mmis.astype(np.int_)
missing_values_indexes = np.where(np.isnan(m) == 1)
n_mmis = missing_values_indexes[0].size
if n_mmis > 0:
mmis = np.isnan(m) == 0
mmis = mmis.astype(np.int)
mmis = mmis.astype(np.int_)
m[mmis == 0] = 0
else:
m[mmis == 0] = 0
Expand Down
2 changes: 1 addition & 1 deletion adnmtf/nmtf_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def ntf_stack(m, mmis, n_blocks):
for future use with NMF
"""
n, p = m.shape
mmis = mmis.astype(np.int)
mmis = mmis.astype(np.int_)
n_mmis = mmis.shape[0]
n_blocks = int(n_blocks)

Expand Down
10 changes: 5 additions & 5 deletions adnmtf/nmtf_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,10 +495,10 @@ def build_clusters(
def cluster_pvalues(cluster_size, nb_groups, mt, r_ct, n_ct, row_groups, list_groups, ngroup):
"""Calculate Pvalue of each group versus cluster"""
n, nc = mt.shape
cluster_size = cluster_size.astype(np.int)
cluster_size = cluster_size.astype(np.int_)
nb_groups = int(nb_groups)
r_ct = r_ct.astype(np.int)
n_ct = n_ct.astype(np.int)
r_ct = r_ct.astype(np.int_)
n_ct = n_ct.astype(np.int_)
cluster_size = np.reshape(cluster_size, nc)
r_ct = np.reshape(r_ct, (n,))
n_ct = np.reshape(n_ct, (nc,))
Expand Down Expand Up @@ -569,8 +569,8 @@ def global_sign(nrun, nb_groups, mt, r_ct, n_ct, row_groups, list_groups, ngroup
n, nc = mt.shape
nrun = int(nrun)
nb_groups = int(nb_groups)
r_ct = r_ct.astype(np.int)
n_ct = n_ct.astype(np.int)
r_ct = r_ct.astype(np.int_)
n_ct = n_ct.astype(np.int_)
cluster_size = np.zeros(nc)
r_ct = np.reshape(r_ct, n)
n_ct = np.reshape(n_ct, nc)
Expand Down

0 comments on commit 526e61d

Please sign in to comment.