Commit e85b3331 authored by Jérome Perrin's avatar Jérome Perrin

replace the use of scipy by rpy2

parent 44c31d9a
......@@ -33,7 +33,6 @@ import xlwt
import xlrd
from random import Random, expovariate, gammavariate, normalvariate
from SimPy.Simulation import now
import scipy.stats as stat
# ===========================================================================
# globals
......@@ -257,7 +256,7 @@ def countQueueMetrics(argumentDict={}):
# =======================================================================
# Helper function to calculate the min, max and average values of a serie
# Helper function to calculate the confidence intervals of a serie.
# =======================================================================
def getConfidenceIntervals(value_list):
from Globals import G
......@@ -266,8 +265,10 @@ def getConfidenceIntervals(value_list):
return { 'lb': value_list[0],
'ub': value_list[0],
'avg': value_list[0], }
bayes_mvs = stat.bayes_mvs(value_list, G.confidenceLevel)
return { 'lb': bayes_mvs[0][1][0],
'ub': bayes_mvs[0][1][1],
'avg': bayes_mvs[0][0], }
from dream.KnowledgeExtraction.ConfidenceIntervals import Intervals
import numpy
lb, ub = Intervals().ConfidIntervals(value_list, G.confidenceLevel)
return {'lb': lb,
'ub': ub,
'avg': numpy.mean(value_list) }
......@@ -30,25 +30,6 @@ import logging
logger = logging.getLogger("dream.platform")
try:
import scipy
except ImportError:
class scipy:
class stats:
@staticmethod
def bayes_mvs(*args, **kw):
warn("Scipy is missing, using fake implementation")
serie, confidence = args
import numpy
mean = numpy.mean(serie), (numpy.min(serie), numpy.max(serie))
var = 0, (0, 0)
std = 0, (0, 0)
return mean, var, std
import sys
sys.modules['scipy.stats'] = scipy.stats
sys.modules['scipy'] = scipy
logger.error("Scipy cannot be imported, using dummy implementation")
from SimPy.Simulation import activate, initialize, simulate, now, infinity
from Globals import G
from Source import Source
......
......@@ -33,24 +33,6 @@ from warnings import warn
import logging
logger = logging.getLogger("dream.platform")
try:
import scipy
except ImportError:
class scipy:
class stats:
@staticmethod
def bayes_mvs(*args, **kw):
warn("Scipy is missing, using fake implementation")
serie, confidence = args
import numpy
mean = numpy.mean(serie), (numpy.min(serie), numpy.max(serie))
var = 0, (0, 0)
std = 0, (0, 0)
return mean, var, std
import sys
sys.modules['scipy.stats'] = scipy.stats
sys.modules['scipy'] = scipy
logger.error("Scipy cannot be imported, using dummy implementation")
# By default numpy just prints on stderr when there's an error. We do not want
# to hide errors.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment