Ejemplo n.º 1
0
		if check_length_init_env_stops2(parsed_dict['hex_init_env']):
			init_env = numpy.array(parsed_dict['hex_init_env'])
	else:
		init_env = None

	if 'diffusion_rate' in parsed_dict:
		diffusion_rate = parsed_dict['diffusion_rate']
	else:
		diffusion_rate = 0.0

	if 'init_pop' in parsed_dict:
		init_pop = numpy.array(parsed_dict['init_pop'])
	else:
		if 'base' in parsed_dict:
			#wektor bazowy * pop_size
			init_pop = generate_pop([(POP_SIZE, numpy.array(base))])
		else:
			print >> sys.stderr, "init_pop/base"
			sys.exit(1)

	if secretion != None:
		s2_secretion = convert_to_stops2_interpretation(secretion)
	else:
		s2_secretion = None

	if reception != None:
		s2_reception = convert_to_stops2_interpretation(reception)
	else:
		s2_reception = None

	n = int(math.sqrt(len(init_pop)))
Ejemplo n.º 2
0
base1=numpy.array([0,0,1,0,0,0,0,0])
base2=numpy.array([0,0,0,0,0,0,0,0])


trans_mat = numpy.array([[0,-10,0,0,0,0,10,0], #notch
                         [0,0,0,0,0,1,0,0], #Delta
                         [0,1,0,0,0,0,0,0.1], #basal
                         [0.005,0,0,0,0,0,0,0], #delta receptor
                         [-10,0,0,0,0,0,0,0], #notch receptor
                         [0,0,0,0,0,0,0,0], #ligand_delta
                         [0,0,0,0,0,0,0,0], #ligand_notch
                         [0,0,0,0,0,0,0,0] #ligand_basal
                        ])

init_pop = generate_pop([(50, base1), (2450, base2)])
grid = HexGrid(50, 50, 1)

def color_fun(row):
    if row[0]==1:
        return 1
    elif row[4]==1:
        return 0.75
    elif row[1]==1:
        if row[3]==1:
            return 0.55
        else:
            return 0.3
    else:
        if row[2]==1:
            return 0.2
Ejemplo n.º 3
0
base1 = numpy.array([0, 0, 1, 0, 0, 0, 0, 0])
base2 = numpy.array([0, 0, 0, 0, 0, 0, 0, 0])

trans_mat = numpy.array([
    [0, -10, 0, 0, 0, 0, 10, 0],  #notch
    [0, 0, 0, 0, 0, 1, 0, 0],  #Delta
    [0, 1, 0, 0, 0, 0, 0, 0.1],  #basal
    [0.005, 0, 0, 0, 0, 0, 0, 0],  #delta receptor
    [-10, 0, 0, 0, 0, 0, 0, 0],  #notch receptor
    [0, 0, 0, 0, 0, 0, 0, 0],  #ligand_delta
    [0, 0, 0, 0, 0, 0, 0, 0],  #ligand_notch
    [0, 0, 0, 0, 0, 0, 0, 0]  #ligand_basal
])

init_pop = generate_pop([(50, base1), (2450, base2)])
grid = HexGrid(50, 50, 1)


def color_fun(row):
    if row[0] == 1:
        return 1
    elif row[4] == 1:
        return 0.75
    elif row[1] == 1:
        if row[3] == 1:
            return 0.55
        else:
            return 0.3
    else:
        if row[2] == 1:
secretion = numpy.array([0])
reception = numpy.array([2])
receptors = numpy.array([-1])
bound=numpy.array([1,1,1,1])

base1=numpy.array([0,1,0,0])


trans_mat = numpy.array([[0,0,0,0], #Delta_ligand
                         [0.005,0,0,-1], #Delta
                         [-1,-1,0,0], #notch receptor
                         [0,0,0,0] #dummy
                         ])

init_pop = generate_pop([(2, base1)])
grid = HexGrid(1, 2, 1)

cell1, cell2, err, not_complete = 0, 0, 0, 0

m=1000 # number of simulations

