Esempio n. 1
0
def print_tensions(exp_organo, th_organo, to_save=False, path=None):
    """Print the tensions of an experimental organoid and the theoritical
    organoid on the same plot and save it in a PNG image.

    Parameters
    ----------
    exp_organo : class AnnularSheet
      the experimental organoid whose tensions will be ploted
    th_organo : class AnnularSheet
      the theoritical organoid which will be ploted behind exp_organo tensions
    to_save : bool
      if True the plot must be saved
    path : string
     path to the saved image.
    Returns
    ----------
    """
    draw_specs = sheet_spec()
    tension_max = np.max(exp_organo.edge_df.line_tension.values.copy())
    edge_color = 1/tension_max*exp_organo.edge_df.line_tension.values.copy()
    cmap = plt.cm.get_cmap('viridis')
    edge_cmap = cmap(edge_color)
    draw_specs['vert']['visible'] = False
    draw_specs['edge']['color'] = edge_cmap
    draw_specs['edge']['width'] = 0.25+3*edge_color
    fig, ax = quick_edge_draw(th_organo, lw=5, c='k', alpha=0.2)
    fig, ax = sheet_view(exp_organo, ax=ax, **draw_specs)
    fig.set_size_inches(12, 12)
    plt.xlabel('Size in µm')
    plt.ylabel('Size in µm')
    if to_save:
        plt.savefig(path)
Esempio n. 2
0
def three_axis_sheet_view(sheet, face_mask=None):
    """
    plot 3 view of the sheet :
    * ventral view
    * sagittal view
    * lateral view

    Parameters
    ----------
    sheet : a :class:`tyssue.sheet` object
    face_mask : string
    """

    if face_mask is not None:
        sheet_mesoderm = sheet.extract(face_mask)
    else:
        sheet_mesoderm = sheet

    edge_specs = {'alpha': 0.6,
                  'lw': 0.1,
                  'color': 'black'}
    scatter_specs = {'alpha': 0.8,
                     'ms': 5,
                     'color': 'red'}

    plt.figure(figsize=(18.5, 10.5))
    grid = gridspec.GridSpec(2, 2)
    axes_1 = plt.subplot(grid[0, 0])
    axes_2 = plt.subplot(grid[1, 0])
    axes_3 = plt.subplot(grid[:, 1])

    coord_pairs = [('z', 'y'), ('z', 'x'), ('x', 'y')]
    titles = ['lateral view', 'ventral view', 'sagittal view']
    axes = [axes_1, axes_2, axes_3]

    for coords, title, ax in zip(coord_pairs, titles, axes):
        u, v = coords
        fig, ax = quick_edge_draw(sheet,
                                  coords=coords,
                                  ax=ax,
                                  **edge_specs)

        ax.plot(sheet_mesoderm.face_df[u],
                sheet_mesoderm.face_df[v],
                'o', **scatter_specs)

        ax.set_title(title)
        ax.set_xlabel(u)
        ax.set_ylabel(v)
    return fig, axes
Esempio n. 3
0
def print_tensions(exp_organo, th_organo):
    draw_specs = sheet_spec()
    tension_max = np.max(exp_organo.edge_df.line_tension.values.copy())
    edge_color = 1 / tension_max * exp_organo.edge_df.line_tension.values.copy(
    )
    cmap = plt.cm.get_cmap('viridis')
    edge_cmap = cmap(edge_color)
    draw_specs['vert']['visible'] = False
    draw_specs['edge']['color'] = edge_cmap
    draw_specs['edge']['width'] = 0.25 + 3 * edge_color
    fig, ax = quick_edge_draw(th_organo, lw=5, c='k', alpha=0.2)
    fig, ax = sheet_view(exp_organo, ax=ax, **draw_specs)
    fig.set_size_inches(12, 12)
    plt.xlabel('Size in µm')
    plt.ylabel('Size in µm')
Esempio n. 4
0
def mesoderm_position(sheet, mesoderm_cells):
    """
    Plot two pannel view of the sheet and
    the position of the mesoderm cells
    """

    fig, axes = plt.subplots(1, 2, sharey=True)

    fig, ax = quick_edge_draw(sheet, ['z', 'x'],
                              ax=axes[0],
                              alpha=0.7)
    ax.plot(sheet.face_df.loc[mesoderm_cells, 'z'],
            sheet.face_df.loc[mesoderm_cells, 'x'],
            'o', alpha=0.8, ms=5)

    fig, ax = quick_edge_draw(sheet, ['y', 'x'],
                              ax=axes[1],
                              alpha=0.7)
    ax.plot(sheet.face_df.loc[mesoderm_cells, 'y'],
            sheet.face_df.loc[mesoderm_cells, 'x'],
            'o', alpha=0.8, ms=5)

    fig.set_size_inches(24, 6)
    return fig, axes
Esempio n. 5
0
    def test_quick_edge_draw(self):

        fig, ax = quick_edge_draw(self.sheet)
        assert ax.lines[0].get_xydata().shape == (54, 2)
Esempio n. 6
0
def test_quick_edge_draw():
    sheet = Sheet("test", *three_faces_sheet())
    fig, ax = quick_edge_draw(sheet)
    assert ax.lines[0].get_xydata().shape == (54, 2)