# PyScatter

pyscatter is a implementation of the scattering transform.

## How to build the tree

```python

# Declare a list of propagation filters for each level.
prop = [
    [swt1(wavelet='db1'), someotherfilter(some_arguments)],  # Filters on level 1
    [swt1(wavelet='db1')]  # Filters on level 2
]

# Declare output filters.
# Note that the current implementation allows propagation filters to produce output.
out = [
    [None, some_lowpass()], #   Level 1. 'None' means unfiltered output.
    [None]
]

# Declare nonlinearities.
nonlin = [
            None,   # Let the signal pass. f(x) = x
            np.abs,
            np.real,
        ]
        
# Declare pooling functions.
poolings = [
    None,   # Don't apply any pooling on first level.
    pool(2, np.avg),    # Reduce the signal size by a factor 2.
    pool(2, np.mean),   # Reduce the signal size by a factor 2.
]

# Assemble the tree.
tree = scattering_tree(prop, out, nonlin, poolings)
```

## Modules

### scatteringtree
This is the core of the algorithm.

### visualize
Generates graphical representations of the scattering tree.

### filters
Contains some basic filter sets such as stationary wavelet transforms and Gabor frames.

The scattering tree expects filters to be passed as objects providing the function `apply_filter(input_signal)`.

### nonlinearity

Nonlinearities must be vectorized functions. Use `np.vectorize` if your function is not yet vectorized.

### pooling

The scattering tree expects pooling functions to be passed as objects providing the function `apply_pooling(input_signal)`.


