示例#1
0
 def __init__(self, thisData, thisConfig, thisExpName, thisDebug=True):
     Format.__init__(self, thisDebug)
     self.data = thisData
     self.config = thisConfig
     self._printToFilename = thisExpName
     self.debug = thisDebug
     self.colorMap = plt.get_cmap(self.config.getMatrixColorMap())
     self.SPECIAL_SCORE = 12345
     self.plotType = 'matrix_plot'
     self.title = self.data.getTitle()
     self.event = None
示例#2
0
 def __init__(self, thisConfig, thisDebug=True):
     self.debug = thisDebug
     Format.__init__(self, self.debug)
     self._config = thisConfig
     # N must be bigger than 3 otherwise the matrix will be all white.
     self._N = 4
     self._metaValues = ['condA', 'condB', 'condC', 'condD', 'condE', 'condF']
     #self._metaValues = ['condA']
     self.getMaximum4ThisType = self._config.getMaximum4Type3
     self.getMinimum4ThisType = self._config.getMinimum4Type3
     self._ma = self.getMinimum4ThisType()
     self._mi = self.getMaximum4ThisType()
     self._data = collections.defaultdict(list)
     self._title = 'dummy test title for matrix data'
示例#3
0
 def __init__(self, thisConfig, thisDebug=True):
     self.debug = thisDebug
     Format.__init__(self, self.debug)
     self._config = thisConfig
     # N must be bigger than 3 otherwise the matrix will be all white.
     self._N = 4
     self._metaValues = [
         'condA', 'condB', 'condC', 'condD', 'condE', 'condF'
     ]
     #self._metaValues = ['condA']
     self.getMaximum4ThisType = self._config.getMaximum4Type3
     self.getMinimum4ThisType = self._config.getMinimum4Type3
     self._ma = self.getMinimum4ThisType()
     self._mi = self.getMaximum4ThisType()
     self._data = collections.defaultdict(list)
     self._title = 'dummy test title for matrix data'
示例#4
0
    def __init__(self, thisPattern, thisAgmsv, thisAimsv, thisNumberOfTargets, thisNumberOfNonTargets, thisDebug=True):
        Format.__init__(self, thisDebug)
        self._pattern = thisPattern
        self._aimsv = thisAimsv
        self._agmsv = thisAgmsv
        self._numberOfTargets = thisNumberOfTargets
        self._numberOfNonTargets = thisNumberOfNonTargets
        self.debug = thisDebug

        self._agmStdDev = 0.0
        self._aimStdDev = 0.0
        self._agmNormStdDev = 0.0
        self._aimNormStdDev = 0.0
        self._singleTargetScore = False
        self._singleNonTargetScore = False
        # wasLimited can be used to display points that were limited in stdev in a
        # different way than other points.
        self._wasLimited = False
示例#5
0
 def __init__(self,
              thisData,
              thisConfig,
              thisExpName,
              thisType='normal',
              thisDebug=True,
              thisUseMeta=False):
     Format.__init__(self, thisDebug)
     self.data = thisData
     self.config = thisConfig
     self._printToFilename = thisExpName
     self.type = thisType
     self.debug = thisDebug
     self.title = self.data.getTitle()
     self.useMeta = thisUseMeta
     self.plotType = "histogram_plot"
     self.fig = None
     self.event = None
     self.colors = None
     self.nrColors = None
示例#6
0
 def __init__(self):
     Format.__init__(self, "[:;|]", 2,
                     '''CREATE TABLE data (user text, password text)''',
                     '''INSERT INTO data VALUES (?, ?)''')
