Exemplo n.º 1
0
def test_plot_fleur_mulitple_invalid_node(read_dict_from_file):
    """
    Test that plot_fleur raises for non-workchain nodes
    """

    aiida_path = os.path.dirname(aiida_fleur.__file__)
    out_node_path = os.path.join(aiida_path, '../tests/files/jsons/fleur_outputpara.json')

    fleur_outputnode = orm.Dict(dict=read_dict_from_file(out_node_path), label='output_para')
    with pytest.warns(UserWarning, match=r'Sorry, I do not know how to visualize'):
        plot_fleur([fleur_outputnode, fleur_outputnode], show=False)
Exemplo n.º 2
0
def test_plot_fleur_multiple_eos_wc_bokeh(read_dict_from_file, check_bokeh_plot):
    """
    Test of visualization of single SCF workchain with bokeh
    """
    pytest.importorskip('bokeh')

    aiida_path = os.path.dirname(aiida_fleur.__file__)
    out_node_eos_path = os.path.join(aiida_path, '../tests/files/jsons/fleur_output_eos_wc_para.json')

    eos_output = orm.Dict(dict=read_dict_from_file(out_node_eos_path), label='output_eos_wc_para')

    p_eos = plot_fleur([eos_output, eos_output], show=False, backend='bokeh')
    assert isinstance(p_eos, list)

    check_bokeh_plot(p_eos[0])
Exemplo n.º 3
0
def test_plot_fleur_single_scf_wc_matplotlib(read_dict_from_file):
    """
    Test of visualization of single SCF workchain with matplotlib
    """

    aiida_path = os.path.dirname(aiida_fleur.__file__)
    out_node_scf_path = os.path.join(aiida_path, '../tests/files/jsons/fleur_output_scf_wc_para.json')

    plt.gcf().clear()

    scf_output = orm.Dict(dict=read_dict_from_file(out_node_scf_path), label='output_scf_wc_para')

    p_scf = plot_fleur(scf_output, show=False)
    assert isinstance(p_scf, list)

    return plt.gcf()
Exemplo n.º 4
0
def test_plot_fleur_multiple_scf_wc_bokeh(read_dict_from_file, check_bokeh_plot):
    """
    Test of visualization of single SCF workchain with bokeh
    """
    pytest.importorskip('bokeh')
    from bokeh.layouts import gridplot  # pylint: disable=import-error

    aiida_path = os.path.dirname(aiida_fleur.__file__)
    out_node_scf_path = os.path.join(aiida_path, '../tests/files/jsons/fleur_output_scf_wc_para.json')

    scf_output = orm.Dict(dict=read_dict_from_file(out_node_scf_path), label='output_scf_wc_para')

    p_scf = plot_fleur([scf_output, scf_output], show=False, backend='bokeh')
    assert isinstance(p_scf, list)

    grid = gridplot(p_scf[0], ncols=1)

    check_bokeh_plot(grid)
Exemplo n.º 5
0
def test_plot_fleur_multiple_scf_wc_matplotlib(read_dict_from_file):
    """
    Test of visualization of single SCF workchain with matplotlib
    """

    aiida_path = os.path.dirname(aiida_fleur.__file__)
    out_node_scf_path = os.path.join(aiida_path, '../tests/files/jsons/fleur_output_scf_wc_para.json')

    plt.gcf().clear()

    scf_output = orm.Dict(dict=read_dict_from_file(out_node_scf_path), label='output_scf_wc_para')

    fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(16, 6))

    p_scf = plot_fleur([scf_output, scf_output], show=False, axis_energy=ax1, axis_distance=ax2)
    assert isinstance(p_scf, list)

    return fig