diff --git a/src/grid.py b/src/grid.py index d132ef9..19a3867 100644 --- a/src/grid.py +++ b/src/grid.py @@ -717,7 +717,6 @@ def reinitialization(self,initialization,microbes_pp,output,mode,pulse,*args): # last: assign microbes to each grid box randomly based on prior densities choose_taxa = np.zeros((self.n_taxa,self.gridsize), dtype='int8') for i in range(self.n_taxa): - choose_taxa[i,:] = np.random.binomial(1, frequencies[i], self.gridsize) freq=np.float64(frequencies.iloc[1]) #working independent of indexing (based on location not index labels) p_vec = np.array([freq, 1.0 - freq], dtype=np.float64) #solve numoy issues p_vec = p_vec / p_vec.sum() diff --git a/src/utility.py b/src/utility.py index eeb6405..3e97c41 100644 --- a/src/utility.py +++ b/src/utility.py @@ -10,7 +10,7 @@ import numpy as np import pandas as pd import pickle -from scipy.stats import distributions +from scipy.stats import uniform, norm # instead of calling the whole distributions package (heavy) we call only the needed objects def LHS(n,loc,upc,dist): @@ -34,9 +34,9 @@ def LHS(n,loc,upc,dist): scale = upc - loc if dist == 'uniform': - rv = distributions.uniform(loc=loc, scale=scale) + rv = uniform(loc=loc, scale=scale) elif dist == 'normal': - rv = distributions.norm(loc=loc, scale=scale) + rv = norm(loc=loc, scale=scale) lhs = rv.ppf(points) @@ -87,4 +87,4 @@ def export(output,site,name): """ with open(site + "_" + str(name) + ".pickle", "wb") as f: - pickle.dump(output, f, pickle.HIGHEST_PROTOCOL) \ No newline at end of file + pickle.dump(output, f, pickle.HIGHEST_PROTOCOL)