def __init__(self, path):
     self.path = toolbox_basic.check_path(path)
     self.iterate_numbers = []
     self.iterate_information = []
     self.min_max_concns = {}
     # agent_Sum
     try:
         self.agent_Sum = os.path.join(self.path, 'agent_Sum')
         if not os.path.isdir( self.agent_Sum ):
             toolbox_basic.unzip_files(self.agent_Sum + '.zip')
         self.agent_Sum = toolbox_basic.check_path(self.agent_Sum)
     except TypeError:
         print('Could not find agent_Sum info! '+self.path)
     # agent_State
     try:
         self.agent_State = os.path.join(self.path, 'agent_State')
         if not os.path.isdir( self.agent_State ):
             toolbox_basic.unzip_files(self.agent_State + '.zip')
         self.agent_State = toolbox_basic.check_path(self.agent_State)
     except TypeError:
         print('Could not find agent_State info! '+self.path)
     # env_Sum
     try:
         self.env_Sum = os.path.join(self.path, 'env_Sum')
         if not os.path.isdir( self.env_Sum ):
             toolbox_basic.unzip_files(self.env_Sum + '.zip')
         self.env_Sum = toolbox_basic.check_path(self.env_Sum)
     except TypeError:
         print('Could not find env_Sum info! '+self.path)
     # env_State
     try:
         self.env_State = os.path.join(self.path, 'env_State')
         if not os.path.isdir( self.env_State ):
             toolbox_basic.unzip_files(self.env_State + '.zip')
         self.env_State = toolbox_basic.check_path(self.env_State)
     except TypeError:
         print('Could not find env_State info! '+self.path)
     # Figures directory
     self.figures_dir = os.path.join(self.path, 'figures')
     if not os.path.isdir(self.figures_dir):
         toolbox_basic.make_dir(self.figures_dir)
     self.movies_dir = os.path.join(self.path, 'movies')
     if not os.path.isdir(self.movies_dir):
         toolbox_basic.make_dir(self.movies_dir)
Esempio n. 2
0
 def get_detail_level_mesh_dir(self, detail_level):
     self.get_detail_level_dir(detail_level)
     self.detail_level_mesh_dir = os.path.join(self.detail_level_dir, 'mesh')
     toolbox_basic.make_dir(self.detail_level_mesh_dir)
     return self.detail_level_mesh_dir
Esempio n. 3
0
 def get_detail_level_dir(self, detail_level):
     name = 'detail_level_%d'%(detail_level)
     self.detail_level_dir = os.path.join(self.root_dir, name)
     toolbox_basic.make_dir(self.detail_level_dir)
     return self.detail_level_dir
Esempio n. 4
0
 def get_run_dir(self, detail_level, sif_name):
     self.get_detail_level_dir(detail_level)
     self.run_dir = os.path.join(self.detail_level_dir, sif_name)
     toolbox_basic.make_dir(self.run_dir)
     return self.run_dir
                        type="int", help="number of images per second")
parser.add_option("-r", "--ResultsDir", dest="results_dir",
                      default=os.getcwd(), help="path to results directory")
parser.add_option("-s", "--SoluteName", dest="solute_name", default="none",
                        help="name of the solute to be plotted behind cells")
(options, args) = parser.parse_args()

sim = toolbox_idynomics.SimulationDirectory(options.results_dir)

save_name = 'biofilm_'+options.solute_name

file_list = toolbox_basic.file_list(sim.figures_dir, save_name+'*.png')
num_digits = len(str(len(file_list)))

temp_dir = os.path.join(os.path.abspath(sim.movies_dir), 'temp')
toolbox_basic.make_dir(temp_dir)
for i, filename in enumerate(file_list):
    save_num = str(i)
    link_name = 'img' + (num_digits-len(save_num))*'0' + save_num + '.png'
    link_name = os.path.join(temp_dir, link_name)
    toolbox_basic.make_symbolic_link(filename, link_name)


cmd = "ffmpeg -framerate "+str(options.frame_rate)+"  -i '"
cmd += os.path.join(temp_dir, "img%"+str(num_digits)+"d.png'")
cmd += " -pix_fmt yuv420p -r 24  '"
cmd += os.path.join(os.path.abspath(sim.movies_dir), save_name+".mp4'")
os.system(cmd)

toolbox_basic.rm_dir(temp_dir)
Esempio n. 6
0
                  help="path to results directory")
parser.add_option("-s",
                  "--SoluteName",
                  dest="solute_name",
                  default="none",
                  help="name of the solute to be plotted behind cells")
(options, args) = parser.parse_args()

sim = toolbox_idynomics.SimulationDirectory(options.results_dir)

save_name = 'biofilm_' + options.solute_name

file_list = toolbox_basic.file_list(sim.figures_dir, save_name + '*.png')
num_digits = len(str(len(file_list)))

temp_dir = os.path.join(os.path.abspath(sim.movies_dir), 'temp')
toolbox_basic.make_dir(temp_dir)
for i, filename in enumerate(file_list):
    save_num = str(i)
    link_name = 'img' + (num_digits - len(save_num)) * '0' + save_num + '.png'
    link_name = os.path.join(temp_dir, link_name)
    toolbox_basic.make_symbolic_link(filename, link_name)

cmd = "ffmpeg -framerate " + str(options.frame_rate) + "  -i '"
cmd += os.path.join(temp_dir, "img%" + str(num_digits) + "d.png'")
cmd += " -pix_fmt yuv420p -r 24  '"
cmd += os.path.join(os.path.abspath(sim.movies_dir), save_name + ".mp4'")
os.system(cmd)

toolbox_basic.rm_dir(temp_dir)