def run():
    global cell1, cell2, err, not_complete
    x = Stops2(trans_mat, init_pop, grid.adj_mat, bound, secretion, reception, receptors, secr_amount=1, leak=0, max_con=1, max_dist=1.5, opencl=False)
    for i in range(1300):
        x.step()
        if (i+1)%1300 == 0:
            if (x.pop[0,2]==1 and x.pop[1,2]==0) :
                cell1+=1
            elif (x.pop[1,2]==1 and x.pop[0,2]==0) :
reception = numpy.array([2])
receptors = numpy.array([-1])
bound=numpy.array([1,1,1,1,1])

base1=numpy.array([1,0,0,0,1])
base2=numpy.array([0,0,0,0,1])

trans_mat= numpy.matrix(numpy.array([\
                       [0,5,0,0,0], #g0
                       [0,0,2,1,0], #g1
                       [0,0,0,0,0], #g2
                       [0,0,0,0,0], #g3
                       [0,0,-1,0,0] #g4
                       ]))

init_pop = generate_pop([(1150, base2), (200, base1), (1150, base2)])
grid = HexGrid(50, 50, 1)

def color_fun(row):
    if row[2]==1:
        return 0
    else:
        return 1.



def run():
    x = Stops2(trans_mat, init_pop, grid.adj_mat, bound, secretion, reception, receptors, secr_amount=1, leak=0, max_con=6, max_dist=3, opencl=False)
    for i in range(200):
        x.step()
        if i%5 == 0:
Ejemplo n.º 6
0
base1=numpy.array([0,0,1,0,0,0,0,0])
base2=numpy.array([0,0,0,0,0,0,0,0])


trans_mat = numpy.array([[0,-10,0,0,0,0,10,0], #notch
                         [0,0,0,0,0,1,0,0], #Delta
                         [0,1,0,0,0,0,0,0.1], #basal
                         [0.005,0,0,0,0,0,0,0], #delta receptor
                         [-10,0,0,0,0,0,0,0], #notch receptor
                         [0,0,0,0,0,0,0,0], #ligand_delta
                         [0,0,0,0,0,0,0,0], #ligand_notch
                         [0,0,0,0,0,0,0,0] #ligand_basal
                        ])

init_pop = generate_pop([(3, base1), (6, base2)])
grid = HexGrid(3, 3, 1)

class NumpyStopsTest(unittest.TestCase):

    def __init__(self, *args, **kwargs):
        super(NumpyStopsTest, self).__init__(*args, **kwargs)

    def test_each_step_with_constant_probs(self):
        s2 = Stops2(trans_mat, init_pop, grid.adj_mat, bound, secretion,
                   reception, receptors, secr_amount=6, leak=0, max_con=6, max_dist=1.5)
        s2.__random = lambda x: numpy.zeros(x) + 0.5


class PartialKernelsTest(unittest.TestCase):
Ejemplo n.º 7
0
base1 = numpy.array([0, 0, 1, 0, 0, 0, 0, 0])
base2 = numpy.array([0, 0, 0, 0, 0, 0, 0, 0])

trans_mat = numpy.array([
    [0, -10, 0, 0, 0, 0, 10, 0],  #notch
    [0, 0, 0, 0, 0, 1, 0, 0],  #Delta
    [0, 1, 0, 0, 0, 0, 0, 0.1],  #basal
    [0.005, 0, 0, 0, 0, 0, 0, 0],  #delta receptor
    [-10, 0, 0, 0, 0, 0, 0, 0],  #notch receptor
    [0, 0, 0, 0, 0, 0, 0, 0],  #ligand_delta
    [0, 0, 0, 0, 0, 0, 0, 0],  #ligand_notch
    [0, 0, 0, 0, 0, 0, 0, 0]  #ligand_basal
])

init_pop = generate_pop([(3, base1), (6, base2)])
grid = HexGrid(3, 3, 1)


class NumpyStopsTest(unittest.TestCase):
    def __init__(self, *args, **kwargs):
        super(NumpyStopsTest, self).__init__(*args, **kwargs)

    def test_each_step_with_constant_probs(self):
        s2 = Stops2(trans_mat,
                    init_pop,
                    grid.adj_mat,
                    bound,
                    secretion,
                    reception,
                    receptors,