Skip to content

Commit

Permalink
operators/fast_filtering.py -> filters/approximations.py
Browse files Browse the repository at this point in the history
  • Loading branch information
mdeff committed Aug 16, 2017
1 parent ccc8f71 commit 3ee1e3c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
2 changes: 2 additions & 0 deletions pygsp/filters/__init__.py
Expand Up @@ -18,3 +18,5 @@
# Automaticaly import all classes from subfiles defined in __all__
for class_to_import in __all__:
setattr(sys.modules[__name__], class_to_import, getattr(importlib.import_module('.' + class_to_import.lower(), 'pygsp.filters'), class_to_import))

from .approximations import *
File renamed without changes.
22 changes: 12 additions & 10 deletions pygsp/filters/filter.py
@@ -1,12 +1,14 @@
# -*- coding: utf-8 -*-

from .. import utils
from ..operators import fast_filtering, operator

import numpy as np
from math import log
from copy import deepcopy

import numpy as np

from .. import utils
from ..operators import operator
from . import approximations


class Filter(object):
r"""
Expand Down Expand Up @@ -76,12 +78,12 @@ def analysis(self, s, method=None, cheb_order=30, lanczos_order=30,
self.logger.info('FILTER_ANALYSIS: computing lmax.')
self.G.estimate_lmax()

cheb_coef = fast_filtering.compute_cheby_coeff(self, m=cheb_order)
c = fast_filtering.cheby_op(self.G, cheb_coef, s)
cheb_coef = approximations.compute_cheby_coeff(self, m=cheb_order)
c = approximations.cheby_op(self.G, cheb_coef, s)

elif method == 'lanczos': # Lanczos approx
raise NotImplementedError
# c = fast_filtering.lanczos_op(self, s, order=lanczos_order)
# c = approximations.lanczos_op(self, s, order=lanczos_order)

elif method == 'exact': # Exact computation
if not hasattr(self.G, 'e') or not hasattr(self.G, 'U'):
Expand Down Expand Up @@ -229,21 +231,21 @@ def synthesis(self, c, order=30, method=None, **kwargs):
'The function will compute it for you.')
self.G.estimate_lmax()

cheb_coeffs = fast_filtering.compute_cheby_coeff(
cheb_coeffs = approximations.compute_cheby_coeff(
self, m=order, N=order + 1)
s = np.zeros((N, np.shape(c)[1]))
tmpN = np.arange(N, dtype=int)

for i in range(Nf):
s = s + fast_filtering.cheby_op(self.G,
s = s + approximations.cheby_op(self.G,
cheb_coeffs[i], c[i * N + tmpN])

elif method == 'lanczos':
s = np.zeros((N, np.shape(c)[1]))
tmpN = np.arange(N, dtype=int)

for i in range(Nf):
s += fast_filtering.lanczos_op(self.G, self.g[i],
s += approximations.lanczos_op(self.G, self.g[i],
c[i * N + tmpN],
order=order)

Expand Down
1 change: 0 additions & 1 deletion pygsp/operators/__init__.py
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
r"""This module implements the main operators for the PyGSP box."""

from .fast_filtering import *
from .operator import *
from .reduction import *
from .vertex_frequency_analysis import *

0 comments on commit 3ee1e3c

Please sign in to comment.