# Path: ipet/misc/misc.py
# FLOAT_INFINITY = 1e20
# FLOAT_LARGE = 1e15
# DEFAULT_MIN_GEOM_MEAN = 1.0
#     FLOAT_INFINITY = infinity
# def sortingKeyContext(context):
# def filenameGetContext(filename):
# def getWordAtIndex(line : str, index : int) -> str:
# def getNumberAtIndex(line : str, index : int) -> str:
# def getSoluFileProbName(probname):
# def floatPrint(number, digitsbef=16, digitsafter=9, dispchar='g'):
# def getTexName(name):
# def getCplexGap(value, referencevalue):
# def getGap(value : float, referencevalue : float, useCplexGap : bool=False) -> float:
# def listGetArithmeticMean(listofnumbers):
# def iqr(listofnumbers):
# def lQuart(listofnumbers):
# def uQuart(listofnumbers):
# def shmean(listofnumbers, shiftby=10.0):
# def gemean(listofnumbers, mingeommean=DEFAULT_MIN_GEOM_MEAN):
# def listGetGeomMean(listofnumbers, mingeommean=DEFAULT_MIN_GEOM_MEAN):
# def listGetShiftedGeometricMean(listofnumbers, shiftby=10.0):
# def getVariabilityScore(listofnumbers):
# def isInfinite(value : float) -> bool:
# def getInfinity() -> float:
# def setInfinity(infinity : float):
# def cutString(string, char='_', maxlength=-1):
# def listGetMinColWidth(listofitems):
# def strConcat(strings : list) -> str:
# def meanOrConcat(l : list):
# def saveAsXML(nodeobject, filename : str) -> None:
# def convertTimeStamp(timestamp : float) -> str:
# 
# Path: ipet/misc/quick_Pandas.py
# def getWilcoxonQuotientSignificance(x, y, shiftby=10):
#     shiftedquotients = (x + shiftby) / (y + shiftby)
#     logshifted = np.log2(shiftedquotients)
# 
#     # filter elements that are too close to zero
#     logshifted = logshifted[np.abs(logshifted) >= np.log2(1 + 1e-2)]
#     if logshifted.size < 10:
#         return np.nan
#     try:
#         return stats.wilcoxon(logshifted.values)[1]
#     except ValueError:
#         return np.nan
# 
# Path: ipet/concepts/IPETNode.py
# class IpetNode(Editable):
#     """
#     A Node is an interface to an XML-like ancestor-structure
#     """
#     active = True
#     _attributes2options = {"active":[True, False]}
#     deprecatedattrdir = {}
#     
#     def __init__(self, active = True, **kw):
#         """
#         constructs a new IpetNode
# 
#         Parameters
#         ----------
#         active : True or "True" if this element should be active, False otherwise
#         """
#         self.set_active(active)
# 
#         for d, message in self.deprecatedattrdir.items():
#             if d in kw:
#                 logger.warning("Warning : The attribute '{0}' is deprecated and will be ignored; {1}. ".format(d, message))
# 
#     def addChild(self, child):
#         """
#         append a child to this node's children
#         """
#         pass
#     
#     def getChildren(self):
#         """
#         return a list of all children of this node
#         """
#         return None
#     
#     def acceptsAsChild(self, child):
#         """
#         returns whether this node accepts node 'child' as child
#         """
#         return False
#     
#     def removeChild(self, child):
#         """
#         remove the child from this node's children.
#         """
#         pass
#     
#     def isActive(self):
#         """
#         returns True if this node is currently active, False otherwise
#         """
#         return self.active
#     
#     def set_active(self, active):
#         self.active = True if active in [True, "True"] else False
# 
#     def getEditableAttributes(self):
#         """
#         returns all editable attributes
#         """
#         return ["active"]
# 
#     def getRequiredOptionsByAttribute(self, attr):
#         return self._attributes2options.get(attr)
# 
#     @staticmethod
#     def getNodeTag():
#         return "Node"


import numpy
from ipet.misc import misc
from xml.etree import ElementTree
from _functools import partial
from ipet.misc.quick_Pandas import getWilcoxonQuotientSignificance as qWilcox
from ipet.concepts import IpetNode
    def getName(self):
        if self.name is not None:
            name = self.name
        else:
            name = self.aggregation
            
        if(len(self.getEditableAttributes()) > 2):
            name += '(%s)' % ','.join((str(self.__dict__[key]) for key in self.editableattributes[2:]))
        return name

    @staticmethod
    def getPossibleAggregations():
        return Aggregation.possibleaggregations
    
    def getEditableAttributes(self):
        return self.editableattributes

    def set_aggregation(self, aggregation):
        if aggregation not in self.possibleaggregations:
            raise ValueError("%s aggregation not supported" % (aggregation))
        
        self.aggregation = aggregation
            
        self.editableattributes = self.editableattributes[:2]
        
        if aggregation is None:
            return
        try:
            self.aggrfunc = getattr(numpy, aggregation)
        except AttributeError:

