Esempio n. 1
0
#For future compatibility with Python 3
from __future__ import division, print_function, unicode_literals, absolute_import
import warnings

warnings.simplefilter('default', DeprecationWarning)

import sys
import crowTestUtils as utils

distribution1D = utils.findCrowModule('distribution1D')

geometric_distribution = distribution1D.BasicGeometricDistribution(0.25)

results = {"pass": 0, "fail": 0}

utils.checkAnswer("geometric cdf(0)", geometric_distribution.cdf(0), 0.25,
                  results)
utils.checkAnswer("geometric cdf(1)", geometric_distribution.cdf(1), 0.4375,
                  results)
utils.checkAnswer("geometric mean", geometric_distribution.untrMean(), 3.0,
                  results)
utils.checkAnswer("geometric stddev", geometric_distribution.untrStdDev(),
                  3.46410161514, results)

utils.checkAnswer("geometric ppf(0.1)", geometric_distribution.inverseCdf(0.1),
                  0.0, results)
utils.checkAnswer("geometric ppf(0.3)", geometric_distribution.inverseCdf(0.3),
                  0.239823326142, results)
utils.checkAnswer("geometric ppf(0.8)", geometric_distribution.inverseCdf(0.8),
                  4.59450194, results)
utils.checkAnswer("geometric ppf(0.9)", geometric_distribution.inverseCdf(0.9),
Esempio n. 2
0
# Copyright 2017 Battelle Energy Alliance, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import crowTestUtils as utils

distribution1D = utils.findCrowModule('distribution1D')
interpolationND = utils.findCrowModule('interpolationND')
randomENG = utils.findCrowModule('randomENG')
"""
 <TestInfo>
    <name>crow.test_utils</name>
    <author>cogljj</author>
    <created>2017-03-24</created>
    <classesTested>crow</classesTested>
    <description>
      This test is a Unit Test for the crow swig classes. It tests that the
      classes that are swigged in CROW are accessable by Python
    </description>
    <revisions>
      <revision author="alfoa" date="2018-05-15">Adding this test description.</revision>
    </revisions>