예제 #1
0
 def generate_molecules(self):
     """Generates the number of molecules prescribed by
     self.verlhurst()
     """
     
     for i in range(self.myosin_add):
         self.mol_all.append(myosin(random()*self.width,random()*self.height))
     for i in range(self.actin_add):
         where = random()
         if (where <= simulation_values.near_okt3_odds):
             # Generates actin near OKT3 by choosing points near
             # the first ok_count molecules which are the OKT3s
             which = int(random()*float(simulation_values.ok_count))
             okt3 = self.mol_all[which]
             p = point_near(okt3.pos,5.)
             self.mol_all.append(actin(p[0],p[1]))
         else:
             # Generates actin randomly on field
             if simulation_values.ok_count == 1:
                 angle = random()*2.*np.pi
                 self.mol_all.append( \
                     actin((simulation_values.cortex_rad+3.)*random()*np.cos(angle)+50., \
                           (simulation_values.cortex_rad+3.)*random()*np.sin(angle)+50.) \
                     )
             else:      
                 self.mol_all.append(actin(random()*self.width,random()*self.height))
     self.molecule_count()
예제 #2
0
    def initialize(self):
        """Initializes the molecules for the start of the synapse
        simulation. All myosin and actin are randomly places to
        simulate t=0 where the T-cell has not been introduced to OKT3.
        """

        if simulation_values.ok_count == 3:
            # Generates 3 OKT3
            a = okt3(25.,25.)
            b = okt3(75.,25.)
            c = okt3(50.,75.)
            self.mol_all.append(a)
            self.mol_all.append(b)
            self.mol_all.append(c)
        elif simulation_values.ok_count == 2:
            # Generates 2 OKT3
            for i in range(2):
                mol = okt3(self.width/4.*(2.*(i+.5)),self.height/2.)
                self.mol_all.append(mol)
        elif simulation_values.ok_count == 1:
            # Generates 1 OKT3
            a = okt3(50.,50.)
            self.mol_all.append(a)

        if simulation_values.ok_count == 1:
            # Generates actin radially for cortex
            for i in range(simulation_values.num_act):
                angle = random()*2.*np.pi
                mol = actin( \
                    ((simulation_values.cortex_rad+(random()-random())*4.+1.5))*np.cos(angle)+50., \
                    ((simulation_values.cortex_rad+(random()-random())*4.+1.5))*np.sin(angle)+50.)
                self.mol_all.append(mol)
        else:
            # Generates appropriate amount of myosin and actin for new
            # population dynamics
            for i in range(simulation_values.num_act):
                mol = actin(random()*self.width,random()*self.height)
                self.mol_all.append(mol)
        #for i in range(int(simulation_values.carrying_capacity_myo*(5./8.))):
        for i in range(simulation_values.num_myo):
            mol = myosin(random()*self.width,random()*self.height)
            self.mol_all.append(mol)
        
        self.molecule_count()