def main(): parameterFile = "parameters.json" params = readParams.fromJSON(capmd.Parameters(), parameterFile) sim = capmd.interface(params) N = sim.popSize() NB = sim.getBoundarySize() lx = params.Lx ly = params.Ly nmax = params.t_final save_at = params.output_time steps_between_check = params.popdynfreq Nzaplist = 50 for n in tqdm(range(nmax)): sim.move() if (n % steps_between_check == 0): sim.populationDynamics(steps_between_check) if (n % save_at == 0): sim.saveData('vtp') sim.saveData('text') print('Simulation Complete\n\n')
def main(): parameterFile = "parameters.json" params = readParams.fromJSON(capmd.Parameters(), parameterFile) # setting some of ours here params.N = 20 params.Lx = 30 params.Ly = 30 params.poly = 0.3 params.maxZ = 6 params.divrate = 0 params.deathrate = 0 sim = capmd.interface(params) N = sim.popSize() NB = sim.getBoundarySize() nmax = params.t_final save_at = params.output_time steps_between_check = params.popdynfreq Nzaplist = 50 for n in tqdm(range(nmax)): sim.move() if (n % save_at == 0): sim.saveData('vtp') sim.saveData('text') print('Simulation Complete\n\n')
def calculate_msd(): parameterFile = "parameters.json" parser = argparse.ArgumentParser() parser.add_argument("-d", "--directory", type=str, default="./", help="input directory") #parser.add_argument("-o", "--output", type=str, help="output directory") #parser.add_argument("-p", "--prefix", type=str, default="cornea",help="prefix for output file") parser.add_argument("-s", "--skip", type=int, default=1100, help="skip this many samples") parser.add_argument("-m", "--howmany", type=int, default=30, help="read this many samples") parser.add_argument("-t", "--step", type=int, default=4, help="step snapshots with this spacing in flow field") parser.add_argument("-a", "--average", type=int, default=5, help="average over these many samples in flow field") args = parser.parse_args() param = read_param_CAPMD.Param( p.paramsFromFile(capmd.Parameters(), parameterFile)) sheet = Dynamics(initype="fromCSV", param=param, datapath='output/', multiopt="many") skip = 0 step = 1 howmany = 500 sheet.readDataMany("CAPMD", skip, step, howmany, False, readtypes=[1]) sheet.validate_initialise() sheet.getMSD(False) plt.show() return 0
def main(): parameterFile = "parameters.json" params = readParams.fromJSON(capmd.Parameters(), parameterFile) sim = capmd.interface(params) N = sim.popSize() NB = sim.getBoundarySize() lx = params.Lx ly = params.Ly nmax = params.t_final save_at = params.output_time steps_between_check = 100 zap_time = 1000 Nzaplist = 50 for n in tqdm(range(nmax)): sim.move() if (n == zap_time): #getting system info for zapping pop = sim.popSize() idxs = capmd.VectorInt(range(NB, NB + N)) popId = sim.getPopulationId(idxs) popPosn = sim.getPopulationPosition(idxs) #list of cells to be zapped zapList = capmd.VectorInt(np.random.choice(list(popId), Nzaplist)) sim.setCellTypes(zapList, 2) print("Cell zapping stage completed") if (n % save_at == 0): sim.saveData('vtp') sim.saveData('text') print('Simulation Complete\n\n')
import pycapmd as capmd import parameters as p import read_param_CAPMD as read_param parameterFile = "parameters.json" params = p.paramsFromFile(capmd.Parameters(), parameterFile) read_param.Param(params)
def main(): parameterFile = "parameters.json" params = readParams.fromJSON(capmd.Parameters(), parameterFile) #sim = config.simulation(params) sim = capmd.interface(params) N = sim.popSize() NB = sim.getBoundarySize() # Choosing the opposing corners of the rectangle to be killed lx = params.Lx ly = params.Ly wound = [(-lx / 4, -ly), (lx / 4, ly)] nmax = params.t_final # death_time = 1000000 # <- 50 such that it is far from the death causing holes in popDyn save_at = params.output_time steps_between_check = params.popdynfreq for n in tqdm(range(nmax)): sim.move() if (n % steps_between_check == 0): sim.populationDynamics(steps_between_check) if (n == death_time): N = sim.popSize() NB = sim.getBoundarySize() idxs = capmd.VectorInt(range(NB, N + NB)) pop_id = sim.getPopulationId(idxs) #<- get id pop_pos = sim.getPopulationPosition(idxs) # <- get position # [kc.kill_cell_in_rect(x, i, rect, sim) for (x,i) in zip(pop_pos, pop_id)] killList = capmd.VectorInt(kc.select_cells(pop_pos, pop_id, wound)) sim.killCells(killList) print('Finished killing') # elif (n >= death_time) and (n <= death_time + 1): # Only after wounding occurs (limit is in place as atm we plot the result) # N = sim.popSize() # NB = sim.getBoundarySize() # idxs = config.VectorInt(range(N, N+NB)) # pop_pos = sim.getPopulationPosition(idxs) # edges = border.alpha_shape(pop_pos, alpha = 3) # plt.figure() # plt.axis('equal') # xs = [] # ys = [] # # separate xs and ys since pop_pos[:,0] and pop_pos[:,1] dont agree since its a list of tuples # for pos in pop_pos: # xs.append(pos[0]) # ys.append(pos[1]) # plt.plot(xs, ys, '.') # for i, j in edges: # print("edges: ",i,j) # plt.plot([xs[i],xs[j]], [ys[i],ys[j]]) # plt.show() if (n % save_at == 0): sim.saveData('vtp') sim.saveData('text') print('Simulation Complete\n\n') return 0