Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_json_config(self):
from sciunit.utils import config_get
config_path = os.path.join(sciunit.__path__[0], "config.json")
print(config_path)
self.assertTrue(os.path.isfile(config_path))
cmap_low = config_get("cmap_low")
self.assertTrue(isinstance(cmap_low, int))
dummy = config_get("dummy", 37)
self.assertEqual(dummy, 37)
try:
config_get("dummy")
except sciunit.Error as e:
self.assertTrue("does not contain key" in str(e))
def test_json_config(self):
from sciunit.utils import config_get
config_path = os.path.join(sciunit.__path__[0],'config.json')
print(config_path)
self.assertTrue(os.path.isfile(config_path))
cmap_low = config_get('cmap_low')
self.assertTrue(isinstance(cmap_low,int))
dummy = config_get('dummy',37)
self.assertEqual(dummy,37)
try:
config_get('dummy')
except sciunit.Error as e:
self.assertTrue('does not contain key' in str(e))
def test_json_config(self):
from sciunit.utils import config_get
config_path = os.path.join(sciunit.__path__[0],'config.json')
print(config_path)
self.assertTrue(os.path.isfile(config_path))
cmap_low = config_get('cmap_low')
self.assertTrue(isinstance(cmap_low,int))
dummy = config_get('dummy',37)
self.assertEqual(dummy,37)
try:
config_get('dummy')
except sciunit.Error as e:
self.assertTrue('does not contain key' in str(e))
def test_json_config(self):
from sciunit.utils import config_get
config_path = os.path.join(sciunit.__path__[0], "config.json")
print(config_path)
self.assertTrue(os.path.isfile(config_path))
cmap_low = config_get("cmap_low")
self.assertTrue(isinstance(cmap_low, int))
dummy = config_get("dummy", 37)
self.assertEqual(dummy, 37)
try:
config_get("dummy")
except sciunit.Error as e:
self.assertTrue("does not contain key" in str(e))
def test_json_config(self):
from sciunit.utils import config_get
config_path = os.path.join(sciunit.__path__[0],'config.json')
print(config_path)
self.assertTrue(os.path.isfile(config_path))
cmap_low = config_get('cmap_low')
self.assertTrue(isinstance(cmap_low,int))
dummy = config_get('dummy',37)
self.assertEqual(dummy,37)
try:
config_get('dummy')
except sciunit.Error as e:
self.assertTrue('does not contain key' in str(e))
def test_json_config(self):
from sciunit.utils import config_get
config_path = os.path.join(sciunit.__path__[0], "config.json")
print(config_path)
self.assertTrue(os.path.isfile(config_path))
cmap_low = config_get("cmap_low")
self.assertTrue(isinstance(cmap_low, int))
dummy = config_get("dummy", 37)
self.assertEqual(dummy, 37)
try:
config_get("dummy")
except sciunit.Error as e:
self.assertTrue("does not contain key" in str(e))
def value_color(cls, value):
import matplotlib.cm as cm
if value is None or np.isnan(value):
rgb = (128, 128, 128)
else:
cmap_low = config_get('cmap_low', 38)
cmap_high = config_get('cmap_high', 218)
cmap_range = cmap_high - cmap_low
cmap = cm.RdYlGn(int(cmap_range*value+cmap_low))[:3]
rgb = tuple([x*256 for x in cmap])
return rgb
def value_color(cls, value):
import matplotlib.cm as cm
if value is None or np.isnan(value):
rgb = (128, 128, 128)
else:
cmap_low = config_get('cmap_low', 38)
cmap_high = config_get('cmap_high', 218)
cmap_range = cmap_high - cmap_low
cmap = cm.RdYlGn(int(cmap_range*value+cmap_low))[:3]
rgb = tuple([x*256 for x in cmap])
return rgb