Esempio n. 1
0
 def test_save_as_json(self):
     """
     Tests save ColorMap as json file
     """
     cmap = ColorMap('mpl:{}'.format(self.default_mpl_cm))
     cmap.show()
     output_path = os.path.join(self.output_path, 'json_test.json')
     cmap.save_as_json(output_path)
     cmap_read = ColorMap.from_jsonfile(output_path)
     cmap_read.show()
     self.assertIsInstance(cmap_read, ColorMap)
Esempio n. 2
0
 def test_save_as_ct(self):
     """
     Tests save ColorMap as ct file
     """
     cmap = ColorMap('mpl:{}'.format(self.default_mpl_cm))
     cmap.show()
     output_path = os.path.join(self.output_path, 'ct_test.ct')
     cmap.save_as_ct(output_path)
     if isinstance(cmap._mpl_cm, col.LinearSegmentedColormap):
         cmap_read = ColorMap.from_file(output_path, gradient=True)
     if isinstance(cmap._mpl_cm, col.ListedColormap):
         cmap_read = ColorMap.from_file(output_path, gradient=False)
     cmap_read.show()
     self.assertIsInstance(cmap_read, ColorMap)
Esempio n. 3
0
 def test_view(self):
     """
     Tests ploting the ColorMap
     """
     cmap = ColorMap('mpl:{}'.format(self.default_mpl_cm))
     cmap.show()