示例#7
0
文件: data.py 项目: josbouten/bioplot
    def __init__(self,
                 thisConfig,
                 thisTitle,
                 thisThreshold,
                 thisDataType,
                 maxNrTargetSamplesPerLabel,
                 maxNrNonTargetSamplesPerLabel,
                 thisDebug=True,
                 thisSources='database'):
        Format.__init__(self, thisDebug)
        self.config = thisConfig
        self._title = thisTitle
        self._defaultThreshold = thisThreshold
        self._dataType = thisDataType
        # Annotate _doves, _phantoms, _worms and _chameleons
        self._maxNrTargetSamplesPerLabel = maxNrTargetSamplesPerLabel
        self._maxNrNonTargetSamplesPerLabel = maxNrNonTargetSamplesPerLabel
        self.debug = thisDebug
        self._sources = thisSources
        self._format = Format(self.debug)

        self._plotType = None

        # Target scores per label and meta value pattern.
        self._targetScores = collections.defaultdict(list)
        # Number of targets per label.
        self._targetCnt = collections.Counter()
        # Non target scores per label and meta value pattern.
        self._nonTargetScores = collections.defaultdict(list)
        # Number of non targets per label.
        self._nonTargetCnt = collections.Counter()
        # Target scores per label.
        self._targetScores4Label = collections.defaultdict(list)
        self._targetScores4MetaValue = collections.defaultdict(list)
        # Non target scores per label.
        self._nonTargetScores4Label = collections.defaultdict(list)
        self._nonTargetScores4MetaValue = collections.defaultdict(list)
        self._results = collections.defaultdict(list)
        # Count which labels + condition exceed the maxNrTargetSamplesPerLabel
        # and maxNrNonTargetSamplesPerLabel
        self._targetScoresInExcess = collections.Counter()
        self._nonTargetScoresInExcess = collections.Counter()
        self._nrDistinctMetaDataValues = 0
        # Contains: { speakerId: metaDataValue }
        self._metaDataValues = collections.defaultdict(set)
        self._LabelsToShowAlways = []
        self._minimumScore = collections.defaultdict(dict)
        self._maximumScore = collections.defaultdict(dict)

        # Keep track of labels.
        self._targetLabels = set()
        self._nonTargetLabels = set()

        # Do we allow both scores (A vs B and B vs A) in a symmetric tests or only the first read?
        self._allowDups = self.config.getAllowDups()

        if self.debug:
            print('Data._source(s):')
            for el in self._sources:
                print(el)

        # If the user did not specify a filename, we assume a database as the source.
        if self._sources == 'database':
            print("You need to add some code for this to work!")
            # And remove the sys.exit(1) statement.
            #res = self._readFromDatabase()
            sys.exit(1)
        else:
            res = self._readFromFiles(self._sources)
        #
        # Choose between decoder for type of results.
        #
        if self._dataType == 'type3':
            self._decodeType3Results(res)
        elif self._dataType == 'type2':
            print("Type2 data is not supported anymore. Convert it to type3!")
            sys.exit(1)
        elif self._dataType == 'type1':
            self._decodeType1Results(res)
        else:
            print("Unknown data type, must be 'type1' or 'type3'.")
            sys.exit(1)
示例#8
0
文件: data.py 项目: josbouten/bioplot
    def __init__(self, thisConfig, thisTitle, thisThreshold, thisDataType, thisDebug=True, thisSources='database'):
        Format.__init__(self, thisDebug)
        self.config = thisConfig
        self._title = thisTitle
        self._defaultThreshold = thisThreshold
        self._dataType = thisDataType
        # Annotate _doves, _phantoms, _worms and _chameleons
        self.debug = thisDebug
        self._sources = thisSources
        self._format = Format(self.debug)

        self._plotType = None

        # Target scores per label and meta value pattern.
        self._targetScores = collections.defaultdict(list)
        # Number of targets per label.
        self._targetCnt = collections.Counter()
        # Non target scores per label and meta value pattern.
        self._nonTargetScores = collections.defaultdict(list)
        # Number of non targets per label.
        self._nonTargetCnt = collections.Counter()
        # Target scores per label.
        self._targetScores4Label = collections.defaultdict(list)
        self._targetScores4MetaValue = collections.defaultdict(list)
        # Non target scores per label.
        self._nonTargetScores4Label = collections.defaultdict(list)
        self._nonTargetScores4MetaValue = collections.defaultdict(list)
        self._results = collections.defaultdict(list)
        self._results4Subject = collections.defaultdict(list)
        self._nrDistinctMetaDataValues = 0
        # Contains: { speakerId: metaDataValue }
        self._metaDataValues = collections.defaultdict(set)
        self._LabelsToShowAlways = []
        self._minimumScore = collections.defaultdict(dict)
        self._maximumScore = collections.defaultdict(dict)

        # Keep track of labels.
        self._targetLabels = set()
        self._nonTargetLabels = set()

        # Do we allow both scores (A vs B and B vs A) in a symmetric tests or only the first read?
        self._allowDups = self.config.getAllowDups()

        if self.debug:
            print('Data._source(s):')
            for el in self._sources:
                print(el)

        # If the user did not specify a filename, we assume a database as the source.
        if self._sources == 'database':
            print("You need to add some code for this to work!")
            # And remove the sys.exit(1) statement.
            sys.exit(1)
            res = self._readFromDatabase()
        else:
            res = self._readFromFiles(self._sources)
        #
        # Choose between decoder for type of results.
        #
        if self._dataType == 'type3':
            self._decodeType3Results(res)
        elif self._dataType == 'type2':
            print("Type2 data is not supported anymore. Convert it to type3!")
            sys.exit(1)
        elif self._dataType == 'type1':
            self._decodeType1Results(res)
        else:
            print("Unknown data type, must be 'type1' or 'type3'.")
            sys.exit(1)