Skip to content

Commit

Permalink
Reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
szhan committed Apr 19, 2024
1 parent 820e582 commit b98cdc7
Showing 1 changed file with 16 additions and 21 deletions.
37 changes: 16 additions & 21 deletions tests/lsbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ def get_examples_haploid(self, ts):
H = ts.genotype_matrix()
s = H[:, 0].reshape(1, H.shape[0])
H = H[:, 1:]
haplotypes = [
s,
H[:, -1].reshape(1, H.shape[0])
]
haplotypes = [s, H[:, -1].reshape(1, H.shape[0])]
s_miss_last = s.copy()
s_miss_last[0, -1] = core.MISSING
s_miss_mid = s.copy()
Expand Down Expand Up @@ -77,16 +74,16 @@ def get_examples_pars_haploid(self, ts, scale_mutation=True, seed=42):
m = ts.num_sites
n = H.shape[1]
rs = [
np.zeros(m) + 0.01, # Equal recombination and mutation
np.zeros(m) + 0.999, # Extreme
np.zeros(m) + 1e-6, # Extreme
np.zeros(m) + 0.01, # Equal recombination and mutation
np.zeros(m) + 0.999, # Extreme
np.zeros(m) + 1e-6, # Extreme
np.random.rand(m), # Random
]
mus = [
np.zeros(m) + 0.01, # Equal recombination and mutation
np.zeros(m) + 0.01, # Equal recombination and mutation
np.zeros(m) + 0.2, # Extreme
np.zeros(m) + 1e-6, # Extreme
np.random.rand(m) * 0.2, # Random
np.zeros(m) + 1e-6, # Extreme
np.random.rand(m) * 0.2, # Random
]
for s, r, mu in itertools.product(haplotypes, rs, mus):
r[0] = 0
Expand All @@ -108,7 +105,7 @@ def get_examples_diploid(self, ts, seed=42):
H = H[:, 2:]
genotypes = [
s,
H[:, -1].reshape(1, H.shape[0]) + H[:, -2].reshape(1, H.shape[0])
H[:, -1].reshape(1, H.shape[0]) + H[:, -2].reshape(1, H.shape[0]),
]
s_miss_last = s.copy()
s_miss_last[0, -1] = core.MISSING
Expand Down Expand Up @@ -142,25 +139,23 @@ def get_examples_pars_diploid(self, ts, seed=42):
m = ts.num_sites
n = H.shape[1]
rs = [
np.zeros(m) + 0.01, # Equal recombination and mutation
np.zeros(m) + 0.999, # Extreme
np.zeros(m) + 1e-6, # Extreme
np.zeros(m) + 0.01, # Equal recombination and mutation
np.zeros(m) + 0.999, # Extreme
np.zeros(m) + 1e-6, # Extreme
np.random.rand(m), # Random
]
mus = [
np.zeros(m) + 0.01, # Equal recombination and mutation
np.zeros(m) + 0.33, # Extreme
np.zeros(m) + 1e-6, # Extreme
np.random.rand(m) * 0.33, # Random
np.zeros(m) + 0.01, # Equal recombination and mutation
np.zeros(m) + 0.33, # Extreme
np.zeros(m) + 1e-6, # Extreme
np.random.rand(m) * 0.33, # Random
]
for s, r, mu in itertools.product(genotypes, rs, mus):
r[0] = 0
e = self.get_emission_matrix_diploid(mu, m)
yield n, m, G, s, e, r, mu

def get_examples_pars_larger_diploid(
self, ts, mean_r=1e-5, mean_mu=1e-5, seed=42
):
def get_examples_pars_larger_diploid(self, ts, mean_r=1e-5, mean_mu=1e-5, seed=42):
np.random.seed(seed)
H, G, genotypes = self.get_examples_diploid(ts)
m = H.shape[0]
Expand Down

0 comments on commit b98cdc7

Please sign in to comment.