コード例 #1
0
 def plot_results(self, results, agent, obs_name, thresh=50):
     plt.figure()
     plt.ion()
     max_val_lim = max(
         max((numpy.max(results[0][1][obs_name]) +
              0.25 * numpy.max(results[0][1][obs_name])), 101.0), thresh)
     max_time = max([result[0][-1] for result in results])
     lr = matplotlib.patches.Rectangle((0, 0),
                                       max_time,
                                       thresh,
                                       color='red',
                                       alpha=0.1)
     hr = matplotlib.patches.Rectangle((0, thresh),
                                       max_time,
                                       max_val_lim - thresh,
                                       color='green',
                                       alpha=0.1)
     ax = plt.gca()
     ax.add_patch(lr)
     ax.add_patch(hr)
     if thresh + 0.05 * max_val_lim < max_val_lim:
         plt.text(10, thresh + 0.05 * max_val_lim, 'High', fontsize=10)
     plt.text(10, thresh - 0.05 * max_val_lim, 'Low')
     for tspan, yobs in results:
         plt.plot(tspan, yobs[obs_name])
     plt.ylim(-5, max_val_lim)
     plt.xlim(-100, 10100)
     plt.xlabel('Time (s)')
     plt.ylabel('Amount (molecules)')
     agent_str = english_assembler._assemble_agent_str(agent).agent_str
     plt.title('Simulation results for %s' % agent_str)
     fig_path = get_img_path(obs_name + '.png')
     plt.savefig(fig_path)
     return fig_path
コード例 #2
0
ファイル: tra.py プロジェクト: bgyori/bioagents
 def plot_results(self, results, agent, obs_name, thresh=50):
     plt.figure()
     plt.ion()
     max_val_lim = max(max(numpy.max(results[0][1][obs_name]), 101.0),
                       thresh)
     max_time = max([result[0][-1] for result in results])
     lr = matplotlib.patches.Rectangle((0, 0), max_time, thresh, color='red',
                                       alpha=0.1)
     hr = matplotlib.patches.Rectangle((0, thresh), max_time,
                                       max_val_lim-thresh,
                                       color='green', alpha=0.1)
     ax = plt.gca()
     ax.add_patch(lr)
     ax.add_patch(hr)
     if thresh + 5 < max_val_lim:
         plt.text(10, thresh + 5, 'High', fontsize=10)
     plt.text(10, thresh - 5, 'Low')
     for tspan, yobs in results:
         plt.plot(tspan, yobs[obs_name])
     plt.ylim(-1, max_val_lim)
     plt.xlim(-100, 10100)
     plt.xlabel('Time (s)')
     plt.ylabel('Amount (molecules)')
     agent_str = english_assembler._assemble_agent_str(agent)
     plt.title('Simulation results for %s' % agent_str)
     fig_path = get_img_path(obs_name + '.png')
     plt.savefig(fig_path)
     return fig_path
コード例 #3
0
 def report_paths_graph(self, paths_list):
     from indra.assemblers.graph import GraphAssembler
     from indra.util import flatten
     path_stmts = [stmts_from_json(l) for l in paths_list]
     all_stmts = flatten(path_stmts)
     ga = GraphAssembler(all_stmts)
     ga.make_model()
     resource = get_img_path('qca_paths.png')
     ga.save_pdf(resource)
     content = KQMLList('display-image')
     content.set('type', 'simulation')
     content.sets('path', resource)
     self.tell(content)
コード例 #4
0
 def plot_compare_conditions(self, ts, results, agent, obs_name):
     plt.figure()
     plt.ion()
     plt.plot(ts, results[0][:len(ts)], label='Without condition')
     plt.plot(ts, results[-1][:len(ts)], label='With condition')
     plt.xlabel('Time (s)')
     plt.ylabel('Amount (molecules)')
     agent_str = english_assembler._assemble_agent_str(agent).agent_str
     plt.title('Simulation results for %s' % agent_str)
     plt.legend()
     fig_path = get_img_path(obs_name + '.png')
     plt.savefig(fig_path)
     return fig_path
コード例 #5
0
ファイル: tra.py プロジェクト: bgyori/bioagents
 def plot_compare_conditions(self, ts, results, agent, obs_name):
     plt.figure()
     plt.ion()
     plt.plot(ts, results[0][:len(ts)], label='Without condition')
     plt.plot(ts, results[-1][:len(ts)], label='With condition')
     plt.xlabel('Time (s)')
     plt.ylabel('Amount (molecules)')
     agent_str = english_assembler._assemble_agent_str(agent)
     plt.title('Simulation results for %s' % agent_str)
     plt.legend()
     fig_path = get_img_path(obs_name + '.png')
     plt.savefig(fig_path)
     return fig_path
コード例 #6
0
ファイル: qca_module.py プロジェクト: bgyori/bioagents
 def report_paths_graph(self, paths_list):
     from indra.assemblers.graph import GraphAssembler
     from indra.util import flatten
     path_stmts = [stmts_from_json(l) for l in paths_list]
     all_stmts = flatten(path_stmts)
     ga = GraphAssembler(all_stmts)
     ga.make_model()
     resource = get_img_path('qca_paths.png')
     ga.save_pdf(resource)
     content = KQMLList('display-image')
     content.set('type', 'simulation')
     content.sets('path', resource)
     self.tell(content)
コード例 #7
0
ファイル: mra.py プロジェクト: bgyori/bioagents
def make_pic_name(model_id, token):
    """Create a standardized picture name."""
    s = 'model%d_%s' % (model_id, token)
    return get_img_path(s)
コード例 #8
0
def make_pic_name(model_id, token):
    """Create a standardized picture name."""
    s = 'model%d_%s' % (model_id, token)
    return get_img_path(s)