Beispiel #1
0
 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
Beispiel #2
0
 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
Beispiel #3
0
 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))
Beispiel #4
0
    def test_json_config(self):
        from sciunit.utils import config_get, create_config, DEFAULT_CONFIG

        from pathlib import Path
        config_path = Path.home() / ".sciunit" / "config.json"
        create_config(DEFAULT_CONFIG)

        self.assertTrue(config_path.is_file())
        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))
Beispiel #5
0
    def value_color(cls, value: Union[float, 'Score']) -> tuple:
        """Get a RGB color based on the Score.

        Args:
            value (Union[float,): [description]

        Returns:
            tuple: [description]
        """
        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
from neuronunit.optimization.optimization_management import (
    dtc_to_rheo,
    inject_and_plot_model,
)
import numpy as np
from neuronunit.optimization.data_transport_container import DataTC as GenericModel
from jithub.models import model_classes
import matplotlib.pyplot as plt
import quantities as qt
import os

from sciunit.scores import RelativeDifferenceScore, ZScore
from sciunit.utils import config_set, config_get

config_set("PREVALIDATE", False)
assert config_get("PREVALIDATE") is False


class testOptimizationAllenMultiSpike(unittest.TestCase):
    def setUp(self):
        self = self
        # In principle any index into data should work
        # but '1' is chosen here. Robust tests would use any index.
        self.ids = [
            324257146,
            325479788,
            476053392,
            623893177,
            623960880,
            482493761,
            471819401,