Beispiel #1
0
def plot(iter_info, min_max_concns):
    axis = figure.add_subplot('',
                              111,
                              frameon=options.frameon,
                              projection='3d')
    axis.view_init(azim=45, elev=35)
    if not options.solute_name == "none":
        solute_output = toolbox_results.SoluteOutput(iter_info.env_output,
                                                     name=options.solute_name)
        cs = toolbox_idynomics.solute_contour_3d(
            axis,
            solute_output,
            concn_range=min_max_concns[options.solute_name])
        if options.color_bar:
            matplotlib.pyplot.colorbar(cs)
    toolbox_idynomics.color_cells_by_species(iter_info.agent_output,
                                             species_color_dict)
    toolbox_idynomics.plot_cells_3d(axis, iter_info.agent_output)
    if options.titleon:
        axis.set_title(r'Biofilm (%s g L$^{-1}$)' % (options.solute_name))
    if options.frameon:
        axis.set_xlabel('x')
        axis.set_ylabel('y')
        axis.set_zlabel('z')
    save_num = str(iter_info.number)
    save_num = (num_digits - len(save_num)) * '0' + save_num
    figure.subplots_adjust(left=0.05, right=0.95, bottom=0.05, top=0.95)
    figure.save(
        os.path.join(sim.figures_dir, save_name + '_' + save_num + '.png'))
 def get_min_max_concns(self):
     if self.min_max_concns == {}:
         for solute_name in self.env_output.get_solute_names():
             solute_output = toolbox_results.SoluteOutput(self.env_output,
                                                         name=solute_name)
             self.min_max_concns[solute_name] = [min(solute_output.values),
                                                 max(solute_output.values)]
     return self.min_max_concns
 def find_domain_dimensions(self):
     """
     TODO Do this via the protocol file.
     """
     env0 = self.get_single_iterate(0).env_output
     name = env0.get_solute_names()[0]
     sol0 = toolbox_results.SoluteOutput(env0, name)
     return sol0.grid_nI, sol0.grid_nJ, sol0.grid_nK, sol0.grid_res
     '''
def plot(iter_info, min_max_concns):
    axis = figure.add_subplot('', 111, frameon=options.frameon)
    toolbox_idynomics.color_cells_by_species(iter_info.agent_output,
                                             species_color_dict)
    toolbox_idynomics.plot_cells_2d(axis, iter_info.agent_output)
    if options.substratum:
        axis.fill_between([0, nJ * res], [0] * 2,
                          y2=[-res] * 2,
                          color='k',
                          zorder=-1)
    lb = 0.01
    if options.frameon:
        lb = 0.06
        figure.process_lines()
    figure.subplots_adjust(left=lb, bottom=lb, right=0.9, top=0.9)
    figure.inset_axes()
    if not options.solute_name == "none":
        #print min_max_concns[options.solute_name]
        solute_output = toolbox_results.SoluteOutput(iter_info.env_output,
                                                     name=options.solute_name)
        cs = toolbox_idynomics.solute_contour(
            axis,
            solute_output,
            concn_range=min_max_concns[options.solute_name],
            interpolation='bicubic')
        if options.color_bar:
            toolbox_plotting.make_colorbar(axis, cs)
    if options.titleon:
        axis.set_title(r'Biofilm (%s g L$^{-1}$)' % (options.solute_name))
    if options.frameon:
        axis.set_xlabel(r'x ($\mu$m)')
        axis.set_ylabel(r'y ($\mu$m)')
    if options.timeon:
        axis.text(0.1 * res, (nI + 0.1) * res,
                  'Time: %d h' % (int(iter_info.time)),
                  va='bottom',
                  ha='left',
                  color='0.5')
    axis.set_xlim(0, nJ * res)
    axis.set_ylim(-res, nI * res)
    save_num = str(iter_info.number)
    #save_num = str(counter)
    #counter += 1
    save_num = (num_digits - len(save_num)) * '0' + save_num
    save_path = os.path.join(sim.figures_dir,
                             save_name + '_' + save_num + options.file_ext)
    figure.save(save_path, dpi=options.dpi)