How to use the sciunit.tests.RangeTest function in sciunit

To help you get started, we’ve selected a few sciunit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github scidash / sciunit / sciunit / unit_test / test_tests.py View on Github external
def test_rangetest(self):
        range_2_3_test = RangeTest(observation=[2, 3])
        one_model = ConstModel(2.5)
        self.assertTrue(range_2_3_test.check_capabilities(one_model))
        score = range_2_3_test.judge(one_model)
        self.assertTrue(isinstance(score, BooleanScore))
        self.assertEqual(score.score,True)
        self.assertTrue(score.test is range_2_3_test)
        self.assertTrue(score.model is one_model)
github scidash / sciunit / sciunit / unit_test / core_tests.py View on Github external
def test_rangetest(self):
        from sciunit.tests import RangeTest
        range_2_3_test = RangeTest(observation=[2,3])
        one_model = sciunit.models.ConstModel(2.5)
        self.assertTrue(range_2_3_test.check_capabilities(one_model))
        score = range_2_3_test.judge(one_model)
        self.assertTrue(isinstance(score, sciunit.scores.BooleanScore))
        self.assertEqual(score.score,True)
        self.assertTrue(score.test is range_2_3_test)
        self.assertTrue(score.model is one_model)
github scidash / sciunit / sciunit / unit_test / core_tests.py View on Github external
def test_regular_score_types(self):
        from sciunit.scores import BooleanScore,FloatScore,RatioScore,\
                                   ZScore,CohenDScore,PercentScore
        from sciunit.tests import RangeTest
        
        BooleanScore(True)
        BooleanScore(False)
        score = BooleanScore.compute(5,5)
        self.assertEqual(score.sort_key,1)
        score = BooleanScore.compute(4,5)
        self.assertEqual(score.sort_key,0)
        
        t = RangeTest([2,3])
        score.test = t
        score.describe()
        score.description = "Lorem Ipsum"
        score.describe()

        score = FloatScore(3.14)
        obs = np.array([1.0,2.0,3.0])
        pred = np.array([1.0,2.0,4.0])
        score = FloatScore.compute_ssd(obs,pred)
        self.assertEqual(score.score,1.0)
        
        RatioScore(1.2)
        score = RatioScore.compute({'mean':4.,'std':1.},{'value':2.})
        self.assertEqual(score.score,0.5)

        score = PercentScore(42)
github scidash / sciunit / sciunit / unit_test / model_tests.py View on Github external
def test_check_model_capabilities(self):
        from sciunit.tests import RangeTest
        t = RangeTest([2,3])
        m = self.M(2,3)
        t.check(m)
github scidash / sciunit / sciunit / unit_test / base.py View on Github external
def setUp(self):
        from sciunit.models.examples import UniformModel
        from sciunit.tests import RangeTest
        self.M = UniformModel
        self.T = RangeTest
github scidash / sciunit / sciunit / unit_test / score_tests.py View on Github external
def test_regular_score_types_2(self):
        BooleanScore(True)
        BooleanScore(False)
        score = BooleanScore.compute(5, 5)
        self.assertEqual(score.norm_score, 1)
        score = BooleanScore.compute(4, 5)
        self.assertEqual(score.norm_score, 0)

        t = RangeTest([2, 3])
        score.test = t
        score.describe()
        score.description = "Lorem Ipsum"
        score.describe()

        score = FloatScore(3.14)
        obs = np.array([1.0, 2.0, 3.0])
        pred = np.array([1.0, 2.0, 4.0])
        score = FloatScore.compute_ssd(obs, pred)
        self.assertEqual(score.score, 1.0)

        RatioScore(1.2)
        score = RatioScore.compute({'mean': 4., 'std': 1.}, {'value': 2.})
        self.assertEqual(score.score, 0.5)
github scidash / sciunit / sciunit / tests.py View on Github external
def __init__(self, observation, name=None):
        super(RangeTest, self).__init__(observation, name=name)
github scidash / sciunit / sciunit / unit_test / core_tests.py View on Github external
def setUp(self):
        from sciunit.tests import RangeTest
        from sciunit.models import UniformModel
        self.M = UniformModel
        self.T = RangeTest
github scidash / sciunit / sciunit / unit_test / test_tests.py View on Github external
def setUp(self):
        self.M = UniformModel
        self.T = RangeTest