Skip to content

Commit

Permalink
Use staticmethod decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
jurihock committed Jan 28, 2023
1 parent ac3b439 commit df9fae5
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/python/qdft/qdft.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ def __init__(self, samplerate, bandwidth, resolution=24, latency=0, window=(+0.5
outputs = numpy.zeros((size, kernels.size), dtype=complex)

dfts = numpy.zeros((0, size, kernels.size), dtype=complex)
dfts = QDFT.analyze(dfts, inputs, outputs, periods, offsets, weights, fiddles, twiddles, window)
dfts = self.__analyze__(dfts, inputs, outputs, periods, offsets, weights, fiddles, twiddles, window)
assert dfts.shape == (0, size, )

samples = numpy.zeros((0), dtype=float)
samples = QDFT.synthesize(dfts, samples, twiddles)
samples = self.__synthesize__(dfts, samples, twiddles)
assert samples.shape == (0, )

self.samplerate = samplerate
Expand Down Expand Up @@ -120,7 +120,7 @@ def qdft(self, samples):

dfts = numpy.zeros((samples.size, size, kernels.size), complex)

return QDFT.analyze(dfts, inputs, outputs, periods, offsets, weights, fiddles, twiddles, window)
return self.__analyze__(dfts, inputs, outputs, periods, offsets, weights, fiddles, twiddles, window)

def iqdft(self, dfts):
"""
Expand All @@ -145,10 +145,11 @@ def iqdft(self, dfts):

samples = numpy.zeros(len(dfts), float)

return QDFT.synthesize(dfts, samples, twiddles)
return self.__synthesize__(dfts, samples, twiddles)

@staticmethod
@numba.jit(nopython=True, fastmath=True)
def analyze(dfts, inputs, outputs, periods, offsets, weights, fiddles, twiddles, window):
def __analyze__(dfts, inputs, outputs, periods, offsets, weights, fiddles, twiddles, window):

if not dfts.size:
return dfts[..., 0]
Expand Down Expand Up @@ -199,8 +200,9 @@ def analyze(dfts, inputs, outputs, periods, offsets, weights, fiddles, twiddles,

return dfts[..., 0]

@staticmethod
@numba.jit(nopython=True, fastmath=True)
def synthesize(dfts, samples, twiddles):
def __synthesize__(dfts, samples, twiddles):

if not dfts.size:
return samples
Expand Down

0 comments on commit df9fae5

Please sign in to comment.