예제 #1
0
    def test_change_functions(self):
        """
        Tests gen.b_w_from_abs_change and gen.counts_from_first
        Returns
        -------
        boolean -- all tests were passed or not
        """
        np.random.seed(1234)
        correct = True

        counts_before = np.array([600, 400])
        abs_change = 100
        n_total = 1000
        K = 2
        b_0 = 600

        b, w = gen.b_w_from_abs_change(counts_before, abs_change, n_total)

        if any(np.abs(b - [-0.51082562, -0.91629073]) > 1e-5):
            print("gen.b_w_from_abs_change: b not correct!")
            correct = False

        if any(np.abs(w - [0.44183275, 0.]) > 1e-5):
            print("gen.b_w_from_abs_change: b not correct!")
            correct = False

        b_2 = gen.counts_from_first(b_0, n_total, K)
        if not np.array_equal(b_2, [600., 400.]):
            print("gen.counts_from_first not correct!")
            correct = False

        self.assertTrue(correct)
예제 #2
0
pd.set_option('display.max_columns', 500)
pd.set_option('display.max_rows', 500)
sns.set_style("ticks")

#%%
importlib.reload(ana)
# Get data

path = "C:\\Users\\Johannes\\Documents\\Uni\\Master's_Thesis\\compositionalDiff-johannes_tests_2\\data\\overall_benchmark"

#%%
# Find relations between numerical values and composition/increase vectors

b = []
for y1_0 in [20, 30, 50, 75, 115, 180, 280, 430, 667, 1000]:
    b_i = np.round(gen.counts_from_first(y1_0, 5000, 5), 3)
    b.append(np.round(np.log(b_i / 5000), 2))
print(b)

b_counts = dict(zip([b_i[0] for b_i in b], [20, 30, 50, 75, 115, 180, 280, 430, 667, 1000]))

b2 = []
for y1_0 in [20, 30, 50, 75, 115, 180, 280, 430, 667, 1000]:
    b_i = np.round(gen.counts_from_first(y1_0, 5000, 5), 3)
    b2.append(b_i)

b_w_dict = {}
i = 0
w_all = []
for b_i in b2:
    b_t = np.round(np.log(b_i / 5000), 3)
예제 #3
0
from scdcdm.util import data_generation as gen

np.random.seed(1234)

# General parameters
cases = [1]
K = [5]
n_samples = [[i + 1, j + 1] for i in range(10) for j in range(10)]
n_total = [5000]
num_results = [2e4]

# Get Parameter tuples: b: base composition; w: effect
b = []
for y1_0 in [115, 280, 1000]:
    b.append(np.round(gen.counts_from_first(y1_0, 5000, 5), 3))

b_w_dict = {}
i = 0
for b_i in b:
    b_t = np.round(np.log(b_i / 5000), 3)
    w_t = []
    for change in [-10, -50, -100]:
        _, w = gen.b_w_from_abs_change(b_i, change, 5000)
        w_t.append(np.round(w, 3))
    b_w_dict[i] = (b_t, w_t)
    i += 1

#%%
# Create bash script to execute run_one_job.py
count = 0