[med-svn] [pycorrfit] 04/12: Imported Upstream version 0.8.8+dfsg

Alex Mestiashvili malex-guest at moszumanska.debian.org
Mon Jun 1 13:02:54 UTC 2015


This is an automated email from the git hooks/post-receive script.

malex-guest pushed a commit to branch master
in repository pycorrfit.

commit e705b9ff2c562d62a19a7484e0852dd25b83263d
Author: Alexandre Mestiashvili <alex at biotec.tu-dresden.de>
Date:   Fri May 29 18:03:58 2015 +0200

    Imported Upstream version 0.8.8+dfsg
---
 .gitignore                                      |  66 ---
 ChangeLog.txt                                   |  36 +-
 LICENSE                                         | 293 ++++++++++
 MANIFEST.in                                     |   7 +-
 README.md                                       |   7 +-
 bin/pycorrfit                                   |   4 -
 doc/PyCorrFit_doc_content.tex                   |  44 +-
 pycorrfit/PyCorrFit.py                          |   4 +-
 pycorrfit/__init__.py                           |  30 +-
 pycorrfit/__main__.py                           |  23 +-
 pycorrfit/doc.py                                |  55 +-
 pycorrfit/edclasses.py                          |  34 +-
 pycorrfit/fcs_data_set.py                       | 739 ------------------------
 pycorrfit/fitting.py                            |  24 +-
 pycorrfit/frontend.py                           | 119 ++--
 pycorrfit/main.py                               |  64 +-
 pycorrfit/misc.py                               |  26 +-
 pycorrfit/models/MODEL_TIRF_1C.py               |  43 +-
 pycorrfit/models/MODEL_TIRF_2D2D.py             |  58 +-
 pycorrfit/models/MODEL_TIRF_3D2D.py             |  39 +-
 pycorrfit/models/MODEL_TIRF_3D2Dkin_Ries.py     |  81 +--
 pycorrfit/models/MODEL_TIRF_3D3D.py             |  43 +-
 pycorrfit/models/MODEL_TIRF_gaussian_1C.py      |  22 +-
 pycorrfit/models/MODEL_TIRF_gaussian_3D2D.py    |  86 ++-
 pycorrfit/models/MODEL_TIRF_gaussian_3D3D.py    |  68 +--
 pycorrfit/models/MODEL_classic_gaussian_2D.py   |  42 +-
 pycorrfit/models/MODEL_classic_gaussian_3D.py   |  79 ++-
 pycorrfit/models/MODEL_classic_gaussian_3D2D.py |  44 +-
 pycorrfit/models/__init__.py                    | 253 ++++----
 pycorrfit/openfile.py                           |  32 +-
 pycorrfit/page.py                               |  67 +--
 pycorrfit/plotting.py                           |  65 +--
 pycorrfit/readfiles/__init__.py                 |  24 +-
 pycorrfit/readfiles/read_ASC_ALV.py             |  58 +-
 pycorrfit/readfiles/read_CSV_PyCorrFit.py       |  21 +-
 pycorrfit/readfiles/read_FCS_Confocor3.py       |  85 +--
 pycorrfit/readfiles/read_SIN_correlator_com.py  |  18 +-
 pycorrfit/readfiles/read_mat_ries.py            |  62 +-
 pycorrfit/readfiles/read_pt3_PicoQuant.py       |  36 +-
 pycorrfit/tools/__init__.py                     |  73 +--
 pycorrfit/tools/average.py                      |  40 +-
 pycorrfit/tools/background.py                   |  39 +-
 pycorrfit/tools/batchcontrol.py                 |  32 +-
 pycorrfit/tools/chooseimport.py                 |  33 +-
 pycorrfit/tools/comment.py                      |  30 +-
 pycorrfit/tools/datarange.py                    |  30 +-
 pycorrfit/tools/example.py                      |  38 +-
 pycorrfit/tools/globalfit.py                    |  39 +-
 pycorrfit/tools/info.py                         |  32 +-
 pycorrfit/tools/overlaycurves.py                |  35 +-
 pycorrfit/tools/parmrange.py                    |  44 +-
 pycorrfit/tools/plotexport.py                   |  32 +-
 pycorrfit/tools/simulation.py                   |  48 +-
 pycorrfit/tools/statistics.py                   |  52 +-
 pycorrfit/tools/trace.py                        |  30 +-
 pycorrfit/usermodel.py                          |  60 +-
 setup.py                                        | 112 ++--
 57 files changed, 1173 insertions(+), 2527 deletions(-)

diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index a43b898..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,66 +0,0 @@
-*.py[cod]
-
-# C extensions
-*.so
-
-# Packages
-*.egg
-*.egg-info
-dist
-build
-eggs
-parts
-bin
-var
-sdist
-develop-eggs
-.installed.cfg
-lib
-lib64
-
-# Installer logs
-pip-log.txt
-
-# Unit test / coverage reports
-.coverage
-.tox
-nosetests.xml
-
-# Translations
-*.mo
-
-# Mr Developer
-.mr.developer.cfg
-.project
-.pydevproject
-
-# Latex
-*.aux
-*.glo
-*.idx
-*.log
-*.toc
-*.ist
-*.acn
-*.acr
-*.alg
-*.bbl
-*.blg
-*.dvi
-*.glg
-*.gls
-*.ilg
-*.ind
-*.lof
-*.lot
-*.maf
-*.mtc
-*.mtc1
-*.out
-*.synctex.gz
-*.pdf
-*.bak
-
-# ~
-*.py~
-*.md~
diff --git a/ChangeLog.txt b/ChangeLog.txt
index 1fb05be..aef12fe 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -1,3 +1,25 @@
+0.8.8
+- Improved support for "ALV-7004" files.
+- If you install the GUI with pip, you now need to include
+  the `GUI` requirement: `pip install pycorrfit[GUI]`.
+  The GUI depends on matplotlib and wxPython which is not
+  required for scripting with the pycorrfit module.
+- Bugfix: missing version string on SuSe linux (#101)
+- Under the hood:
+   - Python entry point script replaces "bin/" script
+   - Windows build system hosted by appveyor.com
+   - MacOS X build system hosted by travis-ci.org
+   - New builds use wxPython3 (#85)
+   - Unicode support without `reload(sys)`
+   - Error messages are more verbose
+0.8.7
+- Removed unused fitting parameter d_eva from model 6022 and
+  secured backwards compatibility.
+- Improved support for ALV700X (#92)
+- Bugfix: Corrected false display of Unicode characters on Windows
+- Under the hood:
+   - Code cleanup with pyflakes
+   - Repo cleanup (#98)
 0.8.6
 - Bugfix: Opening .fcs files with only one AC curve works now
 - Zip files with measurements may now contain subfolders
@@ -7,14 +29,14 @@
 - Fixed bug that made it impossible to load data (#88)
 - Exceptions are now handled by wxPython
 - Under the hood:
-   - pythonic repository structure
+   - Pythonic repository structure
    - Relative imports
    - Windows build machine is now Windows 7
    - Removed strict dependency on matplotlib
 0.8.4
 - Support for PicoQuant data file format
   Many thanks to Dominic Waithe (@dwaithe)
-- Improved comaptibility with Zeiss .fcs file format
+- Improved compatibility with Zeiss .fcs file format
 - PyCorrFit is now dependent on Cython
 - The module 'openfile' is now available from within Python
 - Installer for Windows
@@ -24,7 +46,7 @@
 - Improvements
    - Massive speed-up when working with large data sets (#77)
    - Plot export: legend position and displayed parameters (#54)
-   - Average tool: traces may now start at timepoints != 0
+   - Average tool: traces may now start at time points != 0
    - Statistics tool: display on smaller screens
    - ALV data files: updated parser to identify curve types and segment traces
    - Zeiss ConfoCor3 data files: some files could not be opened due to dummy AC curves
@@ -32,9 +54,9 @@
    - Software: notification dialogs for missing modules or other software
 - Bugfixes
    - User could accidently clear a session (#65)
-   - wxPython plotting problen on MacOSx (#64)
+   - wxPython plotting problem on MacOSx (#64)
    - Statistics view: some parameters were duplicated (#76)
-   - Catched zero-division warnings (models with triplet component)
+   - Caught zero-division warnings (models with triplet component)
    - Corrected x-axis scaling of statistics view and trace view
 0.8.2
 - The documentation has been thoroughly reworked
@@ -52,7 +74,7 @@
    - Some ConfoCor files were not imported
    - The cpp was not calculated correctly in case of background correction (#45)
    - Enabled averaging of single pages (#58)
-   - Background correction for cross-correlation data is now copmuted (#46)
+   - Background correction for cross-correlation data is now computed (#46)
 - Improvements of the user interface
    - The menus have been reordered (#47, #50)
    - The fitting panel has been optimized (#49)
@@ -60,7 +82,7 @@
    - The Help menu contains documentation and wiki (#56)
    - Model functions that are somehow redundant have been removed from the menu,
      but are still supported
-   - The model doc strings were fully converted to unicode
+   - The model doc strings were fully converted to Unicode
    - Several text messages were modified for better coherence
    - The background correction tool is more intuitive
    - Statistics panel improvements (#43)
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..015dcae
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,293 @@
+Copyright (C) 2011-2012  Paul Müller
+
+PyCorrFit is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                            NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                     END OF TERMS AND CONDITIONS
diff --git a/MANIFEST.in b/MANIFEST.in
index f887a12..d3c7d05 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,8 +1,11 @@
 include doc/*.tex
 include doc/*.bib
 include doc/*.pdf
+include doc/*.md
 include doc/Images/*
-include examples/external_model_functions/*
+include examples/external_model_functions/*.txt
 include Readme.txt
 include ChangeLog.txt
-
+include pycorrfit/readfiles/read_pt3_scripts/*.py
+include pycorrfit/readfiles/read_pt3_scripts/*.pyx
+include pycorrfit/readfiles/read_pt3_scripts/LICENSE
diff --git a/README.md b/README.md
index c3e9ba9..c38b4c7 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,10 @@
-![PyCorrFit](https://raw.github.com/paulmueller/PyCorrFit/master/doc-src/Images/PyCorrFit_logo_dark.png)
+![PyCorrFit](https://raw.github.com/paulmueller/PyCorrFit/master/doc/Images/PyCorrFit_logo_dark.png)
 =========
+[![PyPI](http://img.shields.io/pypi/v/PyCorrFit.svg)](https://pypi.python.org/pypi/pycorrfit)
+[![Build Win](https://img.shields.io/appveyor/ci/paulmueller/PyCorrFit/master.svg?label=build_win)](https://ci.appveyor.com/project/paulmueller/pycorrfit)
+[![Build Mac](https://img.shields.io/travis/paulmueller/PyCorrFit/master.svg?label=build_mac)](https://travis-ci.org/paulmueller/PyCorrFit)
+
+
 
 This repository contains the source code of PyCorrFit - a scientific tool for fitting
 correlation curves on a logarithmic plot.
diff --git a/bin/pycorrfit b/bin/pycorrfit
deleted file mode 100644
index 28bfcc5..0000000
--- a/bin/pycorrfit
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-# go to this directory to prevent execution of a git checkout
-cd "$(dirname "$0")"
-python -m pycorrfit
diff --git a/doc/PyCorrFit_doc_content.tex b/doc/PyCorrFit_doc_content.tex
index e75bda5..3c67f7f 100755
--- a/doc/PyCorrFit_doc_content.tex
+++ b/doc/PyCorrFit_doc_content.tex
@@ -48,40 +48,32 @@ This documentation addresses the processing of correlation curves with \textit{P
 \label{sec:intro.prere.softw}
 The latest version of \textit{PyCorrFit} can be obtained from the internet at \url{http://pycorrfit.craban.de}.
 \begin{itemize}
-\item \textbf{MacOSx.}
-Binary files for Mac OSx 10.6.8 and later are available from the download page.
+\item \textbf{MacOS X.}
+Binary files for MacOS X 10.9.5 and later are available from the download page.
 \item \textbf{Windows.}
 For Windows XP and later, stand-alone binary executables are available from the download page. 
 \item \textbf{Ubuntu/Debian.}
-PyCorrFit is available from the Debian repositories and can be installed via the operating systems packaging tool (e.g. \texttt{apt-get install pycorrfit}). There are also binaries for Ubuntu at the PyCorrFit download page.
-\item\textbf{Pypi.} The program was written in Python, keeping the concept of cross-platform programming in mind. To run \textit{PyCorrFit} on any other operating system, the installation of Python v.2.7 is required. \textit{PyCorrFit} is included in the package index of \texttt{python-pip} (\url{http://pypi.python.org/pypi/pip}) and can be installed via
-\texttt{pip~install~pycorrfit}\footnote{See also the wiki article at \url{https://github.com/paulmueller/PyCorrFit/wiki/Installation_pip}}.
+PyCorrFit is available from the Debian repositories and can be installed via the operating systems packaging tool (e.g. \texttt{apt-get install pycorrfit}).
+\item\textbf{PyPI.} To run \textit{PyCorrFit} on any other operating system, the installation of Python v.2.7 is required. \textit{PyCorrFit} is included in the Python package index (PyPI, \url{http://pypi.python.org/pypi/pip}) and can be installed via\footnote{See also the wiki article at \url{https://github.com/paulmueller/PyCorrFit/wiki/Installation_pip}}
+\texttt{pip~install~pycorrfit$\!$[GUI]}.
 \item \textbf{Sources.}
-You can also directly download the source code at any developmental stage\footnote{See also the wiki article at \url{https://github.com/paulmueller/PyCorrFit/wiki/Running-from-source}}. \textit{PyCorrFit} depends on the following python modules:\\
-\texttt{\\
-python-matplotlib ($\geq$ 1.0.1) \\
-python-numpy ($\geq$ 1.5.1) \\
-python-scipy ($\geq$ 0.8.0) \\
-python-sympy ($\geq$ 0.7.2) \\
-python-yaml \\
-python-wxgtk2.8 \\
+You can also directly download the source code at any developmental stage\footnote{See also the wiki article at \url{https://github.com/paulmueller/PyCorrFit/wiki/Running-from-source}}. \textit{PyCorrFit} depends on the following python modules:
+\texttt{
+\begin{itemize}
+\item matplotlib ($\geq$ 1.0.1)
+\item NumPy ($\geq$ 1.5.1)
+\item PyYAML
+\item SciPy ($\geq$ 0.8.0)
+\item sympy ($\geq$ 0.7.2)
+\item wxPython3
+\end{itemize}
 }
 \end{itemize}
 
 
 \vspace{1em}
-\noindent \textbf{\LaTeX .} \textit{PyCorrFit} can save correlation curves as images using matplotlib. It is also possible to utilize \LaTeX to generate these plots. On Windows, installing MiKTeX  with ``automatic package download'' will enable this feature. On MacOSx, the MacTeX distribution can be used. On other systems, a latex distribution, Ghostscript, \texttt{dvipng} and the latex packages \texttt{texlive-latex-base} and \texttt{texlive-math-extra} need to be installed.
-
-\subsubsection{Running \textit{PyCorrFit}}
-\label{sec:intro.runni}
-\paragraph*{Windows.}
-Download the executable file and double-click on the \texttt{PyCorrFit.exe} icon.
-\paragraph*{Ubuntu/Debian.}
-\texttt{PyCorrFit} is integrated into Debian and thus behaves like any other application.
-\paragraph*{Mac OSx.}
-When downloading the archive \texttt{PyCorrFit.zip}, the binary should be extracted automatically (if not, extract the archive) and you can double-click it to run \textit{PyCorrFit}.If prompted, select \textit{Terminal.app} from the \textit{utilities} folder. Drag the \textit{PyCorrFit} icon onto the Terminal, then MAcOS will assign Terminal.app as the standard application for opening this file (can be checked under properties).
-\paragraph*{from source.}
-Invoke \texttt{python PyCorrFit.py} from the command line.
+\noindent \textbf{\LaTeX .} \textit{PyCorrFit} can save correlation curves as images using matplotlib. It is also possible to utilize \LaTeX to generate these plots. On Windows, installing MiKTeX  with ``automatic package download'' will enable this feature. On MacOS X, the MacTeX distribution can be used. On other systems, a latex distribution, Ghostscript, \texttt{dvipng} and the latex packages \texttt{texlive-latex-base} and \texttt{texlive-math-extra} need to be installed.
+
 
 \subsection{Workflow}
 \label{sec:intro.workf}
@@ -109,7 +101,7 @@ The fitting itself is usually explored with a representative data set. Here, the
 \includegraphics[width=\linewidth]{PyCorrFit_Screenshot_Main.png}
  \mycaption{user interface of PyCorrFit}{Confocal measurement of nanomolar Alexa488 in aqueous solution. To avoid after-pulsing, the autocorrelation curve was measured by cross-correlating signals from two detection channels using a 50 \% beamsplitter. Fitting reveals the average number of observed particles ($n \approx 6$) and their residence time in the detection volume ($\tau_{\rm diff} = \SI{28}{\mu s})$. \label{fig:mainwin} }
 \end{figure}
-Together with a system's terminal of the platform on which \textit{PyCorrFit} was installed (Windows, Linux, MacOS), the \textit{main window} opens when starting the program as described in \hyref{Section}{sec:intro.runni}. The window title bar contains the version of \textit{PyCorrFit} and, if a session was re-opened or saved, the name of the fitting session. A menu bar provides access to many supporting tools and additional information as thoroughly described in \hyref{Chapter}{sec:menub}. 
+Together with a system's terminal of the platform on which \textit{PyCorrFit} was installed (Windows, Linux, MacOS X), the \textit{main window} opens when starting the program. The window title bar contains the version of \textit{PyCorrFit} and, if a session was re-opened or saved, the name of the fitting session. A menu bar provides access to many supporting tools and additional information as thoroughly described in \hyref{Chapter}{sec:menub}. 
 
 There are three gateways for experimental data into a pre-existing or a new \textit{PyCorrFit} session (\textit{File/Load data}, \textit{File/Open session}, and \textit{Current page/Import data}). When a session has been opened or correlation data have been loaded, each correlation curve is displayed on a separate page of a notebook. For quick identification of the active data set, a tab specifies the page number, the correlated channels (AC/CC), and the run number in cases where  multip [...]
 
diff --git a/pycorrfit/PyCorrFit.py b/pycorrfit/PyCorrFit.py
index 106f462..83a8b59 100644
--- a/pycorrfit/PyCorrFit.py
+++ b/pycorrfit/PyCorrFit.py
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
-""" PyScanFCS loader
+""" PyCorrFit loader
 """
-from os.path import dirname, join, abspath, split
+from os.path import dirname, abspath, split
 
 import sys
 sys.path = [split(abspath(dirname(__file__)))[0]] + sys.path
diff --git a/pycorrfit/__init__.py b/pycorrfit/__init__.py
index 5692da0..cf8204a 100644
--- a/pycorrfit/__init__.py
+++ b/pycorrfit/__init__.py
@@ -1,30 +1,7 @@
+#!/usr/bin/env python
 # -*- coding: utf-8 -*-
 """
-    In current biomedical research, fluorescence correlation spectroscopy (FCS)
-    is applied to characterize molecular dynamic processes in vitro and in living
-    cells. Commercial FCS setups only permit data analysis that is limited to a
-    specific instrument by the use of in-house file formats or a finite number of
-    implemented correlation model functions. PyCorrFit is a general-purpose FCS
-    evaluation software that, amongst other formats, supports the established Zeiss
-    ConfoCor3 ~.fcs file format. PyCorrFit comes with several built-in model
-    functions, covering a wide range of applications in standard confocal FCS.
-    In addition, it contains equations dealing with different excitation geometries
-    like total internal reflection (TIR).
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+PyCorrFit is a tool to fit correlation curves on a logarithmic scale.
 """
 
 from . import doc
@@ -35,6 +12,5 @@ from . import readfiles
 from .main import Main
 
 __version__ = doc.__version__
-__author__ = "Paul Mueller"
-__email__ = "paul.mueller at biotec.tu-dresden.de"
+__author__ = u"Paul Müller"
 __license__ = "GPL v2"
diff --git a/pycorrfit/__main__.py b/pycorrfit/__main__.py
index 6727f15..6887328 100644
--- a/pycorrfit/__main__.py
+++ b/pycorrfit/__main__.py
@@ -1,27 +1,6 @@
 # -*- coding: utf-8 -*-
 """
-    When a membrane is scanned perpendicularly to its surface, the
-    fluorescence signal originating from the membrane itself must be
-    separated from the signal of the surrounding medium for an FCS
-    analysis. PyCorrFit interactively extracts the fluctuating
-    fluorescence signal from such measurements and applies a
-    multiple-tau algorithm. The obtained correlation curves can be
-    evaluated using PyCorrFit.
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+Runs PyCorrFit
 """
 
 from . import doc
diff --git a/pycorrfit/doc.py b/pycorrfit/doc.py
index 263e9d9..1de9cc0 100755
--- a/pycorrfit/doc.py
+++ b/pycorrfit/doc.py
@@ -1,30 +1,8 @@
 # -*- coding: utf-8 -*-
-""" Documentation and program specific information
-
+"""
 PyCorrFit
 
-Dimensionless representation:
-unit of time        : 1 ms
-unit of inverse time: 10³ /s
-unit of distance    : 100 nm
-unit of Diff.coeff  : 10 µm²/s
-unit of inverse area: 100 /µm²
-unit of inv. volume : 1000 /µm³
-
-Copyright (C) 2011-2012  Paul Müller
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License 
-along with this program. If not, see <http://www.gnu.org/licenses/>.
+Documentation and program specific information
 """
 
 
@@ -70,14 +48,21 @@ import readfiles
 def GetLocationOfFile(filename):
     dirname = os.path.dirname(os.path.abspath(__file__))
     locations = [
-                    dirname+"/../",
-                    dirname+"/../pycorrfit_doc/",
-                    dirname+"/../doc/",
+                    os.path.realpath(dirname+"/../"),
+                    os.path.realpath(dirname+"/../pycorrfit_doc/"),
+                    os.path.realpath(dirname+"/../doc/"),
                 ]
+
+    for i in range(len(locations)):
+        # check /usr/lib64/32 -> /usr/lib
+        for larch in ["lib32", "lib64"]:
+            if dirname.count(larch):
+                locations.append(locations[i].replace(larch, "lib", 1))
+    
     ## freezed binaries:
     if hasattr(sys, 'frozen'):
         try:
-            adir = sys._MEIPASS + "/doc/"
+            adir = sys._MEIPASS + "/doc/"  # @UndefinedVariable
         except:
             adir = "./"
         locations.append(os.path.realpath(adir))
@@ -103,7 +88,7 @@ def info(version):
     """ Returns a little info about our program and what it can do.
     """
     textwin = u"""
-    Copyright 2011-2012 Paul Müller, Biotec - TU Dresden
+    Copyright 2011-2012 Paul Mueller, Biotec - TU Dresden
 
     A versatile tool for fitting and analyzing correlation curves.
 
@@ -111,9 +96,9 @@ def info(version):
     unit of time        : 1 ms
     unit of inverse time: 1000 /s
     unit of distance    : 100 nm
-    unit of Diff.coeff  : 10 µm²/s
-    unit of inverse area: 100 /µm²
-    unit of inv. volume : 1000 /µm^3 """
+    unit of Diff.coeff  : 10 um^2/s
+    unit of inverse area: 100 /um^2
+    unit of inv. volume : 1000 /um^3 """
     textlin = u"""
     © 2011-2012 Paul Müller, Biotec - TU Dresden
 
@@ -130,8 +115,8 @@ def info(version):
         texta = textwin
     else:
         texta = textlin
-    one = "    PyCorrFit version "+version+"\n\n"
-    two = "\n\n    Supported file types:"
+    one = u"    PyCorrFit version "+version+"\n\n"
+    two = u"\n\n    Supported file types:"
     keys = readfiles.Filetypes.keys()
     keys.sort()
     for item in keys:
@@ -177,7 +162,7 @@ def SoftwareUsed():
     if hasattr(sys, 'frozen'):
         pyinst = "\n\nThis executable has been created using PyInstaller."
         text += pyinst
-        if 'conda' in sys.version:
+        if 'Anaconda' in sys.version or "Continuum Analytics" in sys.version:
             conda = "\n\nPowered by Anaconda"
             text += conda
     return text
diff --git a/pycorrfit/edclasses.py b/pycorrfit/edclasses.py
index fd515eb..7a1ad07 100644
--- a/pycorrfit/edclasses.py
+++ b/pycorrfit/edclasses.py
@@ -1,24 +1,10 @@
 # -*- coding: utf-8 -*-
-""" PyCorrFit
-
-    EditedClasses
-    Contains classes that we edited.
-    Should make our classes more useful.
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
+"""
+PyCorrFit
 
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+EditedClasses
+Contains classes that we edited.
+Should make our classes more useful.
 """
 
 
@@ -36,12 +22,8 @@ with warnings.catch_warnings():
         matplotlib.use('WXAgg') # Tells matplotlib to use WxWidgets for dialogs
     except:
         pass
-# We will hack this toolbar here
-try:
-    from matplotlib.backends.backend_wx import NavigationToolbar2Wx 
-except ImportError:
-    pass
-    
+
+
 import numpy as np
 import sys
 import traceback
@@ -140,7 +122,7 @@ def save_figure(self, evt=None):
     # remove last |
     fieltypestring = fieltypestring[:-1]
     dlg = wx.FileDialog(parent, "Save figure", dirname, filename, 
-           fieltypestring, wx.SAVE|wx.OVERWRITE_PROMPT)
+           fieltypestring, wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT)
     # png is default
     dlg.SetFilterIndex(keys.index("png"))
     # user cannot do anything until he clicks "OK"
diff --git a/pycorrfit/fcs_data_set.py b/pycorrfit/fcs_data_set.py
deleted file mode 100644
index df86242..0000000
--- a/pycorrfit/fcs_data_set.py
+++ /dev/null
@@ -1,739 +0,0 @@
-# -*- coding: utf-8 -*-
-""" PyCorrFit data set
-
-Classes for FCS data evaluation.
-"""
-from __future__ import print_function, division
-
-
-import hashlib
-import numpy as np
-
-from . import models as mdls
-
-class Background(object):
-    """ A class to unify background handling
-    """
-    def __init__(self, coutrate=None, duration_s=None, trace=None,
-                 identifier=None, name=None):
-        """ Initiate a background.
-        
-        Parameters
-        ----------
-        coutrate : float
-            Average countrate [Hz].
-        duration_s : float
-            Duration of measurement in seconds.
-        trace : 2d `numpy.ndarray` of shape (N,2)
-            The trace (time [s], countrate [Hz]).
-            Overwrites `average` and `duration_s`
-        name : str
-            The name of the measurement.
-        identifier : str
-            A unique identifier. If not given, a sha256 hash will be
-            created.
-        
-        """
-        self.coutrate = coutrate
-        self.duration_s = duration_s
-        self.identifier = identifier
-        self.name = name
-            
-        if trace is not None:
-            self.trace = trace
-            self.coutrate = np.average(trace[:,1])
-            self.duration_s = trace[-1,0] - trace[0,0]
-        
-        ## Make sure all parameters have sensible values
-        if self.duration_s is None:
-            self.duration_s = 0
-        
-        if self.countrate is None:
-            self.countrate = 0
-        
-        if self.trace is None:
-            self.trace = np.zeros((2,2))
-            self.trace[:,1] = self.countrate
-            
-        if name is None:
-            self.name = "{:.2f kHz, {} s}".format(coutrate/1000,
-                                                  self.duration_s)
-        if identifier is None:
-            hasher = hashlib.sha256()
-            hasher.update(str(self.trace))
-            hasher.update(self.name)
-            self.identifier = hasher.hexdigest()            
-            
-           
-
-class FCSDataSet(object):
-    """ The class has all methods necessary for an FCS measurement.
-    
-    """
-    def __init__(self, ac=None, trace=None, trace2=None,
-                  ac2=None, cc12=None, cc21=None,
-                  background1=None, background2=None):
-        """ Initializes the FCS data set.
-        
-        All parms are 2d ndarrays of shape (N,2).
-        
-        """
-        self.filename = None
-        self.trace1 = trace
-        self.trace2 = trace2
-        self.ac1 = ac
-        self.ac2 = ac2
-        self.cc12 = cc12
-        self.cc21 = cc21
-
-        if background1 is not None:
-            self.background1 = Background(trace = background1)
-        if background2 is not None:
-            self.background2 = background(trace = background2)
-
-        self.InitComputeDerived()
-        self.DoBackgroundCorrection()
-        
-
-    def EnableBackgroundCorrection(self, enable=True):
-        """ Set to false to disable background correction.
-        """
-        self.UseBackgroundCorrection = enable
-        
-        
-    def InitComputeDerived(self):
-        """ Computes all parameters that can be derived from the
-            correlation data and traces themselves.
-        """
-        # lenght of traces determines auto- or cross-correlation
-        if self.cc12 is not None or self.cc21 is not None:
-            self.IsCrossCorrelation = True
-        else:
-            self.IsCrossCorrelation = False
-        if self.ac1 is not None or self.ac2 is not None:
-            self.IsAutCorrelation = True
-        else:
-            self.IsAutCorrelation = False
-        
-        if self.trace1 is not None:
-            self.duration1_s = self.trace1[-1,0] - self.trace1[0,0]
-            self.countrate1 = np.average(self.trace1[:,1])
-        else:
-            self.countrate1 = None
-            self.duration1_s = None
-
-        if self.trace2 is not None:
-            self.duration2_s = self.trace2[-1,0] - self.trace2[0,0]
-            self.countrate2 = np.average(self.trace2[:,1])
-        else:
-            self.duration2_s = None
-            self.countrate2 = None            
-
-
-        # Initial fitting range is entire data set
-        self.fit_range = {}
-        names = ["ac1", "ac2", "cc12", "cc21"]
-        for name in names:
-            if hasattr(self, name):
-                data = getattr(self, name)
-                self.fit_range[name] = (data[0,0], data[-1,0])
-
-
-
-    def DoBackgroundCorrection(self, data):
-        """ Performs background correction.
-        
-        Notes
-        -----
-        Thompson, N. Lakowicz, J.;
-        Geddes, C. D. & Lakowicz, J. R. (ed.)
-        Fluorescence Correlation Spectroscopy
-        Topics in Fluorescence Spectroscopy,
-        Springer US, 2002, 1, 337-378
-        """
-        # Autocorrelation
-        if ( not self.countrate1 in [0, None] and
-             self.background1 is not None and
-             self.ac1 is not None):
-            S = self.countrate1
-            B = self.background1.countrate
-            # Calculate correction factor
-            bgfactor = (S/(S-B))**2
-            # set plotting data
-            self.plot_ac1 = self.ac1 * bgfactor
-        if ( not self.countrate2 in [0, None] and
-             self.background2 is not None and
-             self.ac2 is not None):
-            S = self.countrate2
-            B = self.background2.countrate
-            # Calculate correction factor
-            bgfactor = (S/(S-B))**2
-            # set plotting data
-            self.plot_ac2 = self.ac2 * bgfactor            
-        
-        # Crosscorrelation
-        if ( not self.countrate1 in [0, None] and
-             not self.countrate2 in [0, None] and
-             self.background1 is not None and
-             self.background2 is not None and
-             self.IsCrossCorrelation
-           )
-            S = self.countrate1
-            S2 = self.countrate2
-            B = self.background1.countrate1
-            B2 = self.background1.countrate2
-            bgfactor = (S/(S-B)) * (S2/(S2-B2))
-            if self.cc12 is not None:
-                self.plot_cc12 = self.cc12 * bgfactor 
-            if self.cc21 is not None:
-                self.plot_cc21 = self.cc21 * bgfactor             
-            
-
-    def GetBackground(self):
-        """ Returns the backgrounds of the data set.
-        """
-        return self.background1, self.background2
-        
-    
-    def GetPlotCorrelation(self):
-        """ Returns a dictionary with correlation curves.
-        
-        Keys may include "ac1", "ac2", "cc12", "cc21" as well as
-        "ac1_fit", "ac2_fit", "cc12_fit", "cc21_fit".
-        """
-        if self.UseBackgroundCorrection:
-            self.DoBackgroundCorrection()
-    
-        result = dict()
-        
-        names = ["ac1", "ac2", "cc12", "cc21"]
-        
-        for name in names:
-            if not hasattr(self, "plot_"+name):
-                rawdata = getattr(self, name)
-                if rawdata is not None:
-                    result[name] = rawdata.copy()
-            else:
-                plotdata = getattr(self, name)
-                result[name] = plotdata.copy()
-            if hasattr(self, "plot_"+name+"_fit"):
-                fitted = getattr(self, "plot_"+name+"_fit")
-                result[name+"_fit"] = fitted.copy()
-
-        return result
-
-
-    def SetBackground(self, bgac1=None, bgac2=None):
-        """ Set the background of the measurement.
-        
-        `bg*` is an instance of `pycorrfit.Background`.
-        """
-        #if isinstance(background, Background):
-        #    self.background = bg
-        #elif isinstance(background, list)
-        self.background1 = bgac1
-        self.background2 = bgac2
-
-
-    def SetFitRange(self, start, end, components=None):
-        """ Set the range for fitting a correlation curve.
-        
-        The unit is seconds.
-        
-        Exapmles
-        --------
-        SetFitRange(.2, 1)
-        SetFitRange(.4, .7, ["ac2", "cc12"])
-        """
-        if components is not None:
-            self.fit_range = {"ac1" : (start,end),
-                              "ac2" : (start,end),
-                              "cc12": (start,end),
-                              "cc21": (start,end)  }
-        else:
-            for cc in components:
-                self.fitrange[cc] = (start,end)
-            
-
-
-class Fit(object):
-    """ Used for fitting FCS data to models.
-    """
-    def __init__(self, raw_data, model_id, model_parms=None,
-                 fit_bool=None, fit_ival=None, fit_ival_is_index=False,
-                 weight_type="none", weight_spread=0, weights=None,
-                 fit_algorithm="Lev-Mar",
-                 verbose=False, uselatex=False):
-        """ Using an FCS model, fit the data of shape (N,2).
-
-
-        Parameters
-        ----------
-        raw_data : 2d `numpy.ndarray` of shape (2,N)
-            The data to which should be fitted. The first column
-            contains the x data (time in s). The second column contains
-            the y values (correlation data).
-        mode_lid : int
-            Modelid as in `pycorrfit.models.modeldict.keys()`.
-        model_parms : array-type of length P
-            The initial parameters for the specific model.
-        fit_bool : bool array of length P
-            Defines the model parameters that are variable (True) or
-            fixed (False) durin fitting.
-        fit_ival : tuple
-            Interval of x values for fitting given in seconds or by
-            indices (see `fit_ival_is_index`). If the discrete array
-            does not match the interval, then the index closer towards
-            the center of the interval is used.
-        fit_ival_is_index : bool
-            Set to `True` if `fit_ival` is given in indices instead of
-            seconds.
-        weight_type : str
-            Type of weights. Should be one of
-
-                - 'none' (standard) : no weights.
-                - 'splineX' : fit a Xth order spline and calulate standard
-                        deviation from that difference
-                - 'model function' : calculate std. dev. from difference
-                        of fit function and dataexpfull.
-                - 'other' - use `weights`
-        
-        weight_spread : int
-            Number of values left and right from a data point to include
-            to weight a data point. The total number of points included
-            is 2*`weight_spread` + 1.
-        weights : 1d `numpy.ndarray` of length (N)
-            Weights to use when `weight_type` is set to 'other'.
-        fit_algorithm : str
-            The fitting algorithm to be used for minimization. Have a
-            look at the PyCorrFit documentation for more information.
-            Should be one of
-
-                - 'Lev-Mar' : Least squares minimization
-                - 'Nelder-Mead' : Simplex
-                - 'BFGS' : quasi-Newton method of Broyden,
-                         Fletcher, Goldfarb and Shanno
-                - 'Powell'
-                - 'Polak-Ribiere'
-        verbose : int
-            Increase verbosity by incrementing this number.
-        uselatex : bool
-            If verbose > 0, plotting will be performed with LaTeX.
-        """
-        self.y_full = raw_data[:,1].copy()
-        self.x_full = raw_data[:,0] * 1000 # convert to ms
-        
-        # model function
-        self.func = mdls.GetModelFunctionFromId(model_id)
-        
-        # fit parameters
-        if model_parms is None:
-            model_parms = mdls.GetModelParametersFromId(model_id)
-        self.model_parms = model_parms
-        self.model_parms_initial = 1*model_parms
-        
-        # values to fit
-        if fit_bool is None:
-            fit_bool = mdls.GetModelFitBoolFromId(model_id)
-        assert len(fit_bool) == len(model_parms)
-        self.fit_bool = fit_bool
-
-        # fiting interval
-        if fit_ival is None:
-            fit_ival = (self.x[0], self.x[-1])
-        assert fit_ival[0] < fit_ival[1]
-        self.fit_ival = fit_ival
-        
-        self.fit_ival_is_index = fit_ival_is_index
-        
-        
-        # weight type
-        assert weight_type.strip("1234567890") in ["none", "spline",
-                                              "model function", "other"]
-        self.weight_type = weight_type
-        
-        # weight spread
-        assert int(weight_spread) >= 0
-        self.weight_spread = int(weight_spread)
-        
-        # weights
-        if weight_type == "other":
-            assert isinstance(weights, np.ndarray)        
-        self.weights = weights
-
-        self.fit_algorithm = fit_algorithm
-        self.verbose = verbose
-        self.uselatex = uselatex
-
-        self.ComputetXYArrays()
-        self.ComputeWeights()
-
-        
-    def ComputeXYArrays(self):
-        """ Determine the fitting interval and set `self.x` and `self.y`
-        
-        Sets:
-        self.x
-        self.y
-        self.fit_ival_index
-        """
-        if not self.fit_ival_is_index:
-            # we need to compute the indices that are inside the
-            # fitting interval.
-            #
-            # interval in seconds:
-            # self.ival
-            #
-            # x values:
-            # self.x
-            #
-            start = np.sum(self.x <= self.ival[0]) - 1 
-            end = self.x.shape[0] - np.sum(self.x >= self.ival[1])
-            self.fit_ival_index = (start, end)
-        else:
-            self.fit_ival_index = start, end = self.fit_ival
-        # We now have two values. Both values will be included in the
-        # cropped arrays.
-        self.x = self.x_full[start:end+1]
-        self.y = self.y_full[start:end+1]
-
-
-    def ComputeWeights(self):
-        """ Determines if we have weights and computes them.
-         
-        sets
-        - self.fit_weights
-        - self.is_weighted_fit
-        """
-        ival = self.fit_ival_index
-        weight_spread = self.weight_spread
-        weight_type = self.weight_type
-
-        # some frequently used lengths
-        datalen = self.x.shape[0]
-        datalenfull = self.x_full.shape[0]        
-        # Calculated dataweights
-        dataweights = np.zeros(datalen)
-
-        self.is_weighted_fit = True # will be set to False if not weights
-
-        if weight_type[:6] == "spline":
-            # Number of knots to use for spline
-            try:
-                knotnumber = int(weight_type[6:])
-            except:
-                if self.verbose > 1:
-                    print("Could not get knot number. Setting it to 5.")
-                knotnumber = 5
-
-            # Compute borders for spline fit.
-            if ival[0] < weight_spread:
-                # optimal case
-                pmin = ival[0]
-            else:
-                # non-optimal case
-                # we need to cut pmin
-                pmin = weight_spread
-            if datalenfull - ival[1] < weight_spread:
-                # optimal case
-                pmax = datalenfull - ival[1]
-            else:
-                # non-optimal case
-                # we need to cut pmax
-                pmax = weight_spread
-            x = self.x_full[ival[0]-pmin:ival[1]+pmax]
-            y = self.y_full[ival[0]-pmin:ival[1]+pmax]
-            # we are fitting knots on a base 10 logarithmic scale.
-            xs = np.log10(x)
-            knots = np.linspace(xs[1], xs[-1], knotnumber+2)[1:-1]
-            try:
-                tck = spintp.splrep(xs, y, s=0, k=3, t=knots, task=-1)
-                ys = spintp.splev(xs, tck, der=0)
-            except:
-                if self.verbose > 0:
-                    raise ValueError("Could not find spline fit with "+\
-                                     "{} knots.".format(knotnumber))
-                return
-            if self.verbose > 0:
-                try:
-                    # If plotting module is available:
-                    name = "Spline fit: "+str(knotnumber)+" knots"
-                    plotting.savePlotSingle(name, 1*x, 1*y, 1*ys,
-                                             dirname=".",
-                                             uselatex=self.uselatex)
-                except:
-                    # use matplotlib.pylab
-                    try:
-                        from matplotlib import pylab as plt
-                        plt.xscale("log")
-                        plt.plot(x, ys, x, y)
-                        plt.show()
-                    except ImportError:
-                        # Tell the user to install matplotlib
-                        print("Couldn't import pylab! - not Plotting")
-
-            ## Calculation of variance
-            # In some cases, the actual cropping interval from ival[0]
-            # ro ival[1] is chosen, such that the dataweights must be
-            # calculated from unknown datapoints.
-            # (e.g. points+endcrop > len(dataexpfull)
-            # We deal with this by multiplying dataweights with a factor
-            # corresponding to the missed points.
-            for i in range(datalen):
-                # Define start and end positions of the sections from
-                # where we wish to calculate the dataweights.
-                # Offset at beginning:
-                if  i + ival[0] <  weight_spread:
-                    # The offset that occurs
-                    offsetstart = weight_spread - i - ival[0]
-                    offsetcrop = 0
-                elif ival[0] > weight_spread:
-                    offsetstart = 0
-                    offsetcrop = ival[0] - weight_spread
-                else:
-                    offsetstart = 0
-                    offsetcrop = 0
-                # i: counter on dataexp array
-                # start: counter on y array
-                start = i - weight_spread + offsetstart + ival[0] - offsetcrop
-                end = start + 2*weight_spread + 1 - offsetstart
-                dataweights[i] = (y[start:end] - ys[start:end]).std()
-                # The standard deviation at the end and the start of the
-                # array are multiplied by a factor corresponding to the
-                # number of bins that were not used for calculation of the
-                # standard deviation.
-                if offsetstart != 0:
-                    reference = 2*weight_spread + 1
-                    dividor = reference - offsetstart
-                    dataweights[i] *= reference/dividor   
-                # Do not substitute len(y[start:end]) with end-start!
-                # It is not the same!
-                backset =  2*weight_spread + 1 - len(y[start:end]) - offsetstart
-                if backset != 0:
-                    reference = 2*weight_spread + 1
-                    dividor = reference - backset
-                    dataweights[i] *= reference/dividor
-        elif weight_type == "model function":
-            # Number of neighbouring (left and right) points to include
-            if ival[0] < weight_spread:
-                pmin = ival[0]
-            else:
-                pmin = weight_spread
-            if datalenfull - ival[1] <  weight_spread:
-                pmax = datalenfull - self.ival[1]
-            else:
-                pmax = weight_spread
-            x = self.x_full[ival[0]-pmin:ival[1]+pmax]
-            y = self.y_full[ival[0]-pmin:ival[1]+pmax]
-            # Calculated dataweights
-            for i in np.arange(datalen):
-                # Define start and end positions of the sections from
-                # where we wish to calculate the dataweights.
-                # Offset at beginning:
-                if  i + ival[0] <  weight_spread:
-                    # The offset that occurs
-                    offsetstart = weight_spread - i - ival[0]
-                    offsetcrop = 0
-                elif ival[0] > weight_spread:
-                    offsetstart = 0
-                    offsetcrop = ival[0] - weight_spread
-                else:
-                    offsetstart = 0
-                    offsetcrop = 0
-                # i: counter on dataexp array
-                # start: counter on dataexpfull array
-                start = i - weight_spread + offsetstart + ival[0] - offsetcrop
-                end = start + 2*weight_spread + 1 - offsetstart
-                #start = ival[0] - weight_spread + i
-                #end = ival[0] + weight_spread + i + 1
-                diff = y - self.func(self.model_parms, x)
-                dataweights[i] = diff[start:end].std()
-                # The standard deviation at the end and the start of the
-                # array are multiplied by a factor corresponding to the
-                # number of bins that were not used for calculation of the
-                # standard deviation.
-                if offsetstart != 0:
-                    reference = 2*weight_spread + 1
-                    dividor = reference - offsetstart
-                    dataweights[i] *= reference/dividor   
-                # Do not substitute len(diff[start:end]) with end-start!
-                # It is not the same!
-                backset =  2*weight_spread + 1 - len(diff[start:end]) - offsetstart
-                if backset != 0:
-                    reference = 2*weight_spread + 1
-                    dividor = reference - backset
-                    dataweights[i] *= reference/dividor
-        elif self.fittype == "other":
-            # This means that the user knows the dataweights and already
-            # gave it to us.
-            assert self.weights is not None
-            
-            # Check if these other weights have length of the cropped
-            # or the full array.
-            if len(self.weights) == datalen:
-                dataweights = self.weights
-            elif len(self.weights) == datalenfull:
-                dataweights = self.weights[ival[0], ival[1]+1]
-            else:
-                raise ValueError, \
-                  "`weights` must have length of full or cropped array."
-        else:
-            # The fit.Fit() class will divide the function to minimize
-            # by the dataweights only if we have weights
-            self.is_weighted_fit = False
-        
-        self.fit_weights = dataweights
-        
-
-    def fit_func(self, parms, x):
-        """ Create the function to be minimized. The old function
-            `function` has more parameters than we need for the fitting.
-            So we use this function to set only the necessary 
-            parameters. Returns what `function` would have done.
-        """
-        # We reorder the needed variables to only use these that are
-        # not fixed for minimization
-        index = 0
-        for i in np.arange(len(self.model_parms)):
-            if self.fit_bool[i]:
-                self.model_parms[i] = parms[index]
-                index = index + 1
-        # Only allow physically correct parameters
-        self.model_parms = self.check_parms(self.model_parms)
-        tominimize = (self.func(self.model_parms, x) - self.y)
-        # Check if we have a weighted fit
-        if self.is_weighted_fit:
-            # Check dataweights for zeros and don't use these
-            # values for the least squares method.
-            with np.errstate(divide='ignore'):
-                tominimize = np.where(self.fit_weights!=0, 
-                                      tominimize/self.fit_weights, 0)
-            ## There might be NaN values because of zero weights:
-            #tominimize = tominimize[~np.isinf(tominimize)]
-        return tominimize
-
-
-    def fit_function_scalar(self, parms, x):
-        """
-            Wrapper of `fit_function` for scalar minimization methods.
-            Returns the sum of squares of the input data.
-            (Methods that are not "Lev-Mar")
-        """
-        e = self.fit_func(parms,x)
-        return np.sum(e*e)
-
-
-    def get_chi_squared(self):
-        """
-            Calculate Chi² for the current class.
-        """
-        # Calculate degrees of freedom
-        dof = len(self.x) - len(self.model_parms) - 1
-        # This is exactly what is minimized by the scalar minimizers
-        chi2 = self.fit_function_scalar(self.model_parms, self.x)
-        return chi2 / dof
-
-
-    def minimize(self):
-        """ This will minimize *self.fit_function()* using least squares.
-            *self.values*: The values with which the function is called.
-            *valuestofit*: A list with bool values that indicate which values
-            should be used for fitting.
-            Function *self.fit_function()* takes two parameters:
-            self.fit_function(parms, x) where *x* are x-values of *dataexp*.
-        """
-        assert (np.sum(self.fit_bool) == 0), "No parameter selected for fitting."
-
-        # Get algorithm
-        algorithm = Algorithms[self.fit_algorithm][0]
-
-        # Begin fitting
-        if self.fit_algorithm == "Lev-Mar":
-            res = algorithm(self.fit_function, self.fitparms[:],
-                            args=(self.x), full_output=1)
-        else:
-            res = algorithm(self.fit_function_scalar, self.fitparms[:],
-                            args=([self.x]), full_output=1)
-
-        # The optimal parameters
-        parmoptim = res[0]
-
-        # Now write the optimal parameters to our values:
-        index = 0
-        for i in range(len(self.model_parms)):
-            if self.valuestofit[i]:
-                self.model_parms[i] = parmoptim[index]
-                index = index + 1
-        # Only allow physically correct parameters
-        self.model_parms = self.check_parms(self.model_parms)
-        # Write optimal parameters back to this class.
-
-        self.chi = self.get_chi_squared()
-        
-        # Compute error estimates for fit (Only "Lev-Mar")
-        if self.fit_algorithm == "Lev-Mar":
-            # This is the standard way to minimize the data. Therefore,
-            # we are a little bit more verbose.
-            if res[4] not in [1,2,3,4]:
-                warnings.warn("Optimal parameters not found: " + res[3])
-            try:
-                self.covar = res[1] * self.chi # The covariance matrix
-            except:
-                warnings.warn("PyCorrFit Warning: Error estimate not "+\
-                              "possible, because we could not "+\
-                              "calculate covariance matrix. Please "+\
-                              "try reducing the number of fitting "+\
-                              "parameters.")
-                self.parmoptim_error = None
-            else:
-                # Error estimation of fitted parameters
-                if self.covar is not None:
-                    self.parmoptim_error = np.diag(self.covar)
-        else:
-            self.parmoptim_error = None
-
-
-
-def GetAlgorithmStringList():
-    """
-        Get supported fitting algorithms as strings.
-        Returns two lists (that are key-sorted) for key and string.
-    """
-    A = Algorithms
-    out1 = list()
-    out2 = list()
-    a = list(A.keys())
-    a.sort()
-    for key in a:
-        out1.append(key)
-        out2.append(A[key][1])
-    return out1, out2
-    
-
-# As of version 0.8.3, we support several minimization methods for
-# fitting data to experimental curves.
-# These functions must be callable like scipy.optimize.leastsq. e.g.
-# res = spopt.leastsq(self.fit_function, self.fitparms[:],
-#                     args=(self.x), full_output=1)
-Algorithms = dict()
-
-# the original one is the least squares fit "leastsq"
-Algorithms["Lev-Mar"] = [spopt.leastsq, 
-           "Levenberg-Marquardt"]
-
-# simplex 
-Algorithms["Nelder-Mead"] = [spopt.fmin,
-           "Nelder-Mead (downhill simplex)"]
-
-# quasi-Newton method of Broyden, Fletcher, Goldfarb, and Shanno
-Algorithms["BFGS"] = [spopt.fmin_bfgs,
-           "BFGS (quasi-Newton)"]
-
-# modified Powell-method
-Algorithms["Powell"] = [spopt.fmin_powell,
-           "modified Powell (conjugate direction)"]
-
-# nonliner conjugate gradient method by Polak and Ribiere
-Algorithms["Polak-Ribiere"] = [spopt.fmin_cg,
-           "Polak-Ribiere (nonlinear conjugate gradient)"]
-
diff --git a/pycorrfit/fitting.py b/pycorrfit/fitting.py
index 411ead9..97bddf8 100644
--- a/pycorrfit/fitting.py
+++ b/pycorrfit/fitting.py
@@ -1,24 +1,10 @@
 # -*- coding: utf-8 -*-
-""" PyCorrFit
-
-    Module fitting
-    Here are the necessary functions for computing a fit with given parameters.
-    See included class "Fit" for more information.
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
+"""
+PyCorrFit
 
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+Module fitting
+Here are the necessary functions for computing a fit with given parameters.
+See included class "Fit" for more information.
 """
 
 try:
diff --git a/pycorrfit/frontend.py b/pycorrfit/frontend.py
index 11d2e31..aac5592 100644
--- a/pycorrfit/frontend.py
+++ b/pycorrfit/frontend.py
@@ -1,39 +1,15 @@
 # -*- coding: utf-8 -*-
-u""" PyCorrFit - Module frontend
+"""
+PyCorrFit - Module "frontend"
 
 The frontend displays the GUI (Graphic User Interface). All necessary 
 functions and modules are called from here.
-
-Dimensionless representation:
-unit of time        : 1 ms
-unit of inverse time: 10³ /s
-unit of distance    : 100 nm
-unit of Diff.coeff  : 10 µm²/s
-unit of inverse area: 100 /µm²
-unit of inv. volume : 1000 /µm³
-
-Copyright (C) 2011-2012  Paul Müller
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License 
-along with this program. If not, see <http://www.gnu.org/licenses/>.
 """
 
 from distutils.version import LooseVersion # For version checking
 import os
 import webbrowser
-import wx                               # GUI interface wxPython
 import wx.lib.agw.flatnotebook as fnb   # Flatnotebook (Tabs)
-import wx.lib.delayedresult as delayedresult
 import wx.py.shell
 import numpy as np                      # NumPy
 import platform
@@ -65,16 +41,6 @@ from . import tools                        # Some tools
 from . import usermodel
 
 
-## On Windows XP I had problems with the unicode Characters.
-# I found this at 
-# http://stackoverflow.com/questions/5419/python-unicode-and-the-windows-console
-# and it helped:
-if platform.system() == 'Windows':
-    reload(sys)
-    sys.setdefaultencoding('utf-8')
-# ~paulmueller
-
-
 ########################################################################
 class ExceptionDialog(wx.MessageDialog):
     """"""
@@ -118,14 +84,14 @@ class MyApp(wx.App):
 
 ###########################################################
 class MyFrame(wx.Frame):
-    def __init__(self, parent, id, version):
+    def __init__(self, parent, anid, version):
 
         sys.excepthook = MyExceptionHook
         ## Set initial variables that make sense
         tau = 10**np.linspace(-6,8,1001)
 
         self.version = version
-        wx.Frame.__init__(self, parent, id, "PyCorrFit " + self.version)
+        wx.Frame.__init__(self, parent, anid, "PyCorrFit " + self.version)
         self.CreateStatusBar() # A Statusbar in the bottom of the window
         self.StatusBar.SetStatusText("Find help and updates online:"+
                                      " 'Help > Update'")
@@ -487,7 +453,7 @@ class MyFrame(wx.Frame):
         filters = "text file (*.txt)|*.txt"
         if modfile is None:
             dlg = wx.FileDialog(self, "Open model file", 
-                            self.dirname, "", filters, wx.OPEN)
+                            self.dirname, "", filters, wx.FD_OPEN)
             if dlg.ShowModal() == wx.ID_OK:
                 # Workaround since 0.7.5
                 (dirname, filename) = os.path.split(dlg.GetPath())
@@ -532,7 +498,6 @@ class MyFrame(wx.Frame):
             dlg = wx.MessageDialog(self, errstr, "Error", 
                 style=wx.ICON_ERROR|wx.OK|wx.STAY_ON_TOP)
             dlg.ShowModal()
-            del NewModel
             return
         # Test the code for sympy compatibility.
         # If you write your own parser, this might be easier.
@@ -553,7 +518,6 @@ class MyFrame(wx.Frame):
             if dlg2.ShowModal() == wx.ID_YES:
                 NewModel.ImportModel()
             else:
-                del NewModel
                 return
         else:
             # The model was loaded correctly
@@ -759,7 +723,7 @@ class MyFrame(wx.Frame):
                 # This is wx widgets stuff.
                 filters = filters+"|"
         dlg = wx.FileDialog(self, "Open data file", 
-            self.dirname, "", filters, wx.OPEN)
+            self.dirname, "", filters, wx.FD_OPEN)
         if dlg.ShowModal() == wx.ID_OK:
             # The filename the page will get
             path = dlg.GetPath()            # Workaround since 0.7.5
@@ -880,7 +844,7 @@ class MyFrame(wx.Frame):
         pc = self.notebook._pages
         # forget the zone that was initially clicked
         self._nLeftClickZone = fnb.FNB_NOWHERE
-        where, tabIdx = pc.HitTest(event.GetPosition())
+        where = pc.HitTest(event.GetPosition())[0]
         FNB_X = 2
         FNB_TAB_X = 3
         if not pc.HasAGWFlag(fnb.FNB_NO_TAB_FOCUS):
@@ -966,11 +930,11 @@ class MyFrame(wx.Frame):
             # do nothing
             return
         ## Check if we can use latex for plotting:
-        (r1, path) = misc.findprogram("latex")
-        (r2, path) = misc.findprogram("dvipng")
+        r1 = misc.findprogram("latex")[0]
+        r2 = misc.findprogram("dvipng")[0]
         # Ghostscript
-        (r31, path) = misc.findprogram("gs")
-        (r32, path) = misc.findprogram("mgs") # from miktex
+        r31 = misc.findprogram("gs")[0]
+        r32 = misc.findprogram("mgs")[0] # from miktex
         r3 = max(r31,r32)
         if r1+r2+r3 < 3:
             # Warn the user
@@ -1013,7 +977,7 @@ class MyFrame(wx.Frame):
                     # Add a separator if item is not last item
                     filters = filters+"|"
             dlg = wx.FileDialog(self, "Open data files", 
-                self.dirname, "", filters, wx.OPEN|wx.FD_MULTIPLE)
+                self.dirname, "", filters, wx.FD_OPEN|wx.FD_MULTIPLE)
             if dlg.ShowModal() == wx.ID_OK:
                 Datafiles = dlg.GetFilenames()
                 # We rely on sorted filenames
@@ -1033,16 +997,17 @@ class MyFrame(wx.Frame):
             if isinstance(dataname, list):
                 for item in dataname:
                     Datafiles.append(os.path.split(item)[1])
-                self.dirname, filename = os.path.split(Datafiles[0])
+                self.dirname = os.path.split(Datafiles[0])[0]
             else:
                 Datafiles.append(os.path.split(dataname)[1])
-                self.dirname, filename = os.path.split(dataname)
+                self.dirname = os.path.split(dataname)[0]
             Datafiles.sort()
 
         ## Get information from the data files and let the user choose
         ## which type of curves to load and the corresponding model.
         # List of filenames that could not be opened
         BadFiles = list()
+        Exceptions = list()
         # Lists for correlation, trace, type and names
         Correlation = list()
         Trace = list()
@@ -1066,11 +1031,15 @@ class MyFrame(wx.Frame):
             #Stuff = readfiles.openAny(self.dirname, afile)
             try:
                 Stuff = readfiles.openAny(self.dirname, afile)
-            except:
+            except Exception as excpt:
                 # The file does not seem to be what it seems to be.
                 BadFiles.append(afile)
+                Exceptions.append(excpt)
+                # Print exception
+                trb = traceback.format_exc(excpt)
+                trb = "..." + trb.replace("\n", "\n...")
                 warnings.warn("Problem processing a file."+\
-                  " Reason: {}.".format(sys.exc_info()[1].message))
+                  " Reason:\n{}".format(trb))
             else:
                 for i in np.arange(len(Stuff["Type"])):
                     Correlation.append(Stuff["Correlation"][i])
@@ -1096,8 +1065,10 @@ class MyFrame(wx.Frame):
         if len(BadFiles) > 0:
             # The file does not seem to be what it seems to be.
             errstr = "The following files could not be processed:\n"
-            for item in BadFiles:
-                errstr += " "+item
+            for item, excpt in zip(BadFiles, Exceptions):
+                trb = traceback.format_exc(excpt)
+                trb = "   " + trb.replace("\n", "\n   ")
+                errstr += " " + item + "\n" + trb 
             dlg = wx.MessageDialog(self, errstr, "Error", 
                 style=wx.ICON_WARNING|wx.OK|wx.CANCEL|wx.STAY_ON_TOP)
             if dlg.ShowModal() == wx.ID_CANCEL:
@@ -1267,7 +1238,7 @@ class MyFrame(wx.Frame):
                                                            wc[0], wc[1])
         if sessionfile is None:
             dlg = wx.FileDialog(self, "Open session file",
-                                self.dirname, "", wcstring, wx.OPEN)
+                                self.dirname, "", wcstring, wx.FD_OPEN)
             # user cannot do anything until he clicks "OK"
             if dlg.ShowModal() == wx.ID_OK:
                 sessionfile = dlg.GetPath()
@@ -1345,7 +1316,7 @@ class MyFrame(wx.Frame):
             # Import dataexp:
             number = counter.strip().strip(":").strip("#")
             pageid = int(number)
-            [tau, dataexp] = Infodict["Correlations"][pageid]
+            dataexp = Infodict["Correlations"][pageid][1]
             if dataexp is not None:
                 # Write experimental data
                 Newtab.dataexpfull = dataexp
@@ -1375,10 +1346,9 @@ class MyFrame(wx.Frame):
             else:
                 errdict = dict()
                 for errInfo in Sups["FitErr"]:
-                    for ierr in np.arange(len(errInfo)):
-                        errkey = mdls.valuedict[modelid][0][int(errInfo[0])]
-                        errval = float(errInfo[1])
-                        errdict[errkey] = errval
+                    errkey = mdls.valuedict[modelid][0][int(errInfo[0])]
+                    errval = float(errInfo[1])
+                    errdict[errkey] = errval
                 Newtab.parmoptim_error = errdict
                 try:
                     Newtab.GlobalParameterShare = Sups["Global Share"]
@@ -1439,7 +1409,7 @@ class MyFrame(wx.Frame):
         dlg = wx.FileDialog(self, "Save curve", self.dirname, filename, 
               "Correlation with trace (*.csv)|*.csv;*.CSV"+\
               "|Correlation only (*.csv)|*.csv;*.CSV",
-               wx.SAVE|wx.FD_OVERWRITE_PROMPT)
+               wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT)
         # user cannot do anything until he clicks "OK"
         if dlg.ShowModal() == wx.ID_OK:
             path = dlg.GetPath()            # Workaround since 0.7.5
@@ -1454,8 +1424,6 @@ class MyFrame(wx.Frame):
                 savetrace = False
             opf.ExportCorrelation(path, Page, tools.info,
                                   savetrace=savetrace)
-        else:
-            dirname = dlg.GetDirectory()
         
         dlg.Destroy()
 
@@ -1467,8 +1435,13 @@ class MyFrame(wx.Frame):
         verbose = self.MenuVerbose.IsChecked()
         show_weights = self.MenuShowWeights.IsChecked()
         Page = self.notebook.GetCurrentPage()
-        plotting.savePlotCorrelation(self, self.dirname, Page, uselatex,
+        try:
+            plotting.savePlotCorrelation(self, self.dirname, Page, uselatex,
                                      verbose, show_weights)
+        except NameError as excpt:
+            trb = traceback.format_exc(excpt)
+            trb = "   " + trb.replace("\n", "\n   ")
+            raise NameError("Please make sure matplotlib is installed:\n"+trb)
 
 
     def OnSavePlotTrace(self, e=None):
@@ -1477,7 +1450,12 @@ class MyFrame(wx.Frame):
         uselatex = 1*self.MenuUseLatex.IsChecked()
         verbose = 1*self.MenuVerbose.IsChecked()
         Page = self.notebook.GetCurrentPage()
-        plotting.savePlotTrace(self, self.dirname, Page, uselatex, verbose)
+        try:
+            plotting.savePlotTrace(self, self.dirname, Page, uselatex, verbose)
+        except NameError as excpt:
+            trb = traceback.format_exc(excpt)
+            trb = "   " + trb.replace("\n", "\n   ")
+            raise NameError("Please make sure matplotlib is installed:\n"+trb)
 
 
     def OnSaveSession(self,e=None):
@@ -1559,7 +1537,7 @@ class MyFrame(wx.Frame):
         # File dialog
         dlg = wx.FileDialog(self, "Save session file", self.dirname, "",
                             "PyCorrFit session (*.pcfs)|*.pcfs",
-                            wx.SAVE|wx.FD_OVERWRITE_PROMPT)
+                            wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT)
         if dlg.ShowModal() == wx.ID_OK:
             # Save everything
             path = dlg.GetPath()            # Workaround since 0.7.5
@@ -1694,10 +1672,17 @@ class MyFrame(wx.Frame):
             if len(Parms[2]) > len(mdls.valuedict[modelid][0]):
                 lindex = 1
                 changeTIRF = True
+        elif (modelid == 6022 and
+              len(Parms[2]) == len(mdls.valuedict[modelid][0]) + 1):
+            # Change in verson 0.8.7: TIRF_2D2D model remove d_eva
+            active_values = np.delete(active_values, 4)
+            active_fitting = np.delete(active_fitting, 4)
+           
         elif modelid in [6020, 6021, 6022, 6023]:
             if len(Parms[2]) > len(mdls.valuedict[modelid][0]):
                 lindex = 2
                 changeTIRF = True
+
         if changeTIRF:
             lamb = active_values[lindex]
             NA = active_values[lindex+1]
@@ -1800,7 +1785,7 @@ def MyExceptionHook(etype, value, trace):
     :param string `trace`: the traceback header, if any (otherwise, it prints the
      standard Python header: ``Traceback (most recent call last)``.
     """
-    frame = wx.GetApp().GetTopWindow()
+    wx.GetApp().GetTopWindow()
     tmp = traceback.format_exception(etype, value, trace)
     exception = "".join(tmp)
  
diff --git a/pycorrfit/main.py b/pycorrfit/main.py
index 3adeb6d..4b9458a 100755
--- a/pycorrfit/main.py
+++ b/pycorrfit/main.py
@@ -1,32 +1,11 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
-""" PyCorrFit
+"""
+PyCorrFit
 
 A flexible tool for fitting and analyzing correlation curves.
-
-Dimensionless representation:
-unit of time        : 1 ms
-unit of inverse time: 1000 /s
-unit of distance    : 100 nm
-unit of Diff.coeff  : 10 um^2/s
-unit of inverse area: 100 /um^2
-unit of inv. volume : 1000 /um^3
-
-Copyright (C) 2011-2012  Paul Müller
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License 
-along with this program. If not, see <http://www.gnu.org/licenses/>.
 """
+from __future__ import print_function
 
 from distutils.version import LooseVersion
 import sys
@@ -39,14 +18,6 @@ class Fake(object):
         self.version = "0.0 unknown"
         self.use = lambda x: None
 
-## On Windows XP I had problems with the unicode Characters.
-# I found this at 
-# http://stackoverflow.com/questions/5419/python-unicode-and-the-windows-console
-# and it helped (needs to be done before import of matplotlib):
-import platform
-if platform.system().lower in ['windows', 'darwin']:
-    reload(sys)
-    sys.setdefaultencoding('utf-8')
 
 # Import matplotlib a little earlier. This way some problems with saving
 # dialogs that are not made by "WXAgg" are solved.
@@ -64,20 +35,13 @@ import numpy as np                  # NumPy
 import os
 import scipy
 
-# A missing import hook prevented us from bundling PyCorrFit on Mac using
-# pyinstaller. The following imports solved that issue:
-try:
-    from scipy.sparse.csgraph import shortest_path
-    from scipy.sparse.csgraph import _validation
-except:
-    pass
 
 # Sympy is optional:
 try:
     import sympy
 except ImportError:
-    print "Importing sympy failed! Checking of external model functions"
-    print "will not work!"
+    print("Importing sympy failed! Checking of external model functions")
+    print("will not work!")
     # We create a fake module sympy with a __version__ property.
     # This way users can run PyCorrFit without having installed sympy.
     sympy = Fake()
@@ -103,13 +67,13 @@ def CheckVersion(given, required, name):
         req = LooseVersion(required)
         giv = LooseVersion(given)
     except:
-        print " WARNING: Could not verify version of "+name+"."
+        print(" WARNING: Could not verify version of "+name+".")
         return
     if req > giv:
-        print " WARNING: You are using "+name+" v. "+given+\
-              " | Required: "+name+" "+ required
+        print(" WARNING: You are using "+name+" v. "+given+\
+              " | Required: "+name+" "+ required)
     else:
-        print " OK: "+name+" v. "+given+" | "+required+" required"
+        print(" OK: "+name+" v. "+given+" | "+required+" required")
 
 
 ## Start gui
@@ -119,10 +83,10 @@ def Main():
     version = doc.__version__
     __version__ = version
 
-    print gui.doc.info(version)
+    print(gui.doc.info(version))
 
     ## Check important module versions
-    print "\n\nChecking module versions..."
+    print("\n\nChecking module versions...")
     CheckVersion(matplotlib.__version__, "1.0.0", "matplotlib")
     CheckVersion(np.__version__, "1.5.1", "NumPy")
     CheckVersion(yaml.__version__, "3.09", "PyYAML")
@@ -142,11 +106,11 @@ def Main():
     sysarg = sys.argv
     for arg in sysarg:
         if arg.endswith(".pcfs"):
-            print "\nLoading Session "+arg
+            print("\nLoading Session "+arg)
             frame.OnOpenSession(sessionfile=arg)
             break
         if arg.endswith(".fcsfit-session.zip"):
-            print "\nLoading Session "+arg
+            print("\nLoading Session "+arg)
             frame.OnOpenSession(sessionfile=arg)
             break
         elif arg[:6] == "python":
@@ -156,7 +120,7 @@ def Main():
         elif arg[-11:] == "__main__.py":
             pass
         else:
-            print "Ignoring command line parameter: "+arg
+            print("Ignoring command line parameter: "+arg)
 
 
     app.MainLoop()
diff --git a/pycorrfit/misc.py b/pycorrfit/misc.py
index 42dc526..43ac168 100644
--- a/pycorrfit/misc.py
+++ b/pycorrfit/misc.py
@@ -1,22 +1,9 @@
 # -*- coding: utf-8 -*-
-""" PyCorrFit
-
-    Module misc
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
+"""
+PyCorrFit
 
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+Module misc
+Non-science related code.
 """
 
 import codecs
@@ -27,7 +14,6 @@ import sys
 import tempfile
 import urllib2
 import webbrowser
-import wx                               # GUI interface wxPython
 import wx.html
 import wx.lib.delayedresult as delayedresult
 
@@ -47,7 +33,7 @@ class UpdateDlg(wx.Frame):
         pos = parent.GetPosition()
         pos = (pos[0]+100, pos[1]+100)
         wx.Frame.__init__(self, parent, wx.ID_ANY, title="Update", 
-                          size=(250,180), pos=pos)
+                          size=(230,240), pos=pos)
         self.changelog = changelog
         # Fill html content
         html = wxHTML(self)
@@ -81,7 +67,7 @@ class UpdateDlg(wx.Frame):
 
 
 class wxHTML(wx.html.HtmlWindow):
-    def OnLinkClicked(parent, link):
+    def OnLinkClicked(self, link):
         webbrowser.open(link.GetHref())
 
 
diff --git a/pycorrfit/models/MODEL_TIRF_1C.py b/pycorrfit/models/MODEL_TIRF_1C.py
index 87f4328..c237592 100755
--- a/pycorrfit/models/MODEL_TIRF_1C.py
+++ b/pycorrfit/models/MODEL_TIRF_1C.py
@@ -1,22 +1,6 @@
 # -*- coding: utf-8 -*-
 """
-    PyCorrFit
-    This file contains TIR one component models
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+This file contains TIR one component models
 """
 import numpy as np                  # NumPy
 import scipy.special as sps
@@ -135,8 +119,8 @@ def MoreInfo_6000(parms, countrate):
         Effective particle number in detection area:
         [6] N_eff = A_eff * C_2D
     """
-    D = parms[0]
-    sigma = parms[1]
+    #D = parms[0]
+    #sigma = parms[1]
     a = parms[2]
     Conc = parms[3]
     Info=list()
@@ -176,7 +160,7 @@ def MoreInfo_6010(parms, countrate):
     # 3D Model TIR square
     # 3D TIR (□xσ/exp),Simple 3D diffusion w/ TIR, fct.CF_Gxyz_square_tir
     # D [10 µm²/s],σ [100 nm],a [100 nm],d_eva [100 nm],[conc.] [1000 /µm³]
-    sigma = parms[1]
+    #sigma = parms[1]
     a = parms[2]
     d_eva = parms[3]
     conc = parms[4]
@@ -211,11 +195,16 @@ def MoreInfo_6010(parms, countrate):
 # 2D Model Square
 m_twodsq6000 = [6000, u"2D", u"2D diffusion w/ square pinhole",
                 CF_Gxy_TIR_square]
-labels_6000 = [u"D [10 µm²/s]", u"σ [100 nm]", "a [100 nm]", u"C_2D [100 /µm²]"]
+labels_6000 = [u"D [10 µm²/s]",
+               u"σ [100 nm]",
+               u"a [100 nm]",
+               u"C_2D [100 /µm²]"]
 values_6000 = [0.054, 2.3, 7.5, .6] # [D,lamb,NA,a,conc]
 # For user comfort we add values that are human readable.
 # Theese will be used for output that only humans can read.
-labels_human_readable_6000 = [u"D [µm²/s]", u"σ [nm]", "a [nm]",
+labels_human_readable_6000 = [u"D [µm²/s]",
+                              u"σ [nm]",
+                              u"a [nm]",
                               u"C_2D [1/µm²]"]
 values_factor_human_readable_6000 = [10, 100, 100, 100]
 valuestofit_6000 = [True, False, False, True]      # Use as fit parameter?
@@ -225,12 +214,18 @@ parms_6000 = [labels_6000, values_6000, valuestofit_6000,
 # 3D Model TIR square
 m_3dtirsq6010 = [6010, u"3D", "Simple 3D diffusion w/ TIR",
                  CF_Gxyz_TIR_square]
-labels_6010 = [u"D [10 µm²/s]", u"σ [100 nm]","a [100 nm]", "d_eva [100 nm]",
+labels_6010 = [u"D [10 µm²/s]",
+               u"σ [100 nm]",
+               u"a [100 nm]",
+               u"d_eva [100 nm]",
                u"C_3D [1000 /µm³]"]
 values_6010 = [0.520, 2.3, 7.5, 1.0, .0216]
 # For user comfort we add values that are human readable.
 # Theese will be used for output that only humans can read.
-labels_human_readable_6010 = [u"D [µm²/s]", u"σ [nm]", "a [nm]", "d_eva [nm]",
+labels_human_readable_6010 = [u"D [µm²/s]",
+                              u"σ [nm]",
+                              u"a [nm]",
+                              u"d_eva [nm]",
                               u"C_3D [1/µm³]"]
 values_factor_human_readable_6010 = [10, 100, 100, 100, 1000]
 valuestofit_6010 = [True, False, False, False, True]
diff --git a/pycorrfit/models/MODEL_TIRF_2D2D.py b/pycorrfit/models/MODEL_TIRF_2D2D.py
index 0b70609..3219031 100755
--- a/pycorrfit/models/MODEL_TIRF_2D2D.py
+++ b/pycorrfit/models/MODEL_TIRF_2D2D.py
@@ -1,22 +1,6 @@
 # -*- coding: utf-8 -*-
 """
-    PyCorrFit
-    This file contains 2D+2D TIR-FCS models.
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+This file contains 2D+2D TIR-FCS models.
 """
 import numpy as np                  # NumPy
 import scipy.special as sps
@@ -51,10 +35,9 @@ def CF_Gxy_TIR_square_2d2d(parms, tau, wixi=wixi):
         [2] σ      Lateral size of the point spread function
                    σ = σ₀ * λ / NA
         [3] a      Side size of the square-shaped detection area
-        [4] d_eva  Evanescent penetration depth
-        [5] C_2D1  Two-dimensional concentration of species 1
-        [6] C_2D2  Two-dimensional concentration of species 2
-        [7] α      Relative molecular brightness of particle
+        [4] C_2D1  Two-dimensional concentration of species 1
+        [5] C_2D2  Two-dimensional concentration of species 2
+        [6] α      Relative molecular brightness of particle
                    2 compared to particle 1 (α = q₂/q₁)
         *tau* - lag time
     """
@@ -62,10 +45,9 @@ def CF_Gxy_TIR_square_2d2d(parms, tau, wixi=wixi):
     D_2D2 = parms[1]
     sigma = parms[2]
     a = parms[3]
-    kappa = 1/parms[4]
-    Conc_2D1 = parms[5]
-    Conc_2D2 = parms[6]
-    alpha = parms[7]
+    Conc_2D1 = parms[4]
+    Conc_2D2 = parms[5]
+    alpha = parms[6]
 
     ## First the 2D-diffusion of species 1
     var1 = sigma**2+D_2D1*tau
@@ -96,13 +78,12 @@ def CF_Gxy_TIR_square_2d2d(parms, tau, wixi=wixi):
 # 2D-2D Model TIR
 m_tir_2d_2d_mix_6022 = [6022, u"2D+2D","Separate 2D diffusion, TIR", 
                         CF_Gxy_TIR_square_2d2d]
-labels_6022 = [ "D"+u"\u2081"+u" [10 µm²/s]",
-                "D"+u"\u2082"+u" [10 µm²/s]",
+labels_6022 = [ u"D"+u"\u2081"+u" [10 µm²/s]",
+                u"D"+u"\u2082"+u" [10 µm²/s]",
                 u"σ [100 nm]",
-                "a [100 nm]", 
-                "d_eva [100 nm]", 
-                "C"+u"\u2081"+u" [100 /µm²]", 
-                "C"+u"\u2082"+u" [100 /µm²]", 
+                u"a [100 nm]", 
+                u"C"+u"\u2081"+u" [100 /µm²]", 
+                u"C"+u"\u2082"+u" [100 /µm²]", 
                 u"\u03b1"+" (q"+u"\u2082"+"/q"+u"\u2081"+")"
                 ]
 values_6022 = [
@@ -110,7 +91,6 @@ values_6022 = [
                 0.01,    # D_2D₂ [10 µm²/s]
                 2.3,     # σ [100 nm]
                 7.50,    # a [100 nm]
-                1.0,     # d_eva [100 nm]
                 0.01,    # conc.2D₁ [100 /µm²]
                 0.03,    # conc.2D₂ [100 /µm²]
                 1        # alpha
@@ -118,13 +98,12 @@ values_6022 = [
 # For user comfort we add values that are human readable.
 # Theese will be used for output that only humans can read.
 labels_human_readable_6022 = [
-                "D"+u"\u2081"+u" [µm²/s]",
-                "D"+u"\u2082"+u" [µm²/s]",
+                u"D"+u"\u2081"+u" [µm²/s]",
+                u"D"+u"\u2082"+u" [µm²/s]",
                 u"σ [nm]",
-                "a [nm]", 
-                "d_eva [nm]", 
-                "C"+u"\u2081"+u" [1/µm²]", 
-                "C"+u"\u2082"+u" [1/µm²]", 
+                u"a [nm]", 
+                u"C"+u"\u2081"+u" [1/µm²]", 
+                u"C"+u"\u2082"+u" [1/µm²]", 
                 u"\u03b1"+" (q"+u"\u2082"+"/q"+u"\u2081"+")"
                 ]
 values_factor_human_readable_6022 = [
@@ -132,12 +111,11 @@ values_factor_human_readable_6022 = [
                 10,     # D_2D₂ [10 µm²/s]
                 100,    # σ [100 nm]
                 100,    # a [100 nm]
-                100,    # d_eva [100 nm]
                 100,    # conc.2D₁ [100 /µm²]
                 100,    # conc.2D₂ [100 /µm²]
                 1
                 ]
-valuestofit_6022 = [False, True, False, False, False, False, True, False]
+valuestofit_6022 = [False, True, False, False, False, True, False]
 parms_6022 = [labels_6022, values_6022, valuestofit_6022, 
               labels_human_readable_6022, values_factor_human_readable_6022]
 
diff --git a/pycorrfit/models/MODEL_TIRF_3D2D.py b/pycorrfit/models/MODEL_TIRF_3D2D.py
index b6e0d12..5055d75 100755
--- a/pycorrfit/models/MODEL_TIRF_3D2D.py
+++ b/pycorrfit/models/MODEL_TIRF_3D2D.py
@@ -1,22 +1,6 @@
 # -*- coding: utf-8 -*-
 """
-    PyCorrFit
-    This file contains 3D+2D TIR-FCS models.
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+This file contains 3D+2D TIR-FCS models.
 """
 import numpy as np                  # NumPy
 import scipy.special as sps
@@ -103,13 +87,13 @@ m_tir_3d_2d_mix_6020 = [6020, u"3D+2D",
                         "Separate 3D and 2D diffusion, 3D TIR",
                         CF_Gxyz_TIR_square_3d2d]
 labels_6020 = [u"D_3D [10 µm²/s]",
-                u"D_2D [10 µm²/s]",
-                u"σ [100 nm]",
-                "a [100 nm]", 
-                "d_eva [100 nm]", 
-                u"C_3D [1000 /µm³]", 
-                u"C_2D [100 /µm²]", 
-                u"\u03b1"+" (q3D/q2D)"
+               u"D_2D [10 µm²/s]",
+               u"σ [100 nm]",
+               u"a [100 nm]", 
+               u"d_eva [100 nm]", 
+               u"C_3D [1000 /µm³]", 
+               u"C_2D [100 /µm²]", 
+               u"\u03b1"+" (q3D/q2D)"
                 ]
 values_6020 = [
                 50.0,     # D_3D [10 µm²/s]
@@ -123,11 +107,12 @@ values_6020 = [
                 ]        
 # For user comfort we add values that are human readable.
 # Theese will be used for output that only humans can read.
-labels_human_readable_6020 = ["D_3D [µm²/s]",
+labels_human_readable_6020 = [
+                u"D_3D [µm²/s]",
                 u"D_2D [µm²/s]",
                 u"σ [nm]",
-                "a [nm]", 
-                "d_eva [nm]", 
+                u"a [nm]", 
+                u"d_eva [nm]", 
                 u"C_3D [1/µm³]", 
                 u"C_2D [1/µm²]", 
                 u"\u03b1"+" (q3D/q2D)"
diff --git a/pycorrfit/models/MODEL_TIRF_3D2Dkin_Ries.py b/pycorrfit/models/MODEL_TIRF_3D2Dkin_Ries.py
index 1723cc0..d4764da 100755
--- a/pycorrfit/models/MODEL_TIRF_3D2Dkin_Ries.py
+++ b/pycorrfit/models/MODEL_TIRF_3D2Dkin_Ries.py
@@ -1,27 +1,10 @@
 # -*- coding: utf-8 -*-
 """ 
-    PyCorrFit
-
-    This file contains a TIR-FCS kineteics model function according to:
-    "Total Internal Reflection Fluorescence Correlation Spectroscopy: Effects
-    of Lateral Diffusion and Surface-Generated Fluorescence"
-    Jonas Ries, Eugene P. Petrov, and Petra Schwille
-    Biophysical Journal, Volume 95, July 2008, 390–399
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+This file contains a TIR-FCS kineteics model function according to:
+"Total Internal Reflection Fluorescence Correlation Spectroscopy: Effects
+of Lateral Diffusion and Surface-Generated Fluorescence"
+Jonas Ries, Eugene P. Petrov, and Petra Schwille
+Biophysical Journal, Volume 95, July 2008, 390–399
 """
 import numpy as np                  # NumPy
 import scipy.special as sps
@@ -99,10 +82,10 @@ def CF_gz_CC(parms, tau, wixi=wixi):
         *tau* - lag time
     """
     D = parms[0]
-    # D_2D = parms[1]
-    sigma = parms[2]
+    #D_2D = parms[1]
+    #sigma = parms[2]
     # a = parms[3]
-    d_eva = parms[4]
+    #d_eva = parms[4]
     Conc_3D = parms[5]      # ligand concentration in solution
     Conc_2D = parms[6]
     eta_3D = parms[7]
@@ -112,7 +95,7 @@ def CF_gz_CC(parms, tau, wixi=wixi):
     # Define some other constants:
     K = k_a/k_d              # equilibrium constant
     Beta = 1/(1 + K*Conc_3D) # This is wrong in the Ries paper
-    Re = D / d_eva**2
+    #Re = D / d_eva**2
     Rt = D * (Conc_3D / (Beta * Conc_2D))**2
     Rr = k_a * Conc_3D + k_d
     # Define even more constants:
@@ -152,8 +135,8 @@ def CF_gz_AC(parms, tau, wixi=wixi):
         *tau* - lag time
     """
     D = parms[0]
-    # D_2D = parms[1]
-    sigma = parms[2]
+    #D_2D = parms[1]
+    #sigma = parms[2]
     # a = parms[3]
     d_eva = parms[4]
     Conc_3D = parms[5]      # ligand concentration in solution
@@ -176,13 +159,13 @@ def CF_gz_AC(parms, tau, wixi=wixi):
     # And even more more:
     sqrtR3 = sqrtR1 + nps.sqrt(Re)
     sqrtR4 = sqrtR2 + nps.sqrt(Re)
-    R3 = sqrtR3 **2
-    R4 = sqrtR4 **2
+    #R3 = sqrtR3 **2
+    #R4 = sqrtR4 **2
     # Calculate return function
     A1 = eta_2D * Conc_2D * k_d / (eta_3D * Conc_3D)
     A2 = sqrtR4*wixi(-nps.sqrt(tau*R1)) - sqrtR3*wixi(-nps.sqrt(tau*R2))
-    A3 = ( sqrtR1 - sqrtR2 ) * wixi(nps.sqrt(tau*Re))
-    A4 = (sqrtR1 - sqrtR2) * sqrtR3*sqrtR4
+    A3 = ( sqrtR1 - sqrtR2 ) * wixi( nps.sqrt(tau*Re) )
+    A4 = ( sqrtR1 - sqrtR2 ) * sqrtR3 * sqrtR4
     Solution = A1 * ( A2 + A3 ) / A4
     # There are some below numerical errors-imaginary numbers.
     # We do not want them.
@@ -211,8 +194,8 @@ def CF_gz_AA(parms, tau, wixi=wixi):
         *tau* - lag time
     """
     D = parms[0]
-    # D_2D = parms[1]
-    sigma = parms[2]
+    #D_2D = parms[1]
+    #sigma = parms[2]
     # a = parms[3]
     d_eva = parms[4]
     Conc_3D = parms[5]      # ligand concentration in solution
@@ -303,8 +286,8 @@ def CF_Gxyz_TIR_square_ubibi(parms, tau,
     Conc_2D = parms[6]
     eta_3D = parms[7]
     eta_2D = parms[8]
-    k_a = parms[9]
-    k_d = parms[10]
+    #k_a = parms[9]
+    #k_d = parms[10]
     ## We now need to copmute a real beast:
     # Inter species non-normalized correlation functions
     # gAA = gAAz * gxy(D_3D)
@@ -353,16 +336,16 @@ m_tir_3d_2d_ubib6021 = [6021, u"3D+2D+kin",
                         "Surface binding and unbinding, 3D TIR",
                         CF_Gxyz_TIR_square_ubibi]
 labels_6021 = [u"D_3D [10 µm²/s]",
-                u"D_2D [10 µm²/s]",
-                u"σ [100 nm]",
-                "a [100 nm]", 
-                "d_eva [100 nm]", 
-                u"C_3D [1000 /µm³]", 
-                u"C_2D[100 /µm²]", 
-                u"η_3D", 
-                u"η_2D", 
-                u"k_a [µm³/s]", 
-                u"k_d [10³ /s]"
+               u"D_2D [10 µm²/s]",
+               u"σ [100 nm]",
+               u"a [100 nm]", 
+               u"d_eva [100 nm]", 
+               u"C_3D [1000 /µm³]", 
+               u"C_2D[100 /µm²]", 
+               u"η_3D", 
+               u"η_2D", 
+               u"k_a [µm³/s]", 
+               u"k_d [10³ /s]"
                 ]
 values_6021 = [
                 9.0,      # D_3D [10 µm²/s]
@@ -385,14 +368,14 @@ labels_human_readable_6021 = [
                 u"D_3D [µm²/s]",
                 u"D_2D [µm²/s]",
                 u"σ [nm]",
-                "a [nm]", 
-                "d_eva [nm]", 
+                u"a [nm]", 
+                u"d_eva [nm]", 
                 u"C_3D [1/µm³]", 
                 u"C_2D [1/µm²]", 
                 u"η_3D", 
                 u"η_2D", 
                 u"k_a [µm³/s]", 
-                "k_d [1/s]"
+                u"k_d [1/s]"
                 ]
 values_factor_human_readable_6021 = [10, # "D_3D [µm²/s]",
                 10,     # D_2D [10 µm²/s]
diff --git a/pycorrfit/models/MODEL_TIRF_3D3D.py b/pycorrfit/models/MODEL_TIRF_3D3D.py
index 78a521b..2a9fb58 100755
--- a/pycorrfit/models/MODEL_TIRF_3D3D.py
+++ b/pycorrfit/models/MODEL_TIRF_3D3D.py
@@ -1,22 +1,6 @@
 # -*- coding: utf-8 -*-
 """
-    PyCorrFit
-    This file contains 3D+3D TIR-FCS models.
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+This file contains 3D+3D TIR-FCS models.
 """
 import numpy as np                  # NumPy
 import scipy.special as sps
@@ -108,13 +92,13 @@ def CF_Gxyz_TIR_square_3d3d(parms, tau, wixi=wixi):
 m_tir_3d_3d_mix_6023 = [6023, u"3D+3D",
                         "Separate 3D diffusion, 3D TIR",
                         CF_Gxyz_TIR_square_3d3d]
-labels_6023 = ["D"+u"\u2081"+u" [10 µm²/s]",
-               "D"+u"\u2082"+u" [10 µm²/s]",
+labels_6023 = [u"D"+u"\u2081"+u" [10 µm²/s]",
+               u"D"+u"\u2082"+u" [10 µm²/s]",
                u"σ [100 nm]",
-               "a [100 nm]", 
-               "d_eva [100 nm]", 
-               "C"+u"\u2081"+u" [1000 /µm³]", 
-               "C"+u"\u2082"+u" [1000 /µm³]", 
+               u"a [100 nm]", 
+               u"d_eva [100 nm]", 
+               u"C"+u"\u2081"+u" [1000 /µm³]", 
+               u"C"+u"\u2082"+u" [1000 /µm³]", 
                u"\u03b1"+" (q"+u"\u2082"+"/q"+u"\u2081"+")"
                 ]
 values_6023 = [
@@ -129,13 +113,14 @@ values_6023 = [
                 ]        
 # For user comfort we add values that are human readable.
 # Theese will be used for output that only humans can read.
-labels_human_readable_6023 = ["D"+u"\u2081"+u" [µm²/s]",
-                "D"+u"\u2082"+u" [µm²/s]",
+labels_human_readable_6023 = [
+                u"D"+u"\u2081"+u" [µm²/s]",
+                u"D"+u"\u2082"+u" [µm²/s]",
                 u"σ [nm]",
-                "a [nm]", 
-                "d_eva [nm]", 
-                "C"+u"\u2081"+u" [1/µm³]", 
-                "C"+u"\u2082"+u" [1/µm³]", 
+                u"a [nm]", 
+                u"d_eva [nm]", 
+                u"C"+u"\u2081"+u" [1/µm³]", 
+                u"C"+u"\u2082"+u" [1/µm³]", 
                 u"\u03b1"+" (q"+u"\u2082"+"/q"+u"\u2081"+")"
                 ]
 values_factor_human_readable_6023 = [10, # "D_3D₁ [µm²/s]",
diff --git a/pycorrfit/models/MODEL_TIRF_gaussian_1C.py b/pycorrfit/models/MODEL_TIRF_gaussian_1C.py
index 8352f26..b74ad2b 100755
--- a/pycorrfit/models/MODEL_TIRF_gaussian_1C.py
+++ b/pycorrfit/models/MODEL_TIRF_gaussian_1C.py
@@ -1,22 +1,6 @@
 # -*- coding: utf-8 -*-
 """
-    PyCorrFit
-    This file contains TIR one component models + Triplet
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+This file contains TIR one component models + Triplet
 """
 import numpy as np                  # NumPy
 import scipy.special as sps
@@ -168,7 +152,7 @@ def MoreInfo_6013(parms, countrate):
         Effective particle concentration:
         [6] C_3D [nM] = C_3D [1000/µm³] * 10000/6.0221415
     """
-    D = parms[0]
+    #D = parms[0]
     r0 = parms[1]
     deva = parms[2]
     Conc = parms[3]
@@ -198,7 +182,7 @@ def MoreInfo_6014(parms, countrate):
         Effective particle concentration:
         [8] C_3D [nM] = C_3D [1000/µm³] * 10000/6.0221415
     """
-    D = parms[0]
+    #D = parms[0]
     r0 = parms[1]
     deva = parms[2]
     Conc = parms[3]
diff --git a/pycorrfit/models/MODEL_TIRF_gaussian_3D2D.py b/pycorrfit/models/MODEL_TIRF_gaussian_3D2D.py
index 3c31a7d..64a8b6a 100755
--- a/pycorrfit/models/MODEL_TIRF_gaussian_3D2D.py
+++ b/pycorrfit/models/MODEL_TIRF_gaussian_3D2D.py
@@ -1,22 +1,6 @@
 # -*- coding: utf-8 -*-
 """
-    PyCorrFit
-    This file contains a 3D+2D+T TIR FCS model.
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+This file contains a 3D+2D+T TIR FCS model.
 """
 from __future__ import division
 
@@ -124,18 +108,18 @@ def CF_Gxyz_3d2dT_gauss(parms, tau):
 
 def Checkme(parms):
     parms[0] = np.abs(parms[0])
-    parms[1] = D2D = np.abs(parms[1])
-    parms[2] = D3D = np.abs(parms[2])
+    parms[1] = np.abs(parms[1]) # = D2D
+    parms[2] = np.abs(parms[2]) # = D3D
     F=parms[3]
-    parms[4] = r0 = np.abs(parms[4])
+    parms[4] = np.abs(parms[4]) # = r0
     parms[5]=np.abs(parms[5])
     parms[6]=np.abs(parms[6])
     tautrip=np.abs(parms[7])
     T=parms[8]
-    off=parms[9]
+    #off=parms[9]
 
-    taud2D = r0**2/(4*D2D)
-    taud3D = r0**2/(4*D3D)
+    #taud2D = r0**2/(4*D2D)
+    #taud3D = r0**2/(4*D3D)
     # We are not doing this anymore (Issue #2).
     ## Force triplet component to be smaller than diffusion times
     ## tautrip = min(tautrip,taud2D*0.9, taud3D*0.9)
@@ -169,12 +153,12 @@ def MoreInfo(parms, countrate):
     """
     # We can only give you the effective particle number
     n=parms[0]
-    D2D=parms[1]
-    D3D=parms[2]
+    #D2D=parms[1]
+    #D3D=parms[2]
     F=parms[3]
     r0=parms[4]
     deva=parms[5]
-    alpha=parms[6]
+    #alpha=parms[6]
 
     Info=list()
     # The enumeration of these parameters is very important for
@@ -187,15 +171,15 @@ def MoreInfo(parms, countrate):
     C2D = n*(1-F) / ( np.pi*r0**2 )
     # Correlation function at tau = 0
     G_0 = CF_Gxyz_3d2dT_gauss(parms, 0)
-    Info.append(["G(0)", G_0])
-    Info.append(["V_eff [al]", Veff])
-    Info.append(["C_2D [1/µm²]", C2D * 100])
-    Info.append(["C_3D [nM]", C3D * 10000/6.0221415])
+    Info.append([u"G(0)", G_0])
+    Info.append([u"V_eff [al]", Veff])
+    Info.append([u"C_2D [1/µm²]", C2D * 100])
+    Info.append([u"C_3D [nM]", C3D * 10000/6.0221415])
 
     if countrate is not None:
         # CPP
         cpp = countrate/n
-        Info.append(["cpp [kHz]", cpp])
+        Info.append([u"cpp [kHz]", cpp])
     return Info
 
 
@@ -203,16 +187,16 @@ def MoreInfo(parms, countrate):
 m_gauss_3d_2d_t = [6033, "T+3D+2D",
                             "Separate 3D and 2D diffusion + triplet w/ TIR",
                             CF_Gxyz_3d2dT_gauss]
-labels  = ["n",
-                u"D_2D [10 µm²/s]",
-                u"D_3D [10 µm²/s]",
-                "F_3D", 
-                u"r₀ [100 nm]",
-                "d_eva [100 nm]",
-                u"\u03b1"+" (q_3D/q_2D)", 
-                u"τ_trip [ms]",
-                "T",
-                "offset"
+labels  = [ u"n",
+            u"D_2D [10 µm²/s]",
+            u"D_3D [10 µm²/s]",
+            u"F_3D", 
+            u"r₀ [100 nm]",
+            u"d_eva [100 nm]",
+            u"\u03b1"+" (q_3D/q_2D)", 
+            u"τ_trip [ms]",
+            u"T",
+            u"offset"
                 ]
 values = [ 
                 25,      # n
@@ -227,16 +211,16 @@ values = [
                 0.0      # offset
                 ]  
 # Human readable stuff
-labelshr  = ["n",
-                u"D_2D [µm²/s]",
-                u"D_3D [µm²/s]",
-                "F_3D", 
-                u"r₀ [nm]",
-                "d_eva [nm]",
-                u"\u03b1"+" (q_3D/q_2D)", 
-                u"τ_trip [µs]",
-                "T",
-                "offset"
+labelshr  = [u"n",
+             u"D_2D [µm²/s]",
+             u"D_3D [µm²/s]",
+             u"F_3D", 
+             u"r₀ [nm]",
+             u"d_eva [nm]",
+             u"\u03b1"+" (q_3D/q_2D)", 
+             u"τ_trip [µs]",
+             u"T",
+             u"offset"
                 ] 
 valueshr = [ 
                 1.,      # n
diff --git a/pycorrfit/models/MODEL_TIRF_gaussian_3D3D.py b/pycorrfit/models/MODEL_TIRF_gaussian_3D3D.py
index 0461635..751e9e7 100755
--- a/pycorrfit/models/MODEL_TIRF_gaussian_3D3D.py
+++ b/pycorrfit/models/MODEL_TIRF_gaussian_3D3D.py
@@ -1,22 +1,6 @@
 # -*- coding: utf-8 -*-
 """ 
-    PyCorrFit
-    This file contains a 3D+3D+T TIR FCS model.
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+This file contains a 3D+3D+T TIR FCS model.
 """
 from __future__ import division
 
@@ -141,15 +125,15 @@ def CF_Gxyz_3D3DT_gauss(parms, tau):
 
 def Checkme(parms):
     parms[0] = np.abs(parms[0])
-    parms[1] = D1 = np.abs(parms[1])
-    parms[2] = D2 = np.abs(parms[2])
+    parms[1] = np.abs(parms[1]) # = D1
+    parms[2] = np.abs(parms[2]) # = D2
     F=parms[3]
-    parms[4] = r0 = np.abs(parms[4])
+    parms[4] = np.abs(parms[4]) # = r0
     parms[5]=np.abs(parms[5])
     parms[6]=np.abs(parms[6])
     tautrip=np.abs(parms[7])
     T=parms[8]
-    off=parms[9]
+    #off=parms[9]
 
     # REMOVED (issue #2)
     ## Force triplet component to be smaller than diffusion times
@@ -186,12 +170,12 @@ def MoreInfo(parms, countrate):
     """
     # We can only give you the effective particle number
     n=parms[0]
-    D1=parms[1]
-    D2=parms[2]
+    #D1=parms[1]
+    #D2=parms[2]
     F=parms[3]
     r0=parms[4]
     deva=parms[5]
-    alpha=parms[6]
+    #alpha=parms[6]
 
     Info=list()
     # The enumeration of these parameters is very important for
@@ -220,16 +204,16 @@ def MoreInfo(parms, countrate):
 m_gauss_3d_3d_t = [6034, "T+3D+3D",
                             "Combined 3D diffusion + triplet w/ TIR",
                             CF_Gxyz_3D3DT_gauss]
-labels  = ["n",
-                "D"+u"\u2081"+" [10 µm²/s]",
-                "D"+u"\u2082"+" [10 µm²/s]",
-                "F"+u"\u2081", 
-                "r₀ [100 nm]",
-                "d_eva [100 nm]",
-                u"\u03b1"+" (q"+u"\u2082"+"/q"+u"\u2081"+")", 
-                u"τ_trip [ms]",
-                "T",
-                "offset"
+labels  = [u"n",
+           u"D"+u"\u2081"+u" [10 µm²/s]",
+           u"D"+u"\u2082"+u" [10 µm²/s]",
+           u"F"+u"\u2081", 
+           u"r₀ [100 nm]",
+           u"d_eva [100 nm]",
+           u"\u03b1"+" (q"+u"\u2082"+"/q"+u"\u2081"+")", 
+           u"τ_trip [ms]",
+           u"T",
+           u"offset"
                 ]
 values = [ 
                 25,      # n
@@ -244,16 +228,16 @@ values = [
                 0.0      # offset
                 ]    
 # Human readable stuff
-labelshr  = ["n",
-                "D"+u"\u2081"+u" [µm²/s]",
-                "D"+u"\u2082"+u" [µm²/s]",
-                "F"+u"\u2081", 
-                "r₀ [nm]",
-                "d_eva [nm]",
+labelshr  = [   u"n",
+                u"D"+u"\u2081"+u" [µm²/s]",
+                u"D"+u"\u2082"+u" [µm²/s]",
+                u"F"+u"\u2081", 
+                u"r₀ [nm]",
+                u"d_eva [nm]",
                 u"\u03b1"+" (q"+u"\u2082"+"/q"+u"\u2081"+")", 
                 u"τ_trip [µs]",
-                "T",
-                "offset"
+                u"T",
+                u"offset"
                 ]
 valueshr = [ 
                 1.,      # n
diff --git a/pycorrfit/models/MODEL_classic_gaussian_2D.py b/pycorrfit/models/MODEL_classic_gaussian_2D.py
index cab7c77..5601c49 100755
--- a/pycorrfit/models/MODEL_classic_gaussian_2D.py
+++ b/pycorrfit/models/MODEL_classic_gaussian_2D.py
@@ -1,22 +1,6 @@
 # -*- coding: utf-8 -*-
 """
-    PyCorrFit
-    This file contains some simple 2D models for confocal microscopy
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+This file contains some simple 2D models for confocal microscopy
 """
 from __future__ import division
 
@@ -101,7 +85,7 @@ def CF_Gxy_T_gauss(parms, tau):
 
 def Check_xy_T_gauss(parms):
     parms[0] = np.abs(parms[0])
-    taudiff = parms[1] = np.abs(parms[1])
+    parms[1] = np.abs(parms[1]) # = taudiff
     tautrip = np.abs(parms[2])
     T=parms[3]
 
@@ -168,13 +152,13 @@ def CF_Gxyz_gauss_2D2DT(parms, tau):
 
 def Check_6031(parms):
     parms[0] = np.abs(parms[0])
-    parms[1] = taud1 = np.abs(parms[1])
-    parms[2] = taud2 = np.abs(parms[2])
+    parms[1] = np.abs(parms[1]) # = taud1
+    parms[2] = np.abs(parms[2]) # = taud2
     F=parms[3]
     parms[4] = np.abs(parms[4])
     tautrip = np.abs(parms[5])
     T=parms[6]
-    off=parms[7]
+    #off=parms[7]
     
      
     # Triplet fraction is between 0 and one. T may not be one!
@@ -222,7 +206,9 @@ def MoreInfo_6031(parms, countrate):
 
 # 2D Model Gauss
 m_twodga6001 = [6001, u"2D", u"2D confocal diffusion", CF_Gxy_gauss]
-labels_6001 = ["n", u"τ_diff [ms]", "offset"]
+labels_6001 = [u"n",
+               u"τ_diff [ms]",
+               u"offset"]
 values_6001 = [4.0, 0.4, 0.0]
 valuestofit_6001 = [True, True, False]
 parms_6001 = [labels_6001, values_6001, valuestofit_6001]
@@ -231,9 +217,17 @@ parms_6001 = [labels_6001, values_6001, valuestofit_6001]
 # 2D Model Gauss with Triplet
 m_twodga6002 = [6002, u"T+2D", u"2D confocal diffusion with triplet", 
                 CF_Gxy_T_gauss]
-labels_6002 = ["n", u"τ_diff [ms]",  u"τ_trip [ms]", u"T", u"offset"]
+labels_6002 = [u"n",
+               u"τ_diff [ms]",
+               u"τ_trip [ms]",
+               u"T",
+               u"offset"]
 values_6002 = [4.0, 0.4, 0.001, 0.01, 0.0]
-labels_hr_6002 = ["n", u"τ_diff [ms]",  u"τ_trip [µs]", u"T", u"offset"]
+labels_hr_6002 = [u"n",
+                  u"τ_diff [ms]",
+                  u"τ_trip [µs]",
+                  u"T",
+                  u"offset"]
 factors_hr_6002 = [1., 1., 1000., 1., 1.]
 valuestofit_6002 = [True, True, True, True, False]
 parms_6002 = [labels_6002, values_6002, valuestofit_6002,
diff --git a/pycorrfit/models/MODEL_classic_gaussian_3D.py b/pycorrfit/models/MODEL_classic_gaussian_3D.py
index 4d2b981..ac494d7 100755
--- a/pycorrfit/models/MODEL_classic_gaussian_3D.py
+++ b/pycorrfit/models/MODEL_classic_gaussian_3D.py
@@ -1,22 +1,6 @@
 # -*- coding: utf-8 -*-
 """
-    PyCorrFit
-    This file contains TIR one component models + triplet
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+This file contains TIR one component models + triplet
 """
 from __future__ import division
 
@@ -108,9 +92,9 @@ def Check_6011(parms):
     parms[0] = np.abs(parms[0])
     T = parms[1]
     tautrip = np.abs(parms[2])
-    parms[3] = taudiff = np.abs(parms[3])
+    parms[3] = np.abs(parms[3])# = taudiff
     parms[4] = np.abs(parms[4])
-    off = parms[5]
+    #off = parms[5]
     
     # Triplet fraction is between 0 and one.
     T = (0.<=T<1.)*T + .999999999*(T>=1)
@@ -178,14 +162,14 @@ def CF_Gxyz_gauss_3D3DT(parms, tau):
 
 def Check_3D3DT(parms):
     parms[0] = np.abs(parms[0])
-    parms[1] = taud1 = np.abs(parms[1])
-    parms[2] = taud2 = np.abs(parms[2])
+    parms[1] = np.abs(parms[1]) # = taud1
+    parms[2] = np.abs(parms[2]) # = taud2
     F=parms[3]
     parms[4]=np.abs(parms[4])
     parms[5]=np.abs(parms[5])
     tautrip=np.abs(parms[6])
     T=parms[7]
-    off=parms[8]
+    #off=parms[8]
     
     
     # Triplet fraction is between 0 and one. T may not be one!
@@ -234,9 +218,19 @@ def MoreInfo_6030(parms, countrate):
 # 3D Model blink gauss
 m_3dblink6011 = [6011, "T+3D","3D confocal diffusion with triplet", 
                  CF_Gxyz_blink]
-labels_6011 = ["n","T","τ_trip [ms]", "τ_diff [ms]", "SP", "offset"]
+labels_6011 = [u"n",
+               u"T",
+               u"τ_trip [ms]",
+               u"τ_diff [ms]",
+               u"SP",
+               u"offset"]
 values_6011 = [4.0, 0.2, 0.001, 0.4, 5.0, 0.0]
-labels_hr_6011 = ["n","T","τ_trip [µs]", "τ_diff [ms]", "SP", "offset"]
+labels_hr_6011 = [u"n",
+                  u"T",
+                  u"τ_trip [µs]",
+                  u"τ_diff [ms]",
+                  u"SP",
+                  u"offset"]
 factors_hr_6011 = [1., 1., 1000., 1., 1., 1.]
 valuestofit_6011 = [True, True, True, True, False, False]
 parms_6011 = [labels_6011, values_6011, valuestofit_6011,
@@ -244,7 +238,10 @@ parms_6011 = [labels_6011, values_6011, valuestofit_6011,
 
 # 3D Model gauss
 m_3dgauss6012 = [6012, "3D","3D confocal diffusion", CF_Gxyz_gauss]
-labels_6012 = ["n", "τ_diff [ms]", "SP", "offset"]
+labels_6012 = [u"n",
+               u"τ_diff [ms]",
+               u"SP",
+               u"offset"]
 values_6012 = [4.0, 0.4, 5.0, 0.0]
 valuestofit_6012 = [True, True, False, False]
 parms_6012 = [labels_6012, values_6012, valuestofit_6012]
@@ -253,15 +250,15 @@ parms_6012 = [labels_6012, values_6012, valuestofit_6012]
 m_gauss_3d_3d_t_mix_6030 = [6030, "T+3D+3D",
                             "Separate 3D diffusion + triplet, Gauß",
                             CF_Gxyz_gauss_3D3DT]
-labels_6030  = ["n",
-                "τ"+u"\u2081"+" [ms]",
-                "τ"+u"\u2082"+" [ms]",
-                "F"+u"\u2081", 
-                "SP",
+labels_6030  = [u"n",
+                u"τ"+u"\u2081"+" [ms]",
+                u"τ"+u"\u2082"+" [ms]",
+                u"F"+u"\u2081", 
+                u"SP",
                 u"\u03b1"+" (q"+u"\u2082"+"/q"+u"\u2081"+")", 
-                "τ_trip [ms]",
-                "T",
-                "offset"
+                u"τ_trip [ms]",
+                u"T",
+                u"offset"
                 ]
 values_6030 = [ 
                 25,      # n
@@ -277,15 +274,15 @@ values_6030 = [
 # For user comfort we add values that are human readable.
 # Theese will be used for output that only humans can read.
 labels_human_readable_6030  = [
-                        "n",
-                        "τ"+u"\u2081"+" [ms]",
-                        "τ"+u"\u2082"+" [ms]",
-                        "F"+u"\u2081", 
-                        "SP",
+                        u"n",
+                        u"τ"+u"\u2081"+" [ms]",
+                        u"τ"+u"\u2082"+" [ms]",
+                        u"F"+u"\u2081", 
+                        u"SP",
                         u"\u03b1"+" (q"+u"\u2082"+"/q"+u"\u2081"+")", 
-                        "τ_trip [µs]",
-                        "T",
-                        "offset"
+                        u"τ_trip [µs]",
+                        u"T",
+                        u"offset"
                             ]
 values_factor_human_readable_6030 = [
                         1.,     # n
diff --git a/pycorrfit/models/MODEL_classic_gaussian_3D2D.py b/pycorrfit/models/MODEL_classic_gaussian_3D2D.py
index b50a0d9..2de7b6a 100755
--- a/pycorrfit/models/MODEL_classic_gaussian_3D2D.py
+++ b/pycorrfit/models/MODEL_classic_gaussian_3D2D.py
@@ -78,14 +78,14 @@ def CF_Gxyz_3d2dT_gauss(parms, tau):
 
 def Checkme(parms):
     parms[0] = np.abs(parms[0])
-    parms[1] = taud2D = np.abs(parms[1])
-    parms[2] = taud3D = np.abs(parms[2])
+    parms[1] = np.abs(parms[1]) #= taud2D
+    parms[2] = np.abs(parms[2]) #= taud3D
     F=parms[3]
     parms[4]=np.abs(parms[4])
     parms[5]=np.abs(parms[5])
     tautrip=np.abs(parms[6])
     T=parms[7]
-    off=parms[8]
+    #off=parms[8]
     # Triplet fraction is between 0 and one. T may not be one!
     T = (0.<=T<1.)*T + .99999999999999*(T>=1)
     # Fraction of molecules may also be one
@@ -116,23 +116,23 @@ def MoreInfo(parms, countrate):
     if countrate is not None:
         # CPP
         cpp = countrate/n
-        Info.append(["cpp [kHz]", cpp])
+        Info.append([u"cpp [kHz]", cpp])
     return Info
 
 
 # 3D + 3D + T model gauss
-m_gauss_3d_2d_t = [6032, "T+3D+2D",
+m_gauss_3d_2d_t = [6032, u"T+3D+2D",
                             "Separate 3D and 2D diffusion + triplet, Gauß",
                             CF_Gxyz_3d2dT_gauss]
-labels  = ["n",
-                "τ_2D [ms]",
-                "τ_3D [ms]",
-                "F_3D", 
-                "SP",
-                u"\u03b1"+" (q_3D/q_2D)", 
-                "τ_trip [ms]",
-                "T",
-                "offset"
+labels  = [ u"n",
+            u"τ_2D [ms]",
+            u"τ_3D [ms]",
+            u"F_3D", 
+            u"SP",
+            u"\u03b1"+" (q_3D/q_2D)", 
+            u"τ_trip [ms]",
+            u"T",
+            u"offset"
                 ]
 values = [ 
                 25,      # n
@@ -147,15 +147,15 @@ values = [
                 ]
 # For user comfort we add values that are human readable.
 # Theese will be used for output that only humans can read.
-labels_human_readable  = [  "n",
-                            "τ_2D [ms]",
-                            "τ_3D [ms]",
-                            "F_3D", 
-                            "SP",
+labels_human_readable  = [  u"n",
+                            u"τ_2D [ms]",
+                            u"τ_3D [ms]",
+                            u"F_3D", 
+                            u"SP",
                             u"\u03b1"+" (q_3D/q_2D)", 
-                            "τ_trip [µs]",
-                            "T",
-                            "offset"
+                            u"τ_trip [µs]",
+                            u"T",
+                            u"offset"
                             ]
 values_factor_human_readable = [
                           1.,     # "n",
diff --git a/pycorrfit/models/__init__.py b/pycorrfit/models/__init__.py
index ce65552..238ad3c 100644
--- a/pycorrfit/models/__init__.py
+++ b/pycorrfit/models/__init__.py
@@ -1,39 +1,22 @@
 # -*- coding: utf-8 -*-
-"""
-    PyCorrFit
-
-    Module models:
-    Define all models and set initial parameters.
-
-    Each model has a unique ID. This ID is very important:
-        1. It is a wxWidgets ID.
-        2. It is used in the saving of sessions to identify a model.
-    It is very important, that model IDs do NOT change in newer versions
-    of PyCorrFit, because it would not be possible to restore older
-    PyCorrFit sessions.
-
-    Dimensionless representation:
-    unit of time        : 1 ms
-    unit of inverse time: 10³ /s
-    unit of distance    : 100 nm
-    unit of Diff.coeff  : 10 µm²/s
-    unit of inverse area: 100 /µm²
-    unit of inv. volume : 1000 /µm³
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+u"""PyCorrFit - module "models"
+
+Define all models and set initial parameters.
+
+Each model has a unique ID. This ID is very important:
+    1. It is a wxWidgets ID.
+    2. It is used in the saving of sessions to identify a model.
+It is very important, that model IDs do NOT change in newer versions
+of PyCorrFit, because it would not be possible to restore older
+PyCorrFit sessions.
+
+Dimensionless representation:
+unit of time        : 1 ms
+unit of inverse time: 10³ /s
+unit of distance    : 100 nm
+unit of Diff.coeff  : 10 µm²/s
+unit of inverse area: 100 /µm²
+unit of inv. volume : 1000 /µm³
 """
 
 
@@ -41,18 +24,9 @@
 # imported from within Python/PyCorrFit.
 
 import numpy as np                  # NumPy
-import platform
 import sys
 
 
-## On Windows XP I had problems with the unicode Characters.
-# I found this at 
-# http://stackoverflow.com/questions/5419/python-unicode-and-the-windows-console
-# and it helped:
-reload(sys)
-sys.setdefaultencoding('utf-8')
-
-
 ## Models
 from . import MODEL_classic_gaussian_2D
 from . import MODEL_classic_gaussian_3D
@@ -66,6 +40,115 @@ from . import MODEL_TIRF_3D2D
 from . import MODEL_TIRF_3D3D
 from . import MODEL_TIRF_3D2Dkin_Ries
 
+
+class Model(object):
+    """General class for handling FCS fitting models"""
+    def __init__(self, datadict):
+        """datadict is an item in Modelarray"""
+        self._parameters = datadict["Parameters"]
+        self._definitions = datadict["Definitions"]
+
+        if "Supplements" in list(datadict.keys()):
+            self._supplements = datadict["Supplements"]
+        else:
+            self._supplements = lambda x, y: []
+
+        if "Verification" in list(datadict.keys()):
+            self._verification = datadict["Verification"]
+        else:
+            # dummy verification function
+            self._verification = lambda parms: parms
+
+    def __call__(self, parameters, tau):
+        return self.function(parameters, tau)
+    
+    def __getitem__(self, key):
+        """Emulate old list behavior of models"""
+        return self._definitions[key]
+
+    def apply(self, parameters, tau):
+        """ 
+        Apply the model with `parameters` and lag
+        times `tau`
+        """
+        return self.function(parameters, tau)
+
+    @property
+    def components(self):
+        """how many components does this model have"""
+        return self._definitions[1]
+    
+    @property
+    def default_values(self):
+        """default fitting values"""
+        return np.array(self._parameters[1]).copy()
+    
+    @property
+    def default_variables(self):
+        """indexes default variable fitting (bool)"""
+        return np.array(self._parameters[2]).copy()
+
+    @property
+    def description_long(self):
+        """long description"""
+        return self._definitions[3].__doc__
+    
+    @property
+    def description_short(self):
+        """short description"""
+        return self._definitions[2]
+
+    @property
+    def id(self):
+        return self._definitions[0]
+    
+    @property
+    def function(self):
+        return self._definitions[3]
+
+    @property
+    def func_supplements(self):
+        return self._supplements
+
+    @property
+    def func_verification(self):
+        return self._verification
+    
+    def get_supplementary_parameters(self, values, countrate):
+        """
+        Compute additional information for the model
+        
+        Parameters
+        ----------
+        values: list-like of same length as `self.default_values`
+            parameters for the model
+        countrate: float
+            count rate in Hz
+        """
+        return self.func_supplements(values, countrate*1e-3)
+
+    def get_supplementary_values(self, values, countrate):
+        """
+        Returns only the values of
+        self.get_supplementary_parameters
+        
+        Parameters
+        ----------
+        values: list-like of same length as `self.default_values`
+            parameters for the model
+        countrate: float
+            count rate in Hz
+        """
+        out = list()
+        for item in  self.get_supplementary_parameters(values, countrate):
+            out.append(item[1])
+        return out
+
+    @property
+    def parameters(self):
+        return self._parameters
+
+
 def AppendNewModel(Modelarray):
     """ Append a new model from a modelarray. *Modelarray* has to be a list
         whose elements have two items:
@@ -77,34 +160,24 @@ def AppendNewModel(Modelarray):
     global valuedict
     global models
     global modeldict
+    global supplement
     global verification
 
-    for Model in Modelarray:
+    for datadict in Modelarray:
         # We can have many models in one model array
-        parms = Model["Parameters"]
-        texts = Model["Definitions"]
-        values.append(parms)
-        # model ID is texts[0]
-        valuedict[texts[0]] = parms
-        models.append(texts)
-        modeldict[texts[0]] = texts
-        # Suplementary Data might be there
-        try:
-             supper = Model["Supplements"]
-        except KeyError:
-            # Nothing to do
-            pass
-        else:
-            supplement[texts[0]] = supper
+        amod = Model(datadict)
+
+        models.append(amod)
+        modeldict[amod.id] = amod
+
+        values.append(amod.parameters)
+        valuedict[amod.id] = amod.parameters
+
+        # Supplementary Data might be there
+        supplement[amod.id] = amod.func_supplements
+
         # Check functions - check for correct values
-        try:
-             verify = Model["Verification"]
-        except KeyError:
-            # Nothing to do. Return empty function, so we do not need to
-            # do this try and error thing again.
-            verification[texts[0]] = lambda parms: parms
-        else:
-            verification[texts[0]] = verify
+        verification[amod.id] = amod.func_verification
 
 
 def GetHumanReadableParms(model, parameters):
@@ -219,15 +292,15 @@ def GetModelType(modelid):
                     return ""
 
 def GetModelFunctionFromId(modelid):
-    return pycorrfit.models.modeldict[modelid][3]
+    return modeldict[modelid][3]
     
 
 def GetModelParametersFromId(modelid):
-    return pycorrfit.models.valuedict[modelid][1]
+    return valuedict[modelid][1]
 
 
 def GetModelFitBoolFromId(modelid):
-    return pycorrfit.models.valuedict[modelid][2]
+    return valuedict[modelid][2]
 
 
 def GetMoreInfo(modelid, Page):
@@ -343,40 +416,10 @@ supplement = dict()
 verification = dict()
 
 
-# 6001 6002 6031
-AppendNewModel(MODEL_classic_gaussian_2D.Modelarray)
-
-# 6011 6012 6030
-AppendNewModel(MODEL_classic_gaussian_3D.Modelarray)
-
-# 6032
-AppendNewModel(MODEL_classic_gaussian_3D2D.Modelarray)
-
-# 6013 6014
-AppendNewModel(MODEL_TIRF_gaussian_1C.Modelarray)
-
-# 6033
-AppendNewModel(MODEL_TIRF_gaussian_3D2D.Modelarray)
-
-# 6034
-AppendNewModel(MODEL_TIRF_gaussian_3D3D.Modelarray)
-
-# 6000 6010
-AppendNewModel(MODEL_TIRF_1C.Modelarray)
-
-# 6022
-AppendNewModel(MODEL_TIRF_2D2D.Modelarray)
-
-# 6020
-AppendNewModel(MODEL_TIRF_3D2D.Modelarray)
-
-# 6023
-AppendNewModel(MODEL_TIRF_3D3D.Modelarray)
-
-# 6021
-AppendNewModel(MODEL_TIRF_3D2Dkin_Ries.Modelarray) 
-
-
+# Load all models from the imported "MODEL_*" submodules
+for g in list(globals().keys()):
+    if g.startswith("MODEL_") and hasattr(globals()[g], "Modelarray"):
+        AppendNewModel(globals()[g].Modelarray)
 
 # Create a list for the differentiation between the models
 # This should make everything look a little cleaner
diff --git a/pycorrfit/openfile.py b/pycorrfit/openfile.py
index 4ef2f3f..19f12b0 100644
--- a/pycorrfit/openfile.py
+++ b/pycorrfit/openfile.py
@@ -1,36 +1,13 @@
 # -*- coding: utf-8 -*-
-""" PyCorrFit - Module openfile
+"""
+PyCorrFit - Module openfile
 
 This file contains definitions for opening PyCorrFit sessions and
 saving PyCorrFit correlation curves.
-
-Dimensionless representation:
-unit of time        : 1 ms
-unit of inverse time: 10³ /s
-unit of distance    : 100 nm
-unit of Diff.coeff  : 10 µm²/s
-unit of inverse area: 100 /µm²
-unit of inv. volume : 1000 /µm³
-
-Copyright (C) 2011-2012  Paul Müller
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License 
-along with this program. If not, see <http://www.gnu.org/licenses/>.
 """
 
 
 import csv
-from distutils.version import LooseVersion # For version checking
 import numpy as np
 import os
 import shutil
@@ -40,11 +17,10 @@ import zipfile
 import warnings
 
 from . import doc
-from . import edclasses
 
 # These imports are required for loading data
-from .readfiles import Filetypes
-from .readfiles import BGFiletypes
+from .readfiles import Filetypes  # @UnusedImport
+from .readfiles import BGFiletypes  # @UnusedImport
 
 
 
diff --git a/pycorrfit/page.py b/pycorrfit/page.py
index c9705ba..b60c3ba 100644
--- a/pycorrfit/page.py
+++ b/pycorrfit/page.py
@@ -1,54 +1,23 @@
 # -*- coding: utf-8 -*-
-""" PyCorrFit
-
-    Module frontend
-    The frontend displays the GUI (Graphic User Interface).
-    All functions and modules are called from here.
-
-    Dimensionless representation:
-    unit of time        : 1 ms
-    unit of inverse time: 10³ /s
-    unit of distance    : 100 nm
-    unit of Diff.coeff  : 10 µm²/s
-    unit of inverse area: 100 /µm²
-    unit of inv. volume : 1000 /µm³
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
+"""
+PyCorrFit
 
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+Module frontend
+The frontend displays the GUI (Graphic User Interface).
+All functions and modules are called from here.
 """
 import wx                               # GUI interface wxPython
 from wx.lib.agw import floatspin        # Float numbers in spin fields
 import wx.lib.plot as plot              # Plotting in wxPython
 import wx.lib.scrolledpanel as scrolled
 import numpy as np                      # NumPy
-import sys                              # System stuff
 
-from . import edclasses                    # Cool stuf like better floatspin
+from . import edclasses                    # Cool stuff like better floatspin
 from . import fitting as fit       # For fitting
 from . import models as mdls
 from . import tools
 
 
-## On Windows XP I had problems with the unicode Characters.
-# I found this at 
-# http://stackoverflow.com/questions/5419/python-unicode-and-the-windows-console
-# and it helped:
-reload(sys)
-sys.setdefaultencoding('utf-8')
-
-
 class FittingPanel(wx.Panel):
     """
     Those are the Panels that show the fitting dialogs with the Plots.
@@ -203,8 +172,8 @@ class FittingPanel(wx.Panel):
         # in the Page info tool.
         # Here: Convert human readable units to program internal
         # units
-        e, self.active_parms[1] = mdls.GetInternalFromHumanReadableParm(
-                                  self.modelid, np.array(parameters))
+        self.active_parms[1] = mdls.GetInternalFromHumanReadableParm(
+                                  self.modelid, np.array(parameters))[1]
         self.active_parms[1] = self.check_parms(1*self.active_parms[1])
         # Fitting parameters
         self.weighted_nuvar = self.Fitbox[5].GetValue()
@@ -222,7 +191,7 @@ class FittingPanel(wx.Panel):
             Knots = filter(lambda x: x.isdigit(), Knots)
             self.FitKnots = int(Knots)
         # Fitting algorithm
-        keys, items = fit.GetAlgorithmStringList()
+        keys = fit.GetAlgorithmStringList()[0]
         idalg = self.AlgorithmDropdown.GetSelection()
         self.fit_algorithm = keys[idalg]
         # If parameters have been changed because of the check_parms
@@ -243,9 +212,9 @@ class FittingPanel(wx.Panel):
         # 
         # Here: Convert program internal units to
         # human readable units
-        labels, parameters = \
+        parameters = \
                      mdls.GetHumanReadableParms(self.modelid,
-                                        self.active_parms[1])
+                                        self.active_parms[1])[1]
         # Write parameters to the form on the Page
         for i in np.arange(len(self.active_parms[1])):
             self.spincontrol[i].SetValue(parameters[i])
@@ -258,7 +227,7 @@ class FittingPanel(wx.Panel):
         self.Fitbox[1].SetItems(List)
         self.Fitbox[1].SetSelection(idf)
         # Fitting algorithm
-        keys, items = fit.GetAlgorithmStringList()
+        keys = fit.GetAlgorithmStringList()[0]
         idalg = keys.index(self.fit_algorithm)
         self.AlgorithmDropdown.SetSelection(idalg)
 
@@ -570,8 +539,8 @@ class FittingPanel(wx.Panel):
         # human readable - the way they are displayed 
         # in the Page info tool.
         # 
-        labels, parameters = mdls.GetHumanReadableParms(self.modelid,
-                                                self.active_parms[1])
+        labels = mdls.GetHumanReadableParms(self.modelid,
+                                            self.active_parms[1])[0]
         for label in labels:
             sizerh = wx.BoxSizer(wx.HORIZONTAL)
             checkbox = wx.CheckBox(self.panelsettings, label=label)
@@ -945,7 +914,7 @@ class FittingPanel(wx.Panel):
         # Create empty tab title
         mddat = mdls.modeldict[self.modelid]
         modelshort = mdls.GetModelType(self.modelid)
-        titlelabel = "Data set ({} {})".format(modelshort, mddat[1])
+        titlelabel = u"Data set ({} {})".format(modelshort, mddat[1])
         boxti = wx.StaticBox(self.panelsettings, label=titlelabel)
         sizerti = wx.StaticBoxSizer(boxti, wx.VERTICAL)
         sizerti.SetMinSize((horizontalsize, -1))
@@ -1062,7 +1031,7 @@ class FittingPanel(wx.Panel):
         textalg = wx.StaticText(self.panelsettings, label="Algorithm")
         fitsizer.Add(textalg)
         self.AlgorithmDropdown = wx.ComboBox(self.panelsettings)
-        keys, items = fit.GetAlgorithmStringList()
+        items = fit.GetAlgorithmStringList()[1]
         self.AlgorithmDropdown.SetItems(items)
         self.Bind(wx.EVT_COMBOBOX, self.apply_parameters,
                   self.AlgorithmDropdown)
@@ -1085,8 +1054,6 @@ class FittingPanel(wx.Panel):
         # Disable Fitting since no data has been loaded yet
         for element in self.Fitbox:
             element.Disable()
-        x = self.panelsettings.GetSize()[0]
-        y = self.parent.GetSize()[1] - 33
-        self.parent.SetSize((x,y))
+        self.panelsettings.sizer.Fit(self.panelsettings)
         self.parent.Layout()
 
diff --git a/pycorrfit/plotting.py b/pycorrfit/plotting.py
index a59d55f..ebd92b7 100644
--- a/pycorrfit/plotting.py
+++ b/pycorrfit/plotting.py
@@ -1,32 +1,10 @@
 # -*- coding: utf-8 -*-
-""" PyCorrFit
-
-    Module plotting
-    Everything about plotting with matplotlib is located here.
-    Be sure to install texlive-science and texlive-math-extra
-
-    Dimensionless representation:
-    unit of time        : 1 ms
-    unit of inverse time: 10³ /s
-    unit of distance    : 100 nm
-    unit of Diff.coeff  : 10 µm²/s
-    unit of inverse area: 100 /µm²
-    unit of inv. volume : 1000 /µm³
-    
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
+"""
+PyCorrFit
 
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+Module plotting
+Everything about plotting with matplotlib is located here.
+Be sure to install texlive-science and texlive-math-extra
 """
 
 
@@ -42,11 +20,6 @@ import matplotlib.gridspec as gridspec
 import matplotlib.pyplot as plt
 # Text rendering with matplotlib
 from matplotlib import rcParams
-from matplotlib.backends.backend_wx import NavigationToolbar2Wx #We hack this
-## In edclasses, we edited the wxWidgets version of the NavigationToolbar2Wx.
-## This hack enables us to remember directories.
-# import edclasses
-# NavigationToolbar2Wx = edclasses.NavigationToolbar2Wx
 import unicodedata
 
 # For finding latex tools
@@ -188,11 +161,11 @@ def savePlotCorrelation(parent, dirname, Page, uselatex=False,
         fitlabel += ur", normalized to "+Page.active_parms[0][Page.normparm]
 
     ## Check if we can use latex for plotting:
-    (r1, path) = findprogram("latex")
-    (r2, path) = findprogram("dvipng")
+    r1 = findprogram("latex")[0]
+    r2 = findprogram("dvipng")[0]
     # Ghostscript
-    (r31, path) = findprogram("gs")
-    (r32, path) = findprogram("mgs") # from miktex
+    r31 = findprogram("gs")[0]
+    r32 = findprogram("mgs")[0] # from miktex
     r3 = max(r31,r32)
     if r1+r2+r3 < 3:
         uselatex = False
@@ -371,22 +344,20 @@ def savePlotTrace(parent, dirname, Page, uselatex=False, verbose=False):
     if Page.trace is not None:
         # Set trace
         traces = [Page.trace]
-        averages = [np.average(Page.trace)]
         labels = ["{} ({:.2f} kHz)".format(tabtitle, np.average(traces[0][:,1]))]
     elif Page.tracecc is not None:
         # We have some cross-correlation here. Two traces.
         traces = Page.tracecc
-        averages = [np.average(traces[0]), np.average(traces[1])]
         labels = ["{} A ({:.4g} kHz)".format(tabtitle, np.average(traces[0][:,1])),
                   "{} B ({:.4g} kHz)".format(tabtitle, np.average(traces[1][:,1]))]
     else:
         return
     ## Check if we can use latex for plotting:
-    (r1, path) = findprogram("latex")
-    (r2, path) = findprogram("dvipng")
+    r1 = findprogram("latex")[0]
+    r2 = findprogram("dvipng")[0]
     # Ghostscript
-    (r31, path) = findprogram("gs")
-    (r32, path) = findprogram("mgs") # from miktex
+    r31 = findprogram("gs")[0]
+    r32 = findprogram("mgs")[0]
     r3 = max(r31,r32)
     if r1+r2+r3 < 3:
         uselatex = False
@@ -466,11 +437,11 @@ def savePlotSingle(name, x, dataexp, datafit, dirname = ".", uselatex=False):
     except:
         pass
     ## Check if we can use latex for plotting:
-    (r1, path) = findprogram("latex")
-    (r2, path) = findprogram("dvipng")
+    r1 = findprogram("latex")[0]
+    r2 = findprogram("dvipng")[0]
     # Ghostscript
-    (r31, path) = findprogram("gs")
-    (r32, path) = findprogram("mgs") # from miktex
+    r31 = findprogram("gs")[0]
+    r32 = findprogram("mgs")[0] # from miktex
     r3 = max(r31,r32)
     if r1+r2+r3 < 3:
         uselatex = False
@@ -484,7 +455,7 @@ def savePlotSingle(name, x, dataexp, datafit, dirname = ".", uselatex=False):
         rcParams['text.usetex']=False
     # create plot
     # plt.plot(x, y, '.', label = 'original data', markersize=5)
-    fig=plt.figure()
+    plt.figure()
     ax = plt.subplot(111)
     #    ax = plt.axes()
     ax.semilogx()
diff --git a/pycorrfit/readfiles/__init__.py b/pycorrfit/readfiles/__init__.py
index b19d390..c984144 100644
--- a/pycorrfit/readfiles/__init__.py
+++ b/pycorrfit/readfiles/__init__.py
@@ -1,24 +1,7 @@
 # -*- coding: utf-8 -*-
-""" 
-    PyCorrFit
-    
-    Module readfiles:
-    Import correlation data from data files.
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
+u"""  PyCorrFit  - module "readfiles"
 
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+Import correlation data from data files.
 """
 # This file is necessary for this folder to become a module that can be 
 # imported by PyCorrFit.
@@ -130,7 +113,6 @@ def openZIP(dirname, filename):
             expfile = Arc.open(expfilename, 'r')
             readdata = csv.reader(expfile, delimiter=',')
             dataexp = list()
-            tau = list()
             if str(readdata.next()[0]) == "# tau only":
                 # We do not have a curve here
                 pass
@@ -243,7 +225,7 @@ Allsupfilesstring = " All supported files"
 # Dictionary with filetypes that we can open
 # The wildcards point to the appropriate functions.
 Filetypes = { "Correlator.com (*.SIN)|*.SIN;*.sin" : openSIN,
-              "ALV (*.ASC)|*.ASC" : openASC,
+              "ALV (*.ASC)|*.ASC;*.asc" : openASC,
               "PyCorrFit (*.csv)|*.csv" : openCSV,
               "Matlab 'Ries (*.mat)|*.mat" : openMAT,
               "PicoQuant (*.pt3)|*.pt3" : openPT3,
diff --git a/pycorrfit/readfiles/read_ASC_ALV.py b/pycorrfit/readfiles/read_ASC_ALV.py
index 22dc1ae..6e206aa 100644
--- a/pycorrfit/readfiles/read_ASC_ALV.py
+++ b/pycorrfit/readfiles/read_ASC_ALV.py
@@ -1,23 +1,6 @@
 # -*- coding: utf-8 -*-
-""" 
-    PyCorrFit
-    
-    functions in this file: *openASC*
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+"""
+methods to open ALV .ASC files
 """
 from __future__ import division
 
@@ -107,12 +90,16 @@ def openASC(dirname, filename):
     """
     openfile = open(os.path.join(dirname, filename), 'r')
     Alldata = openfile.readlines()
+    # End of trace
+    EndT = Alldata.__len__()
     ## Correlation function
     # Find out where the correlation function is
     for i in np.arange(len(Alldata)):
-        if Alldata[i][0:4] == 'Mode':
+        if Alldata[i].startswith('Mode'):
             mode = Alldata[i][5:].strip(' ":').strip().strip('"')
-            if mode.lower().count('single'):
+            if (mode.lower().count('single') or
+                mode.lower().strip() == "a-ch0" or 
+                mode.lower().strip() == "a-ch1"):
                 single = True
                 channel = mode.split(" ")[-1]
             else:
@@ -123,7 +110,7 @@ def openASC(dirname, filename):
                 accc = "CC"
             else:
                 accc = "AC"
-        if Alldata[i][0:12] == '"Correlation':
+        if Alldata[i].startswith('"Correlation'):
             # This tells us if there is only one curve or if there are
             # multiple curves with an average.
             if (Alldata[i].strip().lower() == 
@@ -131,19 +118,21 @@ def openASC(dirname, filename):
                 multidata = True
             else:
                 multidata = False
-        if Alldata[i][0:13] == '"Correlation"':
+        if Alldata[i].startswith('"Correlation"'):
             # Start of correlation function
             StartC = i+1
-        if Alldata[i][0:31] == '"Correlation (Multi, Averaged)"':
+        if Alldata[i].startswith('"Correlation (Multi, Averaged)"'):
             # Start of AVERAGED correlation function !!!
             # There are several curves now.
             StartC = i+2
-        if Alldata[i][0:12] == '"Count Rate"':
+        if Alldata[i].replace(" ", "").lower().strip() == '"countrate"':
+            # takes cate of "Count Rate" and "Countrate"
             # End of correlation function
-            EndC = i-2
+            EndC = i-1
             # Start of trace (goes until end of file)
             StartT = i+1
-    EndT = Alldata.__len__()
+        if Alldata[i].startswith('Monitor Diode'):
+            EndT = i-1
     # Get the header
     Namedata = Alldata.__getslice__(StartC-1, StartC)
     ## Define *curvelist*
@@ -161,14 +150,13 @@ def openASC(dirname, filename):
     ## Correlation function
     Truedata = Alldata.__getslice__(StartC, EndC)
     readdata = csv.reader(Truedata, delimiter='\t')
-    data = list()
     # Add lists to *data* according to the length of *curvelist*
-    for item in curvelist:
-        data.append(list())
+    data = [[]]*len(curvelist)
     # Work through the rows in the read data
     for row in readdata:
         for i in np.arange(len(curvelist)):
-            data[i].append( (np.float(row[0]), np.float(row[i+1])) )
+            if len(row) > 0:
+                data[i].append( (np.float(row[0]), np.float(row[i+1])) )
     ## Trace
     # Trace is stored in two columns
     # 1st column: time [s]
@@ -209,7 +197,6 @@ def openASC(dirname, filename):
     corrlist = list()
     tracelist = list()
     typelist = list()
-    
         
     if single:
         # We only have several runs and one average
@@ -343,15 +330,14 @@ def mysplit(a, n):
     lensplit = np.int(np.ceil(N/n))
 
     # xp is actually rounded -> recalculate
-    xp, step = np.linspace(a[:,0][0], a[:,0][-1], N,
-                           endpoint=True, retstep=True)
+    xp = np.linspace(a[:,0][0], a[:,0][-1], N,  endpoint=True)
     
     # let xp start at zero
     xp -= a[:,0][0]
     yp = a[:,1]
     
     # time frame for each new curve
-    dx = xp[-1]/n
+    #dx = xp[-1]/n
 
     # perform interpolation of new trace
     x, newstep = np.linspace(0, xp[-1], lensplit*n,
@@ -363,6 +349,6 @@ def mysplit(a, n):
     data[:,0] = x + newstep
     # make sure that the average stays the same:
     data[:,1] = y - np.average(y) + np.average(yp)
-    
+
     return np.split(data,n)
     
diff --git a/pycorrfit/readfiles/read_CSV_PyCorrFit.py b/pycorrfit/readfiles/read_CSV_PyCorrFit.py
index 9f16a92..ff4381f 100644
--- a/pycorrfit/readfiles/read_CSV_PyCorrFit.py
+++ b/pycorrfit/readfiles/read_CSV_PyCorrFit.py
@@ -1,23 +1,6 @@
 # -*- coding: utf-8 -*-
-""" 
-    PyCorrFit
-    
-    functions in this file: *openCSV*
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+"""
+methods to open CSV files
 """
 import os
 import csv
diff --git a/pycorrfit/readfiles/read_FCS_Confocor3.py b/pycorrfit/readfiles/read_FCS_Confocor3.py
index 2723248..7a83044 100644
--- a/pycorrfit/readfiles/read_FCS_Confocor3.py
+++ b/pycorrfit/readfiles/read_FCS_Confocor3.py
@@ -1,24 +1,6 @@
 # -*- coding: utf-8 -*-
-""" 
-    PyCorrFit
-    
-    functions in this file: *openFCS*, *openFCS_Single*,
-                            *openFCS_Multiple*
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+"""
+methods to open Confocor .fcs files
 """
 import os
 import csv
@@ -260,7 +242,7 @@ def openFCS_Multiple(dirname, filename):
     for tid in actimelist:
         if tid not in knowntimes:
             knowntimes.append(tid)
-            n = actimelist.count(tid)
+            #n = actimelist.count(tid)
             actids = np.where(np.array(actimelist) == tid)[0]
             cctids = np.where(np.array(cctimelist) == tid)[0]
             
@@ -327,67 +309,6 @@ def openFCS_Multiple(dirname, filename):
                         tracelist.append(tracecc)
                         corrlist.append(ccdat21)
 
- #   for i in np.arange(len(ac_correlations)):
- #       # Filter curves without correlation (ignore them)
- #       if ac_correlations[i] is not None:
- #           curvelist.append(aclist[i])
- #           tracelist.append(1*traces[i])
- #           corrlist.append(ac_correlations[i])
- #       else:
- #           if traces[i] is not None:
- #               warnings.warn("File {} curve {} does not contain AC data.".format(filename, i))
- #   # Overwrite traces. Now we have equal number of ac correlations
- #   # and traces.
- #   traces = tracelist
- 
- #   ## The CC traces are more tricky:
- #   # Add traces to CC-correlation functions.
- #   # It seems reasonable, that if number of AC1,AC2 and CC are equal,
- #   # CC gets the traces accordingly.
- #   # We take the number of ac curves from curvelist instead of aclist,
- #   # because aclist may contain curves without ac data (see above).
- #   # In that case, the cc traces do most-likely belong to the acs.
- #   n_ac1 = curvelist.count("AC1")
- #   n_ac2 = curvelist.count("AC2")
- #   n_cc12 = cclist.count("CC12")
- #   n_cc21 = cclist.count("CC21")
- #   if n_ac1==n_ac2==n_cc12==n_cc21>0:
- #       CCTraces = True
- #   else:
- #       CCTraces = False
- #    
- #   # Commence swapping, if necessary
- #   # We want to have CC12 first and the corresponding trace to AC1 as well.
- #   if len(cc_correlations) != 0:
- #       if cclist[0] == "CC12":
- #           if aclist[0] == "AC2":
- #               for i in np.arange(len(traces)/2):
- #                   traces[2*i], traces[2*i+1] = traces[2*i+1], traces[2*i] 
- #           # Everything is OK
- #       elif cclist[0] == "CC21":
- #           # Switch the order of CC correlations
- #           a = cc_correlations
- #           for i in np.arange(len(a)/2):
- #               a[2*i], a[2*i+1] = a[2*i+1], a[2*i]
- #               cclist[2*i], cclist[2*i+1] = cclist[2*i+1], cclist[2*i]
- #               if aclist[2*i] == "AC2":
- #                   traces[2*i], traces[2*i+1] = traces[2*i+1], traces[2*i] 
- #
- #
- #    # Add cc-curves with (if CCTraces) trace.
- #   for i in np.arange(len(cc_correlations)):
- #       if cc_correlations[i] is not None:
- #           curvelist.append(cclist[i])
- #           corrlist.append(cc_correlations[i])
- #           if CCTraces == True:
- #               if cclist[i] == "CC12":
- #                   tracelist.append([traces[i], traces[i+1]])
- #               elif cclist[i] == "CC21":
- #                   tracelist.append([traces[i-1], traces[i]])
- #           else:
- #               tracelist.append(None)
-                
-
     dictionary = dict()
     dictionary["Correlation"] = corrlist
     dictionary["Trace"] = tracelist
diff --git a/pycorrfit/readfiles/read_SIN_correlator_com.py b/pycorrfit/readfiles/read_SIN_correlator_com.py
index e6ea80e..ac62950 100644
--- a/pycorrfit/readfiles/read_SIN_correlator_com.py
+++ b/pycorrfit/readfiles/read_SIN_correlator_com.py
@@ -1,22 +1,6 @@
 # -*- coding: utf-8 -*-
 """
-    PyCorrFit
-    functions in this file: *openSIN*
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+method to open correlator.com .sin files
 """
 import os
 import csv
diff --git a/pycorrfit/readfiles/read_mat_ries.py b/pycorrfit/readfiles/read_mat_ries.py
index d241ca0..42e3648 100644
--- a/pycorrfit/readfiles/read_mat_ries.py
+++ b/pycorrfit/readfiles/read_mat_ries.py
@@ -1,24 +1,8 @@
 # -*- coding: utf-8 -*-
 """
-    PyCorrFit
-    
-    functions in this file: *openMAT*
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+method to open .mat files (Ries)
 """
+from __future__ import print_function
 
 import numpy as np
 
@@ -29,17 +13,13 @@ with warnings.catch_warnings():
     warnings.simplefilter("ignore")
     try:
         # scipy.io might not work on OSX (wrong architecture)
-        import scipy.io as spio
-        import scipy.io.matlab
-        # streams is not available in older versions
-        # of scipy. We catch this, so PyCorrFit will start
-        # without problems.
-        import scipy.io.matlab.streams
+        from scipy.io.matlab.mio5_params import mat_struct
+        from scipy.io import loadmat
     except:
-        print " Error: import error in scipys 'matlab' submodule."
-        print "        Try upgrading python-scipy or ignore this"
-        print "        error if you are not using .mat files that"
-        print "        were generated by programs by Jonas Ries."
+        print(" Error: import error in scipys 'matlab' submodule.")
+        print("        Try upgrading python-scipy or ignore this")
+        print("        error if you are not using .mat files that")
+        print("        were generated by programs by Jonas Ries.")
 import os
 
 
@@ -69,14 +49,12 @@ def openMAT(dirname, filename):
     except KeyError:
         pass
     else:
-        N = len(ac)
         # Workaround for single ACs, they are not stored in a separate list,
         # but directly inserted into g["ac"]. We put it in a list.
         # This is not the case for the trace averages.
         # There are a maximum of 4 autocorrelation functions in one file,
         # as far as I know.
         if len(ac) > 4:
-            N=1
             ac = [ac]
             g["act"] = [g["act"]]
         for i in np.arange(len(ac)):
@@ -206,34 +184,34 @@ def openMAT(dirname, filename):
 
 def loadmat(filename):
     '''
-    this function should be called instead of direct spio.loadmat
+    this function should be called instead of direct scipy.io.loadmat
     as it cures the problem of not properly recovering python dictionaries
     from mat files. It calls the function check keys to cure all entries
     which are still mat-objects
     '''
-    data = spio.loadmat(filename, struct_as_record=False, squeeze_me=True)
+    data = loadmat(filename, struct_as_record=False, squeeze_me=True)
     return _check_keys(data)
 
 
-def _check_keys(dict):
+def _check_keys(adict):
     '''
     checks if entries in dictionary are mat-objects. If yes
     todict is called to change them to nested dictionaries
     '''
-    for key in dict:
-        if isinstance(dict[key], spio.matlab.mio5_params.mat_struct):
-            dict[key] = _todict(dict[key])
-    return dict        
+    for key in adict:
+        if isinstance(adict[key], mat_struct):
+            adict[key] = _todict(adict[key])
+    return adict        
 
 def _todict(matobj):
     '''
     A recursive function which constructs from matobjects nested dictionaries
     '''
-    dict = {}
+    adict = {}
     for strg in matobj._fieldnames:
         elem = matobj.__dict__[strg]
-        if isinstance(elem, spio.matlab.mio5_params.mat_struct):
-            dict[strg] = _todict(elem)
+        if isinstance(elem, mat_struct):
+            adict[strg] = _todict(elem)
         else:
-            dict[strg] = elem
-    return dict
+            adict[strg] = elem
+    return adict
diff --git a/pycorrfit/readfiles/read_pt3_PicoQuant.py b/pycorrfit/readfiles/read_pt3_PicoQuant.py
index f8c3926..8e7efad 100644
--- a/pycorrfit/readfiles/read_pt3_PicoQuant.py
+++ b/pycorrfit/readfiles/read_pt3_PicoQuant.py
@@ -10,20 +10,19 @@ from .read_pt3_scripts.correlation_objects import picoObject
 
 
 class ParameterClass():
-	"""Stores parameters for correlation """
-	def __init__(self):
-		
-		#Where the data is stored.
-		self.data = []
-		self.objectRef =[]
-		self.subObjectRef =[]
-		self.colors = ['blue','green','red','cyan','magenta','yellow','black']
-		self.numOfLoaded = 0
-		self.NcascStart = 0
-		self.NcascEnd = 25
-		self.Nsub = 6
-		self.winInt = 10
-		self.photonCountBin = 25
+    """Stores parameters for correlation """
+    def __init__(self):
+        #Where the data is stored.
+        self.data = []
+        self.objectRef =[]
+        self.subObjectRef =[]
+        self.colors = ['blue','green','red','cyan','magenta','yellow','black']
+        self.numOfLoaded = 0
+        self.NcascStart = 0
+        self.NcascEnd = 25
+        self.Nsub = 6
+        self.winInt = 10
+        self.photonCountBin = 25
         
 
 def openPT3(dirname, filename):
@@ -43,7 +42,6 @@ def openPT3(dirname, filename):
     autotime = po.autotime.reshape(-1)
 
     corrlist = list()
-    tracelist = list()
     typelist = list()
     
     # Some data points are zero for some reason
@@ -82,14 +80,14 @@ def openPT3(dirname, filename):
         corrlist.append(np.hstack( (autotime[id1].reshape(-1,1),
                                     corrcc10[id1].reshape(-1,1)) ))
 
+
+    filelist = [filename] * len(typelist)
+    tracelist = [None] * len(typelist)
+
     dictionary = dict()
     dictionary["Correlation"] = corrlist
     dictionary["Trace"] = tracelist
     dictionary["Type"] = typelist
-    filelist = list()
-    for i in typelist:
-        filelist.append(filename)
-        tracelist.append(None)
     dictionary["Filename"] = filelist
 
     return dictionary
diff --git a/pycorrfit/tools/__init__.py b/pycorrfit/tools/__init__.py
index 429fa41..1782574 100644
--- a/pycorrfit/tools/__init__.py
+++ b/pycorrfit/tools/__init__.py
@@ -1,66 +1,33 @@
 # -*- coding: utf-8 -*-
-""" PyCorrFit
+"""
+PyCorrFit - module "tools"
 
-    Module tools
-    This file contains useful tools, such as dialog boxes and other stuff,
-    that we need in PyCorrFit.
+This file contains tools, such as dialog boxes and other stuff,
+that we need in PyCorrFit.
 
-    The tools work with triggers on page updates. Every tool has a 
-    function `OnPageChanged(self, page, trigger=None)` which is called
-    when something in the frontend chages. In order to minimize user
-    stall time, these functions are not executed for a certain list
-    of triggers that is defined in that function. This e.g. dramatically
-    speeds up tools like "Statistics view" when batch fitting.
+The tools work with triggers on page updates. Every tool has a 
+function `OnPageChanged(self, page, trigger=None)` which is called
+when something in the frontend chages. In order to minimize user
+stall time, these functions are not executed for a certain list
+of triggers that is defined in that function. This e.g. dramatically
+speeds up tools like "Statistics view" when batch fitting.
     
-    Recognized triggers:
-     tab_init           : initial stuff that is done for a new page
-     tab_browse         : the tab has change and a new page is visible
-     fit_batch          : the page is batch-fitted right now
-     fit_finalize       : a (batch) fitting process is finished
-     parm_batch         : parameters are changed in a batch process
-     parm_finalize      : finished (batch) changing of page parameters
-     page_add_batch     : when many pages are added at the same time
-     page_add_finalize  : finished (batch) adding of pages
-
-    Dimensionless representation:
-    unit of time        : 1 ms
-    unit of inverse time: 10³ /s
-    unit of distance    : 100 nm
-    unit of Diff.coeff  : 10 µm²/s
-    unit of inverse area: 100 /µm²
-    unit of inv. volume : 1000 /µm³
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+Recognized triggers:
+ tab_init           : initial stuff that is done for a new page
+ tab_browse         : the tab has change and a new page is visible
+ fit_batch          : the page is batch-fitted right now
+ fit_finalize       : a (batch) fitting process is finished
+ parm_batch         : parameters are changed in a batch process
+ parm_finalize      : finished (batch) changing of page parameters
+ page_add_batch     : when many pages are added at the same time
+ page_add_finalize  : finished (batch) adding of pages
 """
-
-
 # This file is necessary for this folder to become a module that can be 
 # imported by PyCorrFit or other people.
 
-import importlib
 import numpy as np                  # NumPy
 import sys
 
-## On Windows XP I had problems with the unicode Characters.
-# I found this at 
-# http://stackoverflow.com/questions/5419/python-unicode-and-the-windows-console
-# and it helped:
-reload(sys)
-sys.setdefaultencoding('utf-8')
-
 from . import datarange
 from . import background
 from . import overlaycurves
@@ -110,7 +77,7 @@ from .chooseimport import ChooseImportTypes
 from .chooseimport import ChooseImportTypesModel
 from .comment import EditComment
 # the "special" tool RangeSelector
-from parmrange import RangeSelector
+from .parmrange import RangeSelector
 
 ToolDict = dict()
 ToolDict["A"] = ToolsActive
diff --git a/pycorrfit/tools/average.py b/pycorrfit/tools/average.py
index bc3e0fb..dcbba0e 100644
--- a/pycorrfit/tools/average.py
+++ b/pycorrfit/tools/average.py
@@ -1,31 +1,9 @@
 # -*- coding: utf-8 -*-
-""" PyCorrFit
-
-    Module tools - average
-    Creates an average of curves.
-
-    Dimensionless representation:
-    unit of time        : 1 ms
-    unit of inverse time: 10³ /s
-    unit of distance    : 100 nm
-    unit of Diff.coeff  : 10 µm²/s
-    unit of inverse area: 100 /µm²
-    unit of inv. volume : 1000 /µm³
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
+"""
+PyCorrFit
 
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+Module tools - average
+Creates an average of curves.
 """
 
 
@@ -57,7 +35,7 @@ class Average(wx.Frame):
         self.MyID = None
         # Page - the currently active page of the notebook.
         self.Page = self.parent.notebook.GetCurrentPage()
-         ## Content
+        ## Content
         self.panel = wx.Panel(self)
         self.topSizer = wx.BoxSizer(wx.VERTICAL)
         textinit = wx.StaticText(self.panel,
@@ -153,11 +131,11 @@ class Average(wx.Frame):
             if Page.counter.strip(" :#") == str(PageNumbers[0]):
                 referencePage = Page
                 break
-		if referencePage is not None:
-			# If that did not work, we have to raise an error.
-			raise IndexError("PyCorrFit could not find the first"+
+        if referencePage is not None:
+            # If that did not work, we have to raise an error.
+            raise IndexError("PyCorrFit could not find the first"+
 							 " page for averaging.")
-			return
+            return
         
         for i in np.arange(self.parent.notebook.GetPageCount()):
             Page = self.parent.notebook.GetPage(i)
diff --git a/pycorrfit/tools/background.py b/pycorrfit/tools/background.py
index 68c9444..3374c6a 100644
--- a/pycorrfit/tools/background.py
+++ b/pycorrfit/tools/background.py
@@ -1,31 +1,9 @@
 # -*- coding: utf-8 -*-
-""" PyCorrFit
+""" 
+PyCorrFit
 
-    Module tools - background
-    We make some background corection here.
-
-    Dimensionless representation:
-    unit of time        : 1 ms
-    unit of inverse time: 10³ /s
-    unit of distance    : 100 nm
-    unit of Diff.coeff  : 10 µm²/s
-    unit of inverse area: 100 /µm²
-    unit of inv. volume : 1000 /µm³
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+Module tools - background
+perform background correction here.
 """
 
 
@@ -37,7 +15,6 @@ import wx
 from wx.lib.agw import floatspin        # Float numbers in spin fields
 import wx.lib.plot as plot    
 
-from .. import doc
 from .. import misc
 from .. import openfile as opf                  # How to treat an opened file
 from .. import readfiles
@@ -276,7 +253,7 @@ class BackgroundCorrection(wx.Frame):
                 # Add a separator
                 filters = filters+"|"
         dlg = wx.FileDialog(self, "Choose a data file", 
-            self.parent.dirname, "", filters, wx.OPEN)
+            self.parent.dirname, "", filters, wx.FD_OPEN)
         if dlg.ShowModal() == wx.ID_OK:
             # Workaround since 0.7.5
             (dirname, filename) = os.path.split(dlg.GetPath())
@@ -505,7 +482,7 @@ class BackgroundCorrection(wx.Frame):
             # an error message.
             return
         # BG number
-        item = self.dropdown.GetSelection()
+        #item = self.dropdown.GetSelection()
         # Apply to corresponding pages
         for i in np.arange(self.parent.notebook.GetPageCount()):
             Page = self.parent.notebook.GetPage(i)
@@ -551,10 +528,6 @@ class BackgroundCorrection(wx.Frame):
         for item in self.parent.Background:
             bgname = "{} ({:.2f} kHz)".format(item[1],item[0])
             self.BGlist.append(bgname)
-        if len(self.BGlist) == 0:
-            ddlist = ["File/User"]
-        else:
-            ddlist = 1*self.BGlist
         self.dropdown.SetItems(self.BGlist)
         # Show the last item
         self.dropdown.SetSelection(len(self.BGlist)-1)
diff --git a/pycorrfit/tools/batchcontrol.py b/pycorrfit/tools/batchcontrol.py
index 91846d0..8b4ffc3 100644
--- a/pycorrfit/tools/batchcontrol.py
+++ b/pycorrfit/tools/batchcontrol.py
@@ -1,31 +1,9 @@
 # -*- coding: utf-8 -*-
-""" PyCorrFit
+""" 
+PyCorrFit
 
-    Module tools - batch
-    Stuff that concerns batch processing.
-
-    Dimensionless representation:
-    unit of time        : 1 ms
-    unit of inverse time: 10³ /s
-    unit of distance    : 100 nm
-    unit of Diff.coeff  : 10 µm²/s
-    unit of inverse area: 100 /µm²
-    unit of inv. volume : 1000 /µm³
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+Module tools - batch
+Stuff that concerns batch processing.
 """
 
 
@@ -192,7 +170,7 @@ class BatchCtrl(wx.Frame):
         wcstring = "PyCorrFit session (*.pcfs)|*{};*{}".format(
                                                            wc[0], wc[1])
         dlg = wx.FileDialog(self.parent, "Open session file",
-                            self.parent.dirname, "", wcstring, wx.OPEN)
+                            self.parent.dirname, "", wcstring, wx.FD_OPEN)
         # user cannot do anything until he clicks "OK"
         if dlg.ShowModal() == wx.ID_OK:
             sessionfile = dlg.GetPath()
diff --git a/pycorrfit/tools/chooseimport.py b/pycorrfit/tools/chooseimport.py
index 700c78b..35da061 100644
--- a/pycorrfit/tools/chooseimport.py
+++ b/pycorrfit/tools/chooseimport.py
@@ -1,32 +1,10 @@
 # -*- coding: utf-8 -*-
-""" PyCorrFit
+""" 
+PyCorrFit
 
-    Module tools - chooseimport
-    Displays a window that lets the user choose what type
-    of data (AC1, AC2, CC12, CC21) he wants to import.
-
-    Dimensionless representation:
-    unit of time        : 1 ms
-    unit of inverse time: 10³ /s
-    unit of distance    : 100 nm
-    unit of Diff.coeff  : 10 µm²/s
-    unit of inverse area: 100 /µm²
-    unit of inv. volume : 1000 /µm³
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+Module tools - chooseimport
+Displays a window that lets the user choose what type
+of data (AC1, AC2, CC12, CC21) he wants to import.
 """
 
 
@@ -34,7 +12,6 @@ import numpy as np
 import wx
 
 from .. import models as mdls
-from .. import doc
 from . import overlaycurves
 
 
diff --git a/pycorrfit/tools/comment.py b/pycorrfit/tools/comment.py
index 2f0988c..1ee1e9d 100755
--- a/pycorrfit/tools/comment.py
+++ b/pycorrfit/tools/comment.py
@@ -1,31 +1,9 @@
 # -*- coding: utf-8 -*-
-""" PyCorrFit
-
-    Module tools - comment
-    Just edit the sessions comment.
-
-    Dimensionless representation:
-    unit of time        : 1 ms
-    unit of inverse time: 10³ /s
-    unit of distance    : 100 nm
-    unit of Diff.coeff  : 10 µm²/s
-    unit of inverse area: 100 /µm²
-    unit of inv. volume : 1000 /µm³
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
+"""
+PyCorrFit
 
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+Module tools - comment
+Edit the sessions' comment.
 """
 
 
diff --git a/pycorrfit/tools/datarange.py b/pycorrfit/tools/datarange.py
index 1732b2d..36a9528 100644
--- a/pycorrfit/tools/datarange.py
+++ b/pycorrfit/tools/datarange.py
@@ -1,31 +1,9 @@
 # -*- coding: utf-8 -*-
-""" PyCorrFit
-
-    Module tools - channels
-    Let the user choose time domains.
-
-    Dimensionless representation:
-    unit of time        : 1 ms
-    unit of inverse time: 10³ /s
-    unit of distance    : 100 nm
-    unit of Diff.coeff  : 10 µm²/s
-    unit of inverse area: 100 /µm²
-    unit of inv. volume : 1000 /µm³
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
+"""
+PyCorrFit
 
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+Module tools - datarange
+Let the user choose time domains.
 """
 
 
diff --git a/pycorrfit/tools/example.py b/pycorrfit/tools/example.py
index 46f5904..dbfafaf 100644
--- a/pycorrfit/tools/example.py
+++ b/pycorrfit/tools/example.py
@@ -1,39 +1,17 @@
 # -*- coding: utf-8 -*-
-""" PyCorrFit
-
-    Module tools - example
-    This is an example tool. You will need to edit __init__.py inside this
-    folder to activate it.
-    Add the filename (*example*) and class (*Tool*) to either of the lists
-    *ImpA*  or *ImpB* in __init__.py.
-
-    Dimensionless representation:
-    unit of time        : 1 ms
-    unit of inverse time: 10³ /s
-    unit of distance    : 100 nm
-    unit of Diff.coeff  : 10 µm²/s
-    unit of inverse area: 100 /µm²
-    unit of inv. volume : 1000 /µm³
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
+"""
+PyCorrFit
 
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+Module tools - example
+This is an example tool. You will need to edit __init__.py inside this
+folder to activate it.
+Add the filename (*example*) and class (*Tool*) to either of the lists
+*ImpA*  or *ImpB* in __init__.py.
 """
 
 
 import wx
-import numpy as np
+#import numpy as np
 
 
 class Tool(wx.Frame):
diff --git a/pycorrfit/tools/globalfit.py b/pycorrfit/tools/globalfit.py
index e48126a..c1d64bf 100644
--- a/pycorrfit/tools/globalfit.py
+++ b/pycorrfit/tools/globalfit.py
@@ -1,31 +1,9 @@
 # -*- coding: utf-8 -*-
-""" PyCorrFit
-
-    Module tools - globalfit
-    Perform global fitting on pages which share parameters.
-
-    Dimensionless representation:
-    unit of time        : 1 ms
-    unit of inverse time: 10³ /s
-    unit of distance    : 100 nm
-    unit of Diff.coeff  : 10 µm²/s
-    unit of inverse area: 100 /µm²
-    unit of inv. volume : 1000 /µm³
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
+"""
+PyCorrFit
 
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+Module tools - globalfit
+Perform global fitting on pages which share parameters.
 """
 
 
@@ -138,7 +116,7 @@ check parameters on each page and start 'Global fit'.
                            )
 
         # Flatten the list and make an array out of it.
-        return np.array([item for sublist in minimize for item in sublist])
+        return np.array([it for sublist in minimize for it in sublist])
 
 
     def OnClose(self, event=None):
@@ -203,7 +181,7 @@ check parameters on each page and start 'Global fit'.
         if len(fitparms) == 0:
             return
         res = spopt.leastsq(self.fit_function, fitparms[:], full_output=1)
-        (popt, pcov, infodict, errmsg, ier) = res
+        pcov = res[1]
         #self.parmoptim, self.mesg = spopt.leastsq(self.fit_function, 
         #                                          fitparms[:])
         self.parmoptim = res[0]
@@ -224,7 +202,7 @@ check parameters on each page and start 'Global fit'.
             # Get the function
             item = self.PageData[key]
             modelid = item["modelid"]
-            function = mdls.modeldict[modelid][3]
+            #function = mdls.modeldict[modelid][3]
             values = 1*Page.active_parms[1]
             # Set parameters for each Page)
             for i in np.arange(len(self.parmstofit)):
@@ -242,7 +220,7 @@ check parameters on each page and start 'Global fit'.
             # Calculate resulting correlation function
             # corr = function(item.values, item.x)
             # Subtract data. This is the function we want to minimize
-            residual = function(values, item["x"]) - item["data"]
+            #residual = function(values, item["x"]) - item["data"]
             # Calculate chi**2
             # Set the parameter error estimates for all pages
             minimized = self.fit_function(self.parmoptim)
@@ -253,7 +231,6 @@ check parameters on each page and start 'Global fit'.
             except:
                 self.parmoptim_error = None
             else:
-                parmoptim_error = list()
                 if self.covar is not None:
                     self.parmoptim_error = np.diag(self.covar)
             p_error = self.parmoptim_error
diff --git a/pycorrfit/tools/info.py b/pycorrfit/tools/info.py
index 671b44c..22e95c5 100644
--- a/pycorrfit/tools/info.py
+++ b/pycorrfit/tools/info.py
@@ -1,31 +1,9 @@
 # -*- coding: utf-8 -*-
-""" PyCorrFit
-
-    Module tools - info
-    Open a text window with lots of information.
-
-    Dimensionless representation:
-    unit of time        : 1 ms
-    unit of inverse time: 10³ /s
-    unit of distance    : 100 nm
-    unit of Diff.coeff  : 10 µm²/s
-    unit of inverse area: 100 /µm²
-    unit of inv. volume : 1000 /µm³
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
+"""
+PyCorrFit
 
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+Module tools - info
+Open a text window with lots of information.
 """
 
 
@@ -96,7 +74,7 @@ class InfoClass(object):
         Fitting = "\nFitting:\n"
         try:
             for item in InfoDict["fitting"]:
-                Fitting = Fitting + "  "+item[0]+"\t"+str(item[1])+"\n"
+                Fitting = Fitting + "  "+item[0]+"\t"+unicode(item[1])+"\n"
         except KeyError:
             Fitting = ""
         # Background
diff --git a/pycorrfit/tools/overlaycurves.py b/pycorrfit/tools/overlaycurves.py
index f03ad4d..cb165e6 100644
--- a/pycorrfit/tools/overlaycurves.py
+++ b/pycorrfit/tools/overlaycurves.py
@@ -1,37 +1,14 @@
 # -*- coding: utf-8 -*-
-""" PyCorrFit
-
-    Module tools - selectcurves
-
-    Let the user choose which correlation curves to use.
-    Contains wrappers for file import and tools.
-    
-    Dimensionless representation:
-    unit of time        : 1 ms
-    unit of inverse time: 10³ /s
-    unit of distance    : 100 nm
-    unit of Diff.coeff  : 10 µm²/s
-    unit of inverse area: 100 /µm²
-    unit of inv. volume : 1000 /µm³
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
+"""
+PyCorrFit
 
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+Module tools - overlaycurves
+Let the user choose which correlation curves to use.
+Contains wrappers for file import and tools.
 """
 
 try:
-    from matplotlib import cm
+    from matplotlib import cm  # @UnresolvedImport
 except:
     mpl_available = False
 else:
diff --git a/pycorrfit/tools/parmrange.py b/pycorrfit/tools/parmrange.py
index 5535432..bba050f 100644
--- a/pycorrfit/tools/parmrange.py
+++ b/pycorrfit/tools/parmrange.py
@@ -1,33 +1,9 @@
 # -*- coding: utf-8 -*-
-""" PyCorrFit
-
-    Module tools - RangeSelector
-    Select the range in which the parameter should reside for fitting.
-    This is only the frontend.
-    
-
-    Dimensionless representation:
-    unit of time        : 1 ms
-    unit of inverse time: 10³ /s
-    unit of distance    : 100 nm
-    unit of Diff.coeff  : 10 µm²/s
-    unit of inverse area: 100 /µm²
-    unit of inv. volume : 1000 /µm³
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+"""
+PyCorrFit
+
+Module tools - RangeSelector
+Select the range in which the parameter should reside for fitting.
 """
 
 
@@ -68,7 +44,7 @@ class RangeSelector(wx.Frame):
         """
         
         self.parameter_range = np.zeros(self.Page.parameter_range.shape)
-        labels, parmleft = mdls.GetHumanReadableParms(self.Page.modelid,
+        labels, parmleft = mdls.GetHumanReadableParms(self.Page.modelid,  # @UnusedVariable
                                                  self.Page.parameter_range[:,0])
         labels, parmright = mdls.GetHumanReadableParms(self.Page.modelid,
                                                  self.Page.parameter_range[:,1])
@@ -158,10 +134,10 @@ class RangeSelector(wx.Frame):
                 self.parameter_range[i][1] = 1.01*np.abs(self.parameter_range[i][0])
                 self.WXparmlist[i][2].SetValue(self.parameter_range[i][1])
         # Set parameters
-        l, parm0 = mdls.GetInternalFromHumanReadableParm(self.Page.modelid,
-                                                     self.parameter_range[:,0])
-        l, parm1 = mdls.GetInternalFromHumanReadableParm(self.Page.modelid,
-                                                     self.parameter_range[:,1])
+        parm0 = mdls.GetInternalFromHumanReadableParm(self.Page.modelid,
+                                                     self.parameter_range[:,0])[1]
+        parm1 = mdls.GetInternalFromHumanReadableParm(self.Page.modelid,
+                                                     self.parameter_range[:,1])[1]
         self.Page.parameter_range[:,0] = np.array(parm0)
         self.Page.parameter_range[:,1] = np.array(parm1)
         #self.Page.PlotAll()
diff --git a/pycorrfit/tools/plotexport.py b/pycorrfit/tools/plotexport.py
index f7ecd97..ce407fd 100644
--- a/pycorrfit/tools/plotexport.py
+++ b/pycorrfit/tools/plotexport.py
@@ -1,32 +1,10 @@
 # -*- coding: utf-8 -*-
-""" PyCorrFit
-
-    Module tools - plotexport
-    Let the user create nice plots of our data.
-    --currently not used
-
-    Dimensionless representation:
-    unit of time        : 1 ms
-    unit of inverse time: 10³ /s
-    unit of distance    : 100 nm
-    unit of Diff.coeff  : 10 µm²/s
-    unit of inverse area: 100 /µm²
-    unit of inv. volume : 1000 /µm³
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
+"""
+PyCorrFit
 
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+Module tools - plotexport
+Let the user create nice plots of our data.
+--currently not used
 """
 
 
diff --git a/pycorrfit/tools/simulation.py b/pycorrfit/tools/simulation.py
index 362a05a..79c75f9 100644
--- a/pycorrfit/tools/simulation.py
+++ b/pycorrfit/tools/simulation.py
@@ -1,32 +1,10 @@
 # -*- coding: utf-8 -*-
-""" PyCorrFit
-
-    Module tools - simulation
-    Enables the user to change plotting parameters and replotting fast.
-    Might be useful for better understanding.
-
-    Dimensionless representation:
-    unit of time        : 1 ms
-    unit of inverse time: 10³ /s
-    unit of distance    : 100 nm
-    unit of Diff.coeff  : 10 µm²/s
-    unit of inverse area: 100 /µm²
-    unit of inv. volume : 1000 /µm³
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+"""
+PyCorrFit
+
+Module tools - simulation
+Enables the user to change plotting parameters and replotting fast.
+Might be useful for better understanding model functions.
 """
 
 
@@ -374,8 +352,8 @@ class Slide(wx.Frame):
         parms_0 = 1.*np.array(mdls.valuedict[self.modelid][1])
         parms_0[idA] = self.valueA # human readable units
         parms_0[idB] = self.valueB # human readable units
-        label, parms_i =\
-            mdls.GetInternalFromHumanReadableParm(self.modelid, parms_0)
+        parms_i =\
+            mdls.GetInternalFromHumanReadableParm(self.modelid, parms_0)[1]
         self.Page.active_parms[1][idA] = parms_i[idA]
         self.Page.active_parms[1][idB] = parms_i[idB]
         self.Page.apply_parameters_reverse()
@@ -429,19 +407,19 @@ class Slide(wx.Frame):
         # self.valueA = self.Page.active_parms[1][idA]
         if self.parent.notebook.GetPageCount() == 0:
             self.modelid = 6000
-            ParmLabels, ParmValues = \
+            ParmValues = \
                    mdls.GetHumanReadableParms(self.modelid,
-                                              mdls.valuedict[6000][1])
+                                        mdls.valuedict[6000][1])[1]
         else:
             self.modelid = self.Page.modelid
-            ParmLabels, ParmValues = \
+            ParmValues = \
                    mdls.GetHumanReadableParms(self.modelid,
-                                              self.Page.active_parms[1])
+                                        self.Page.active_parms[1])[1]
         self.valueA = ParmValues[idA]
         self.valueB = ParmValues[idB]                             
         # Operator
         idop = self.dropop.GetSelection()
-        keys = self.opdict.keys()
+        #keys = self.opdict.keys()
         opkey = self.oplist[idop]
         self.opfunc = self.opdict[opkey]
         # Parameter A
diff --git a/pycorrfit/tools/statistics.py b/pycorrfit/tools/statistics.py
index aeda084..8c0e8d4 100644
--- a/pycorrfit/tools/statistics.py
+++ b/pycorrfit/tools/statistics.py
@@ -1,38 +1,16 @@
 # -*- coding: utf-8 -*-
-""" PyCorrFit
-
-    Module tools - statistics
-    Provide the user with tab-separated statistics of their curves.
-    Values are sorted according to the page number.
-
-    Dimensionless representation:
-    unit of time        : 1 ms
-    unit of inverse time: 10³ /s
-    unit of distance    : 100 nm
-    unit of Diff.coeff  : 10 µm²/s
-    unit of inverse area: 100 /µm²
-    unit of inv. volume : 1000 /µm³
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
+"""
+PyCorrFit
 
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+Module tools - statistics
+Provide the user with tab-separated statistics of their curves.
+Values are sorted according to the page number.
 """
 from __future__ import division
 
-import datetime 
 import wx
 import wx.lib.plot as plot              # Plotting in wxPython
+import wx.lib.scrolledpanel as scrolled
 import numpy as np
 
 from .info import InfoClass
@@ -61,7 +39,7 @@ class Stat(wx.Frame):
         pos = self.parent.GetPosition()
         pos = (pos[0]+100, pos[1]+100)
         wx.Frame.__init__(self, parent=self.parent, title="Statistics",
-                 pos=pos,
+                 pos=pos, size=(700,600),
                  style=wx.DEFAULT_FRAME_STYLE|wx.FRAME_FLOAT_ON_PARENT)
         ## MYID
         # This ID is given by the parent for an instance of this class
@@ -87,7 +65,8 @@ class Stat(wx.Frame):
         #   do not make a mess out of it.
         # Then the user presses a button and sees/saves the table
         # with all the info.
-        self.panel = wx.Panel(self.sp)
+        self.panel = scrolled.ScrolledPanel(self.sp)
+        self.panel.SetupScrolling(scroll_y=True)
         # Parameter settings.
         if self.parent.notebook.GetPageCount() != 0:
             self.InfoClass = InfoClass(CurPage=self.Page)
@@ -165,13 +144,12 @@ class Stat(wx.Frame):
         self.topSizer.Add(self.btnSave)
         # Set size of window
         self.panel.SetSizer(self.topSizer)
-        self.topSizer.Fit(self)
-        (px, py) = self.topSizer.GetMinSizeTuple()
-
+        self.topSizer.Fit(self.panel)
+        px = self.topSizer.GetMinSizeTuple()[0]
+        
         ## Plotting panel
         self.canvas = plot.PlotCanvas(self.sp)
         self.sp.SplitVertically(self.panel, self.canvas, px+5)
-        self.SetMinSize((px+400, py))
         ## Icon
         if parent.MainIcon is not None:
             wx.Frame.SetIcon(self, parent.MainIcon)
@@ -227,7 +205,7 @@ class Stat(wx.Frame):
             elif key == "fitting":
                 for fitp in Infodict[key]:
                     # We added the error data before in the parm section
-                    if str(fitp[0])[0:4] != "Err ":
+                    if unicode(fitp[0])[0:4] != u"Err ":
                         tail.append(fitp)
             elif key == "supplement":
                 body += Infodict[key]
@@ -595,9 +573,9 @@ class Stat(wx.Frame):
         (ax, ay) = self.GetSizeTuple()
         (px, py) = self.topSizer.GetMinSizeTuple()
         self.sp.SetSashPosition(px+5)
+        self.SetMinSize((px+400, py))
         self.SetSize((np.max([px+400,ax,oldsize[0]]),
                       np.max([py,ay,oldsize[1]])))
-        self.SetMinSize((px+400, py))
         # Replot
         self.OnDropDown()
 
@@ -606,7 +584,7 @@ class Stat(wx.Frame):
         dirname = self.parent.dirname
         dlg = wx.FileDialog(self.parent, "Choose file to save", dirname,
                 "", "Text file (*.txt)|*.txt;*.TXT",
-                wx.SAVE|wx.FD_OVERWRITE_PROMPT)
+                wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT)
         # user cannot do anything until he clicks "OK"
         if dlg.ShowModal() == wx.ID_OK:
             filename = dlg.GetPath()
diff --git a/pycorrfit/tools/trace.py b/pycorrfit/tools/trace.py
index 045c26a..387019a 100644
--- a/pycorrfit/tools/trace.py
+++ b/pycorrfit/tools/trace.py
@@ -1,31 +1,9 @@
 # -*- coding: utf-8 -*-
-""" PyCorrFit
-
-    Module tools - trace
-    Show the trace of a file.
-
-    Dimensionless representation:
-    unit of time        : 1 ms
-    unit of inverse time: 10³ /s
-    unit of distance    : 100 nm
-    unit of Diff.coeff  : 10 µm²/s
-    unit of inverse area: 100 /µm²
-    unit of inv. volume : 1000 /µm³
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
+"""
+PyCorrFit
 
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+Module tools - trace
+Show the trace of a file.
 """
 
 import numpy as np
diff --git a/pycorrfit/usermodel.py b/pycorrfit/usermodel.py
index 32272c8..1087cb3 100644
--- a/pycorrfit/usermodel.py
+++ b/pycorrfit/usermodel.py
@@ -1,35 +1,13 @@
 # -*- coding: utf-8 -*-
-""" PyCorrFit
-
-    Module: user model:
-    When the user wants to use his own functions.
-    We are using sympy as function parser instead of writing our own,
-    which might be safer.
-    We only parse the function with sympy and test it once during
-    import. After that, the function is evaluated using eval()!
-
-    Dimensionless representation:
-    unit of time        : 1 ms
-    unit of inverse time: 10³ /s
-    unit of distance    : 100 nm
-    unit of Diff.coeff  : 10 µm²/s
-    unit of inverse area: 100 /µm²
-    unit of inv. volume : 1000 /µm³
-
-    Copyright (C) 2011-2012  Paul Müller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License 
-    along with this program. If not, see <http://www.gnu.org/licenses/>.
+"""
+PyCorrFit
+
+Module: user model:
+When the user wants to use his own functions.
+We are using sympy as function parser instead of writing our own,
+which might be safer.
+We only parse the function with sympy and test it once during
+import. After that, the function is evaluated using eval()!
 """
 
 
@@ -39,10 +17,10 @@ import sys
 import warnings
 try:
     import sympy
-    from sympy.core.function import Function
+    import sympy.functions
     from sympy.core import S
-    from sympy import sympify, I
-    from sympy.functions import im
+    from sympy.core.function import Function
+    from sympy import sympify
 except ImportError:
     warnings.warn("Importing sympy failed."+\
                   " Reason: {}.".format(sys.exc_info()[1].message))
@@ -273,14 +251,14 @@ class wixi(Function):
     nargs = 1
     is_real = True
     @classmethod
-    def eval(csl,arg):
+    def eval(self, arg):
         return None
-    #def _should_evalf(csl,arg):
-    #    return True
-    def as_base_exp(cls):
-        return cls,S.One
-    def _eval_evalf(cls, prec):
-        result = sps.wofz(1j*float(cls.args[0]))
+
+    def as_base_exp(self):
+        return self, S.One  # @UndefinedVariable
+
+    def _eval_evalf(self, prec):
+        result = sps.wofz(1j*float(self.args[0]))
         return sympy.numbers.Number(sympy.functions.re(result))
 
 
diff --git a/setup.py b/setup.py
index f98fd62..988dfd8 100644
--- a/setup.py
+++ b/setup.py
@@ -1,11 +1,15 @@
 #!/usr/bin/env python
+# -*- coding: utf-8 -*-
 # To just compile the cython part in-place:
-# python setup.py build_ext --inplace
+#  python setup.py build_ext --inplace
 # To create a distribution package for pip or easy-install:
-# python setup.py sdist
-from setuptools import setup, find_packages, Extension
-from Cython.Distutils import build_ext
-import numpy as np
+#  python setup.py sdist
+# To create wheels package and upload securely
+#  pip install wheel twine
+#  python setup.py bdist wheel
+from __future__ import print_function
+from setuptools import setup, Extension
+import sys
 
 from os.path import join, dirname, realpath, exists
 from warnings import warn
@@ -17,11 +21,29 @@ for scheme in INSTALL_SCHEMES.values():
     scheme['data'] = scheme['purelib']
 
 
+# We don't need cython if a .whl package is available.
+# Try to import cython and throw a warning if it does not work.
+try:
+    from Cython.Distutils import build_ext
+    import numpy as np
+except ImportError:
+    print("Cython or NumPy not available. Building extensions "+
+          "with this setup script will not work:", sys.exc_info())
+    EXTENSIONS = []
+    build_ext = None
+else:
+    EXTENSIONS = [Extension("pycorrfit.readfiles.read_pt3_scripts.fib4",
+                        ["pycorrfit/readfiles/read_pt3_scripts/fib4.pyx"],
+                        libraries=[],
+                        include_dirs=[np.get_include()]
+                        )
+              ]
+
 # Download documentation if it was not compiled
 Documentation = join(dirname(realpath(__file__)), "doc/PyCorrFit_doc.pdf")
 webdoc = "https://github.com/paulmueller/PyCorrFit/wiki/PyCorrFit_doc.pdf"
 if not exists(Documentation):
-    print "Downloading {} from {}".format(Documentation, webdoc)
+    print("Downloading {} from {}".format(Documentation, webdoc))
     import urllib
     #testfile = urllib.URLopener()
     urllib.urlretrieve(webdoc, Documentation)
@@ -37,53 +59,65 @@ except:
     warn("Could not find 'ChangeLog.txt'. PyCorrFit version is unknown.")
     version = "0.0.0-unknown"
 
-
-EXTENSIONS = [Extension("pycorrfit.readfiles.read_pt3_scripts.fib4",
-                        ["pycorrfit/readfiles/read_pt3_scripts/fib4.pyx"],
-                        libraries=[],
-                        include_dirs=[np.get_include()]
-                        )
-              ]
+# Parameters
+author = u"Paul Müller"
+authors = [author]
+description = 'Scientific tool for fitting correlation curves on a logarithmic plot.'
+name = 'pycorrfit'
+year = "2014"
 
 setup(
-    name='pycorrfit',
-    author='Paul Mueller',
+    
+    author=author,
     author_email='paul.mueller at biotec.tu-dresden.de',
+    classifiers= [
+        'Operating System :: OS Independent',
+        'Programming Language :: Python :: 2.7',
+        'Topic :: Scientific/Engineering :: Visualization',
+        'Intended Audience :: Science/Research'
+        ],
+    data_files=[('pycorrfit_doc', ['ChangeLog.txt', 'doc/PyCorrFit_doc.pdf'])],
+    description=description,
+    include_package_data=True,
+    keywords=["fcs", "fluorescence", "correlation", "spectroscopy",
+              "tir", "fitting"
+              ],
+    license="GPL v2",
+    long_description=open(join(dirname(__file__), 'Readme.txt')).read(),
+    name=name,
+    platforms=['ALL'],
     url='https://github.com/paulmueller/PyCorrFit',
     version=version,
+    # data files
     packages=['pycorrfit',
               'pycorrfit.models',
               'pycorrfit.readfiles',
-              'pycorrfit.tools'],
+              'pycorrfit.tools'
+              ],
     package_dir={'pycorrfit': 'pycorrfit',
                  'pycorrfit.models': 'pycorrfit/models',
                  'pycorrfit.readfiles': 'pycorrfit/readfiles',
-                 'pycorrfit.tools': 'pycorrfit/tools'},
-    data_files=[('pycorrfit_doc', ['ChangeLog.txt', 'doc/PyCorrFit_doc.pdf'])],
-    license="GPL v2",
-    description='Scientific tool for fitting correlation curves on a logarithmic plot.',
-    long_description=open(join(dirname(__file__), 'Readme.txt')).read(),
-    scripts=['bin/pycorrfit'],
-    include_package_data=True,
-    cmdclass={"build_ext": build_ext},
+                 'pycorrfit.tools': 'pycorrfit/tools'
+                 },
+    # cython
     ext_modules=EXTENSIONS,
+    cmdclass={"build_ext": build_ext},
+    # requirements
+    extras_require = {
+        # If you need the GUI of this project in your project, add
+        # "thisproject[GUI]" to your install_requires
+        # Graphical User Interface
+        'GUI':  ["wxPython", "matplotlib >= 1.1.0", "sympy >= 0.7.2"],
+        },
     install_requires=[
-        "cython",
         "NumPy >= 1.5.1",
         "SciPy >= 0.8.0",
-        "sympy >= 0.7.2",
         "PyYAML >= 3.09",
-        "wxPython >= 2.8.10.1",
-        "matplotlib >= 1.1.0"],
-    keywords=["fcs", "fluorescence", "correlation", "spectroscopy",
-              "tir", "fitting"],
-    classifiers= [
-        'Operating System :: OS Independent',
-        'Programming Language :: Python :: 2.7',
-        'Topic :: Scientific/Engineering :: Visualization',
-        'Intended Audience :: Science/Research'
-                 ],
-    platforms=['ALL']
+        ],
+    setup_requires=["cython"],
+    # scripts
+    entry_points={
+       "gui_scripts": ["{name:s}={name:s}:Main".format(
+                                                       **{"name":name})]
+       }
     )
-
-

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/pycorrfit.git



More information about the debian-med-commit mailing list