def __init__(self, client=None, axisName='x'): if isinstance(client, str): raise GraphException( 'Client must be a PlotStream, Stream, or None') self._client = None self._label = None self.client = client self.axisName = axisName self.minValue = None self.maxValue = None
def remapQuarterLength(self, x): ''' Remap a quarter length as its log2. Essentially it's just math.log2(x), but x=0 is replaced with self.graceNoteQL. ''' if x == 0: # grace note x = self.graceNoteQL try: return math.log2(float(x)) except ValueError: # pragma: no cover raise GraphException('cannot take log of x value: %s' % x)