Skip to content

Commit

Permalink
Order imports and add action to check
Browse files Browse the repository at this point in the history
  • Loading branch information
alastair committed Sep 17, 2024
1 parent 150f88a commit 35d0c82
Show file tree
Hide file tree
Showing 14 changed files with 60 additions and 28 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/isort.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Run isort

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: isort/isort-action@v1
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from setuptools import Extension, setup
from Cython.Build import cythonize
import sys

import numpy
from Cython.Build import cythonize
from setuptools import Extension, setup

sourcefiles = [
"smstools/models/utilFunctions_C/utilFunctions.c",
Expand Down
4 changes: 3 additions & 1 deletion smstools/models/dftModel.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# functions that implement analysis and synthesis of sounds using the Discrete Fourier Transform
# (for example usage check dftModel_function.py in the interface directory)

import numpy as np
import math

import numpy as np
from scipy.fft import fft, ifft

from smstools.models import utilFunctions as UF

tol = 1e-14 # threshold used to compute phase
Expand Down
8 changes: 5 additions & 3 deletions smstools/models/harmonicModel.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# functions that implement analysis and synthesis of sounds using the Harmonic Model
# (for example usage check the interface directory)

import math

import numpy as np
from scipy.signal.windows import blackmanharris, triang
from scipy.fft import ifft
import math
from scipy.signal.windows import blackmanharris, triang

from smstools.models import dftModel as DFT
from smstools.models import utilFunctions as UF
from smstools.models import sineModel as SM
from smstools.models import utilFunctions as UF


def f0Detection(x, fs, w, N, H, t, minf0, maxf0, f0et):
Expand Down
10 changes: 6 additions & 4 deletions smstools/models/hprModel.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# functions that implement analysis and synthesis of sounds using the Harmonic plus Residual Model
# (for example usage check the interface directory)

import numpy as np
import math
from scipy.signal.windows import blackmanharris, triang

import numpy as np
from scipy.fft import fft, ifft
from smstools.models import harmonicModel as HM
from scipy.signal.windows import blackmanharris, triang

from smstools.models import dftModel as DFT
from smstools.models import utilFunctions as UF
from smstools.models import harmonicModel as HM
from smstools.models import sineModel as SM
from smstools.models import utilFunctions as UF


def hprModelAnal(x, fs, w, N, H, t, minSineDur, nH, minf0, maxf0, f0et, harmDevSlope):
Expand Down
10 changes: 6 additions & 4 deletions smstools/models/hpsModel.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# functions that implement analysis and synthesis of sounds using the Harmonic plus Stochastic Model
# (for example usage check the examples interface)

import math

import numpy as np
from scipy.signal import resample
from scipy.signal.windows import blackmanharris, triang, hann
from scipy.fft import fft, ifft
import math
from scipy.signal import resample
from scipy.signal.windows import blackmanharris, hann, triang

from smstools.models import dftModel as DFT
from smstools.models import harmonicModel as HM
from smstools.models import sineModel as SM
from smstools.models import dftModel as DFT
from smstools.models import stochasticModel as STM
from smstools.models import utilFunctions as UF

Expand Down
6 changes: 4 additions & 2 deletions smstools/models/sineModel.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# functions that implement analysis and synthesis of sounds using the Sinusoidal Model
# (for example usage check the examples in interface)

import math

import numpy as np
from scipy.fft import fftshift, ifft
from scipy.signal.windows import blackmanharris, triang
from scipy.fft import ifft, fftshift
import math

from smstools.models import dftModel as DFT
from smstools.models import utilFunctions as UF

Expand Down
6 changes: 4 additions & 2 deletions smstools/models/sprModel.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# functions that implement analysis and synthesis of sounds using the Sinusoidal plus Residual Model
# (for example usage check the examples interface)

import math

import numpy as np
from scipy.signal.windows import blackmanharris, triang
from scipy.fft import fft, ifft
import math
from scipy.signal.windows import blackmanharris, triang

from smstools.models import dftModel as DFT
from smstools.models import sineModel as SM
from smstools.models import utilFunctions as UF
Expand Down
10 changes: 6 additions & 4 deletions smstools/models/spsModel.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# functions that implement analysis and synthesis of sounds using the Sinusoidal plus Stochastic Model
# (for example usage check the interface directory)

import math

import numpy as np
from scipy.signal import resample
from scipy.signal.windows import blackmanharris, triang, hann
from scipy.fft import fft, ifft
import math
from smstools.models import utilFunctions as UF
from scipy.signal import resample
from scipy.signal.windows import blackmanharris, hann, triang

from smstools.models import dftModel as DFT
from smstools.models import sineModel as SM
from smstools.models import stochasticModel as STM
from smstools.models import utilFunctions as UF


def spsModelAnal(
Expand Down
1 change: 1 addition & 0 deletions smstools/models/stft.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# (for example usage check stft_function.py in the interface directory)

import numpy as np

from smstools.models import dftModel as DFT


Expand Down
5 changes: 3 additions & 2 deletions smstools/models/stochasticModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# (for example usage check stochasticModel_function.py in the interface directory)

import numpy as np
from scipy.fft import fft, ifft
from scipy.interpolate import splev, splrep
from scipy.signal import resample
from scipy.signal.windows import hann
from scipy.interpolate import splrep, splev
from scipy.fft import fft, ifft

from smstools.models import utilFunctions as UF


Expand Down
4 changes: 2 additions & 2 deletions smstools/models/utilFunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import sys

import numpy as np
from scipy.fft import fft, ifft, fftshift
from scipy.io.wavfile import write, read
from scipy.fft import fft, fftshift, ifft
from scipy.io.wavfile import read, write
from scipy.signal import resample
from scipy.signal.windows import blackmanharris, triang

Expand Down
3 changes: 2 additions & 1 deletion smstools/models/utilFunctions_C/cutilFunctions.pyx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#this is a cython wrapper on C functions to call them in python

import numpy as np

cimport numpy as np
from libc.stdlib cimport *
from cutilFunctions cimport *
from libc.stdlib cimport *

np.import_array()

Expand Down
6 changes: 5 additions & 1 deletion smstools/transformations/stftTransformations.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# functions that implement transformations using the stft

import math
import os
import sys

import numpy as np
import sys, os, math
from scipy.signal import resample

from smstools.models import dftModel as DFT


Expand Down

0 comments on commit 35d0c82

Please sign in to comment.