def interp(file_loc,mat_name): """ Function to accept matlab .mat file with tumor data and interpolate values onto mesh """ f_log.write("Interpolating "+mat_name+"...\n") mat = sc_io_loadmat(file_loc)[mat_name] mat = fliplr(mat.T)/theta # Needs to be adjusted to fit the mesh correctly; also scaled x,y = mat.shape[0], mat.shape[1] mat_interp = InterpolatedParameter(linspace(1,x,x),linspace(1,y,y),mat,degree=1) return interpolate(mat_interp,V)
######################################################################### # MAIN # call the function with: python <this file> ######################################################################## output_dir = "./output/" f_log = open(osjoin(output_dir, 'log.txt'), 'a') rat_num = sys.argv[1] rat_idx = int(sys.argv[2]) day_idx = int(sys.argv[3]) # Days data and time steps input_dir = "../rat-data/rat" + rat_num + "/" alldata = sc_io_loadmat("../rat-data/finaldata.mat", ) days = alldata['rat'][0][rat_idx][3][0] days[:] = [x - days[0] for x in days] day = days[day_idx] steps = [] for i in range(1, len(days)): steps.append(days[i] - days[i - 1]) # Constant inputs for optimization D0 = 1. gammaD = .5 k0 = 1. beta = .5 theta = 50970. # carrying capacity - normalize cell data by this mu = .42 # kPa, bulk shear modulus nu = .45