def get_rad_from_obs(self): if self.dist == 'negbin': n, p = negbin_solver(self.obs) pred_rad = self.get_rad_negbin(len(self.obs), n, p) elif self.dist == 'pln': mu, sigma = pln_solver(self.obs) pred_rad = self.get_rad_pln(len(self.obs), mu, sigma) return (pred_rad, mu, sigma)
def get_rad_from_obs(ab, dist): if dist == 'negbin': n, p = negbin_solver(ab) pred_rad = get_rad_negbin(len(ab), n, p) elif dist == 'pln': mu, sigma = pln_solver(ab) pred_rad = get_rad_pln(len(ab), mu, sigma) return pred_rad
def get_rad_from_obs(self): if self.dist == 'negbin': n, p = negbin_solver(self.obs) pred_rad = self.get_rad_negbin(len(self.obs), n, p) elif self.dist == 'pln': mu, sigma = pln_solver(self.obs) pred_rad = self.get_rad_pln(len(self.obs), mu, sigma) return pred_rad
def get_par_multi_dists(ab, dist_name): """Returns the parameters given the observed abundances and the designated distribution.""" if dist_name == 'logser': beta = mete.get_beta(len(ab), sum(ab), version='untruncated') par = (np.exp(-beta), ) elif dist_name == 'pln': par = md.pln_solver(ab) elif dist_name == 'geom': par = (len(ab) / sum(ab), ) elif dist_name == 'negbin': par = md.negbin_solver(ab) if np.isnan(par[0]): par = None elif dist_name == 'zipf': par = (md.zipf_solver(ab), ) else: print "Error: distribution not recognized." par = None return par
def get_par_multi_dists(ab, dist_name): """Returns the parameters given the observed abundances and the designated distribution.""" if dist_name == 'logser': beta = mete.get_beta(len(ab), sum(ab), version = 'untruncated') par = (np.exp(-beta), ) elif dist_name == 'pln': par = md.pln_solver(ab) elif dist_name == 'geom': par = (len(ab) / sum(ab), ) elif dist_name == 'negbin': par = md.negbin_solver(ab) if np.isnan(par[0]): par = None elif dist_name == 'zipf': par = (md.zipf_solver(ab), ) else: print "Error: distribution not recognized." par = None return par