# Path: ipet/misc/misc.py
# FLOAT_INFINITY = 1e20
# FLOAT_LARGE = 1e15
# DEFAULT_MIN_GEOM_MEAN = 1.0
#     FLOAT_INFINITY = infinity
# def sortingKeyContext(context):
# def filenameGetContext(filename):
# def getWordAtIndex(line : str, index : int) -> str:
# def getNumberAtIndex(line : str, index : int) -> str:
# def getSoluFileProbName(probname):
# def floatPrint(number, digitsbef=16, digitsafter=9, dispchar='g'):
# def getTexName(name):
# def getCplexGap(value, referencevalue):
# def getGap(value : float, referencevalue : float, useCplexGap : bool=False) -> float:
# def listGetArithmeticMean(listofnumbers):
# def iqr(listofnumbers):
# def lQuart(listofnumbers):
# def uQuart(listofnumbers):
# def shmean(listofnumbers, shiftby=10.0):
# def gemean(listofnumbers, mingeommean=DEFAULT_MIN_GEOM_MEAN):
# def listGetGeomMean(listofnumbers, mingeommean=DEFAULT_MIN_GEOM_MEAN):
# def listGetShiftedGeometricMean(listofnumbers, shiftby=10.0):
# def getVariabilityScore(listofnumbers):
# def isInfinite(value : float) -> bool:
# def getInfinity() -> float:
# def setInfinity(infinity : float):
# def cutString(string, char='_', maxlength=-1):
# def listGetMinColWidth(listofitems):
# def strConcat(strings : list) -> str:
# def meanOrConcat(l : list):
# def saveAsXML(nodeobject, filename : str) -> None:
# def convertTimeStamp(timestamp : float) -> str:
# 
# Path: ipet/misc/quick_Pandas.py
# def getWilcoxonQuotientSignificance(x, y, shiftby=10):
#     shiftedquotients = (x + shiftby) / (y + shiftby)
#     logshifted = np.log2(shiftedquotients)
# 
#     # filter elements that are too close to zero
#     logshifted = logshifted[np.abs(logshifted) >= np.log2(1 + 1e-2)]
#     if logshifted.size < 10:
#         return np.nan
#     try:
#         return stats.wilcoxon(logshifted.values)[1]
#     except ValueError:
#         return np.nan
# 
# Path: ipet/concepts/IPETNode.py
# class IpetNode(Editable):
#     """
#     A Node is an interface to an XML-like ancestor-structure
#     """
#     active = True
#     _attributes2options = {"active":[True, False]}
#     deprecatedattrdir = {}
#     
#     def __init__(self, active = True, **kw):
#         """
#         constructs a new IpetNode
# 
#         Parameters
#         ----------
#         active : True or "True" if this element should be active, False otherwise
#         """
#         self.set_active(active)
# 
#         for d, message in self.deprecatedattrdir.items():
#             if d in kw:
#                 logger.warning("Warning : The attribute '{0}' is deprecated and will be ignored; {1}. ".format(d, message))
# 
#     def addChild(self, child):
#         """
#         append a child to this node's children
#         """
#         pass
#     
#     def getChildren(self):
#         """
#         return a list of all children of this node
#         """
#         return None
#     
#     def acceptsAsChild(self, child):
#         """
#         returns whether this node accepts node 'child' as child
#         """
#         return False
#     
#     def removeChild(self, child):
#         """
#         remove the child from this node's children.
#         """
#         pass
#     
#     def isActive(self):
#         """
#         returns True if this node is currently active, False otherwise
#         """
#         return self.active
#     
#     def set_active(self, active):
#         self.active = True if active in [True, "True"] else False
# 
#     def getEditableAttributes(self):
#         """
#         returns all editable attributes
#         """
#         return ["active"]
# 
#     def getRequiredOptionsByAttribute(self, attr):
#         return self._attributes2options.get(attr)
# 
#     @staticmethod
#     def getNodeTag():
#         return "Node"


# Path: ipet/evaluation/Aggregation.py
import numpy
from ipet.misc import misc
from xml.etree import ElementTree
from _functools import partial
from ipet.misc.quick_Pandas import getWilcoxonQuotientSignificance as qWilcox
from ipet.concepts import IpetNode

    def getName(self):
        if self.name is not None:
            name = self.name
        else:
            name = self.aggregation
            
        if(len(self.getEditableAttributes()) > 2):
            name += '(%s)' % ','.join((str(self.__dict__[key]) for key in self.editableattributes[2:]))
        return name

    @staticmethod
    def getPossibleAggregations():
        return Aggregation.possibleaggregations
    
    def getEditableAttributes(self):
        return self.editableattributes

    def set_aggregation(self, aggregation):
        if aggregation not in self.possibleaggregations:
            raise ValueError("%s aggregation not supported" % (aggregation))
        
        self.aggregation = aggregation
            
        self.editableattributes = self.editableattributes[:2]
        
        if aggregation is None:
            return
        try:
            self.aggrfunc = getattr(numpy, aggregation)
        except AttributeError:

            self.aggrfunc = getattr(misc, aggregation)