コード例 #1
0
ファイル: test_utils.py プロジェクト: telegraphic/CMasher
 def test_cmap_file_jscm(self):
     cmap_path = path.join(dirpath, 'data/cm_rainforest_jscm.jscm')
     if PY2:
         with pytest.raises(ValueError):
             import_cmaps(cmap_path)
     else:
         import_cmaps(cmap_path)
コード例 #2
0
 def test_cyclic_cmap(self):
     name = 'cyclic'
     import_cmaps(path.join(dirpath, 'data/cm_{0}.txt'.format(name)))
     for cmap in [name, name+'_r', name+'_shifted', name+'_shifted_r']:
         assert 'cmr.'+cmap in plt.colormaps()
         assert getattr(cmrcm, cmap, None) is not None
         assert cmap in cmrcm.cmap_d
         assert cmap in cmrcm.cmap_cd['cyclic']
コード例 #3
0
ファイル: test_utils.py プロジェクト: telegraphic/CMasher
 def test_cyclic_cmap(self):
     name = 'cyclic'
     import_cmaps(path.join(dirpath, 'data/cm_{0}.txt'.format(name)))
     for cmap in [
             name, name + '_r', name + '_shifted', name + '_shifted_r'
     ]:
         assert 'cmr.' + cmap in mplcm.cmap_d
         assert cmap in cmrcm.cmap_d
         assert cmap in cmrcm.cmap_cd['cyclic']
コード例 #4
0
 def test_invalid_cmap_npy_file(self):
     with pytest.raises(ValueError):
         import_cmaps(path.join(dirpath, 'data/cm_test2.npy'))
コード例 #5
0
 def test_invalid_cmap_file(self):
     with pytest.raises(OSError):
         import_cmaps(path.join(dirpath, 'data/test.txt'))
コード例 #6
0
 def test_non_existing_dir(self):
     with pytest.raises(OSError):
         import_cmaps('./test')
コード例 #7
0
 def test_cmap_file_txt(self):
     import_cmaps(path.join(dirpath, '../colormaps/cm_rainforest.txt'))
コード例 #8
0
 def test_invalid_cmap_dir(self):
     with pytest.raises(ValueError):
         import_cmaps(path.join(dirpath, 'data'))
コード例 #9
0
ファイル: prep_cmap_data.py プロジェクト: arokem/CMasher
    ax.xaxis.set_visible(False)
    ax.yaxis.set_visible(False)
    plt.savefig("{0}/{0}.png".format(name),
                dpi=200,
                bbox_inches='tight',
                pad_inches=0)
    plt.close(fig)

    # Create txt-file with colormap data
    np.savetxt("cm_{0}.txt".format(name), cmap_mod.cm_data)

    # Delete the created __pycache__ in the loaded cmap module
    shutil.rmtree("{0}/__pycache__".format(name), ignore_errors=True)

    # Load in all colormaps currently defined
    import_cmaps('.')

    # Make new colormap overview
    create_cmap_overview(savefig='cmap_overview.png')

    # Make string with the docs entry and print it
    docs_entry = dedent("""
        {0}
        {2}
        .. figure:: ../../../cmasher/colormaps/{1}/{1}.png
            :alt: Visual representation of the *{1}* colormap.
            :width: 100%
            :align: center
            :name: {1}_cmap

        .. figure:: ../../../cmasher/colormaps/{1}/{1}_viscm.png
コード例 #10
0
 def test_cmap_file_jscm(self):
     cmap_path = path.join(dirpath, 'data/cm_rainforest_jscm.jscm')
     import_cmaps(cmap_path)
コード例 #11
0
 def test_cmap_file_HEX(self):
     import_cmaps(path.join(dirpath, 'data/cm_hex.txt'))
コード例 #12
0
 def test_cmap_file_8bit(self):
     import_cmaps(path.join(dirpath, 'data/cm_8bit.txt'))