def getFactors(self, aLocation, axisOnly=False): """ Return a list of all factors and math items at aLocation. factor, mathItem, deltaName """ deltas = [] aLocation.expand(self.getAxisNames()) limits = getLimits(self._allLocations(), aLocation) for deltaLocationTuple, (mathItem, deltaName) in self.items(): deltaLocation = Location(deltaLocationTuple) deltaLocation.expand( self.getAxisNames()) factor = self._accumulateFactors(aLocation, deltaLocation, limits, axisOnly) deltas.append((factor, mathItem, deltaName)) return deltas
def getFactors(self, aLocation, axisOnly=False): """ Return a list of all factors and math items at aLocation. factor, mathItem, deltaName """ deltas = [] aLocation.expand(self.getAxisNames()) limits = getLimits(self._allLocations(), aLocation) for deltaLocationTuple, (mathItem, deltaName) in self.items(): deltaLocation = Location(deltaLocationTuple) deltaLocation.expand(self.getAxisNames()) factor = self._accumulateFactors(aLocation, deltaLocation, limits, axisOnly) deltas.append((factor, mathItem, deltaName)) return deltas
def getFactors(self, aLocation, axisOnly=False, allFactors=False): """ Return a list of all factors and math items at aLocation. factor, mathItem, deltaName all = True: include factors that are zero or near-zero """ deltas = [] aLocation.expand(self.getAxisNames()) limits = getLimits(self._allLocations(), aLocation) for deltaLocationTuple, (mathItem, deltaName) in sorted(self.items()): deltaLocation = Location(deltaLocationTuple) deltaLocation.expand( self.getAxisNames()) factor = self._accumulateFactors(aLocation, deltaLocation, limits, axisOnly) if not (factor-_EPSILON < 0 < factor+_EPSILON) or allFactors: # only add non-zero deltas. deltas.append((factor, mathItem, deltaName)) deltas = sorted(deltas, key=itemgetter(0), reverse=True) return deltas
def getFactors(self, aLocation, axisOnly=False): """ Return a list of all factors and math items at aLocation. factor, mathItem, deltaName """ deltas = [] aLocation.expand(self.getAxisNames()) limits = getLimits(self._allLocations(), aLocation) for deltaLocationTuple, (mathItem, deltaName) in sorted(self.iteritems()): deltaLocation = Location(deltaLocationTuple) deltaLocation.expand( self.getAxisNames()) factor = self._accumulateFactors(aLocation, deltaLocation, limits, axisOnly) if not (factor-_EPSILON < 0 < factor+_EPSILON): # only add non-zero deltas. deltas.append((factor, mathItem, deltaName)) deltas.sort() deltas.reverse() return deltas
def getFactors(self, aLocation, axisOnly=False): """ Return a list of all factors and math items at aLocation. factor, mathItem, deltaName """ deltas = [] aLocation.expand(self.getAxisNames()) limits = getLimits(self._allLocations(), aLocation) for deltaLocationTuple, (mathItem, deltaName) in sorted(self.iteritems()): deltaLocation = Location(deltaLocationTuple) deltaLocation.expand(self.getAxisNames()) factor = self._accumulateFactors(aLocation, deltaLocation, limits, axisOnly) if not (factor - _EPSILON < 0 < factor + _EPSILON): # only add non-zero deltas. deltas.append((factor, mathItem, deltaName)) deltas.sort() deltas.reverse() return deltas