pymks/tools.py
def draw_microstructure_strain(microstructure, strain):
    """
    Draw microstructure and its associated strain

    Args:
        microstructure (2D array): numpy array with dimensions (x, y)
        strain (2D array): numpy array with dimensions (x, y)
    """
    plt.close('all')
    cmap = _get_response_cmap()
    fig = plt.figure(figsize=(8, 4))
    ax0 = plt.subplot(1, 2, 1)
    ax0.imshow(microstructure.swapaxes(0, 1), cmap=_get_microstructure_cmap(),
               interpolation='none')
    ax0.set_xticks(())
    ax0.set_yticks(())
    ax1 = plt.subplot(1, 2, 2)
    im1 = ax1.imshow(strain.swapaxes(0, 1), cmap=cmap, interpolation='none')
    ax1.set_xticks(())
    ax1.set_yticks(())
    ax1.set_title(r'$\mathbf{\varepsilon_{xx}}$', fontsize=25)
    ax0.set_title('Microstructure', fontsize=20)
    fig.subplots_adjust(right=0.8)
    cbar_ax = fig.add_axes([1.0, 0.05, 0.05, 0.9])
    fig.colorbar(im1, cax=cbar_ax)
    plt.tight_layout()
    plt.show()

    Draw microstructure and its associated strain

    Args:
        microstructure (2D array): numpy array with dimensions (x, y)
        strain (2D array): numpy array with dimensions (x, y)
    
Draw microstructure and its associated strain
Draw microstructure and its associated strain
def draw_microstructure_strain(microstructure, strain):
    plt.close('all')
    cmap = _get_response_cmap()
    fig = plt.figure(figsize=(8, 4))
    ax0 = plt.subplot(1, 2, 1)
    ax0.imshow(microstructure.swapaxes(0, 1), cmap=_get_microstructure_cmap(),
               interpolation='none')
    ax0.set_xticks(())
    ax0.set_yticks(())
    ax1 = plt.subplot(1, 2, 2)
    im1 = ax1.imshow(strain.swapaxes(0, 1), cmap=cmap, interpolation='none')
    ax1.set_xticks(())
    ax1.set_yticks(())
    ax1.set_title(r'$\mathbf{\varepsilon_{xx}}$', fontsize=25)
    ax0.set_title('Microstructure', fontsize=20)
    fig.subplots_adjust(right=0.8)
    cbar_ax = fig.add_axes([1.0, 0.05, 0.05, 0.9])
    fig.colorbar(im1, cax=cbar_ax)
    plt.tight_layout()
    plt.show()
def draw_microstructure_strain ( microstructure , strain ) : plt . close ( 'all' ) cmap = _get_response_cmap ( ) fig = plt . figure ( figsize = ( 8 , 4 ) ) ax0 = plt . subplot ( 1 , 2 , 1 ) ax0 . imshow ( microstructure . swapaxes ( 0 , 1 ) , cmap = _get_microstructure_cmap ( ) , interpolation = 'none' ) ax0 . set_xticks ( ( ) ) ax0 . set_yticks ( ( ) ) ax1 = plt . subplot ( 1 , 2 , 2 ) im1 = ax1 . imshow ( strain . swapaxes ( 0 , 1 ) , cmap = cmap , interpolation = 'none' ) ax1 . set_xticks ( ( ) ) ax1 . set_yticks ( ( ) ) ax1 . set_title ( r'$\mathbf{\varepsilon_{xx}}$' , fontsize = 25 ) ax0 . set_title ( 'Microstructure' , fontsize = 20 ) fig . subplots_adjust ( right = 0.8 ) cbar_ax = fig . add_axes ( [ 1.0 , 0.05 , 0.05 , 0.9 ] ) fig . colorbar ( im1 , cax = cbar_ax ) plt . tight_layout ( ) plt . show ( )
Draw microstructure and its associated strain
Draw microstructure and its associated strain
"""
    Draw microstructure and its associated strain

    Args:
        microstructure (2D array): numpy array with dimensions (x, y)
        strain (2D array): numpy array with dimensions (x, y)
    """
microstructure
numpy array with dimensions (x, y)
numpy array with dimensions ( x y )
strain
numpy array with dimensions (x, y)
numpy array with dimensions ( x y )