Giter VIP home page Giter VIP logo

pyspiraltap's Introduction

pySPIRAL-TAP, a Python version of SPIRAL-TAP

Inspiration

Everything comes from the code by Zachary Harmany ([email protected]).

Original source: http://drz.ac/code/spiraltap/ or https://github.com/zharmany/SPIRAL-TAP (might be more up-to-date). The algorithm is described in this paper:

Z. T. Harmany, R. F. Marcia, and R. M. Willett, "This is SPIRAL-TAP: Sparse Poisson Intensity Reconstruction ALgorithms โ€“ Theory and Practice," IEEE Transactions on Image Processing, vol. 21, pp. 1084โ€“1096, Mar. 2012.

If you use this code for academic work, please mention it:

DOI

Disclaimer

  1. Code: still experimental.

Installation from pip (recommended)

pip install pySPIRALTAP

Installation from the git repository

Requirements

pySPIRALTAP requires the following dependencies:

  • numpy
  • rwt, the Rice Wavelet Toolbox, available on this page: https://github.com/ricedsp/rwt
  • scipy.io (only to run the demo)
  • pytest (only to run the tests)

Installing numpy

Installation using your package manager (Debian/Ubuntu):

sudo apt-get install python-numpy

Alternatively, if you have pip installed, you can install numpy by typing the following:

pip install --user numpy

Installing rwt

You can install the Rice Wavelet Toolbox by typing the following. Before that, make sure that you have cmake installed (sudo apt-get install cmake if you use a Debian-derived distribution):

git clone https://github.com/ricedsp/rwt.git
cd rwt/python
cmake .
sudo make install

And then test if the installation succeeded by typing:

python -c "import rwt"

If this returns nothing, the installation worked. In case it returns an error such as:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named rwt

This means that the installation failed. It can be because the installation was performed using a different version of Python that is not the default version. So far, I do not have information about how to perform this installation.

More information about the installation can be found in the INSTALL file, or on the rwt webpage.

Installing pySPIRALTAP

Installation can be performed using the following shell commands:

git clone https://gitlab.com/padouppadoup/pySPIRAL-TAP.git
cd pySPIRAL-TAP
sudo python setup.py install

Usage/Example

Demo examples

A simple working example can be run at (in the main folder):

python SPIRALdemo.py

This file contains one demo where a 1D signal is reconstructed using a $l1$ penalty. This demo uses matplotlib for plotting output.

Alternatively, one can play with the Jupyter notebook: SPIRALdemo.ipynb, that feature the same demo as SPIRALdemo.py, but in a more fancy format.

Calling from a script

The pySPIRALTAP methods can be imported with import pySPIRALTAP.

SPIRALTAP function parameters

Here is a canonical function call with many parameters exposed:

    resSPIRAL = pySPIRALTAP.SPIRALTAP(y,A,              # y: measured signal, A: projection matrix
		                              1e-6,             # regularization parameter
                                      maxiter=100,      # min. number of iterations
                                      miniter=5,        # max. number of iterations
                                      penalty='canonical', # type of penalty to apply
                                      noisetype='gaussian',# form of the log-likelihood penalty
                                      stopcriterion=3,  # index of the termination criterion
                                      tolerance=1e-8,
                                      alphainit=1,
                                      alphamin=1e-30,
                                      alphamax=1e30,
                                      alphaaccept=1e30,
                                      logepsilon=1e-10,
                                      saveobjective=True,
                                      savereconerror=True,
                                      savesolutionpath=False,
                                      verbose=verbose, savecputime=True)

Status

The methods based on RDP (recursive dyadic partitions) have not been implemented yet. Additionnally, the code has not been fully tested, although we did our best to provide a working product.

License

  • This software is released under the MIT license. See the LICENSE file for more details.
  • The denoise_bound code is released under the GNU GPLv2 license and was written by Copyright (2008): Amir Beck and Marc Teboulle.

pyspiraltap's People

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.