[med-svn] [pycorrfit] 01/05: New upstream version 1.0.0+dfsg
Andreas Tille
tille at debian.org
Thu Jun 22 07:24:12 UTC 2017
This is an automated email from the git hooks/post-receive script.
tille pushed a commit to branch master
in repository pycorrfit.
commit 8ee5ece496a7f6d0ae8375aa88617acb105373b4
Author: Andreas Tille <tille at debian.org>
Date: Thu Jun 22 09:20:55 2017 +0200
New upstream version 1.0.0+dfsg
---
.travis/linux_build-wheels.sh | 22 +++++
.travis/linux_dist.sh | 12 +++
.travis/linux_install.sh | 14 +++
.travis/osx_dist.sh | 117 ++++++++++++++++++++++
.travis/osx_install.sh | 56 +++++++++++
.travis/osx_install_dmg.sh | 36 +++++++
.travis/osx_pyinstaller.spec | 43 ++++++++
.travis/osx_requirements.txt | 8 ++
.travis/osx_wxPython-3.0.2.0-plot.patch | 91 +++++++++++++++++
.travis/test.sh | 8 ++
ChangeLog.txt | 3 +
MANIFEST.in | 17 ++--
README.rst | 6 +-
pycorrfit/PyCorrFit.py | 6 +-
pycorrfit/__init__.py | 2 -
pycorrfit/__main__.py | 1 -
pycorrfit/gui/frontend.py | 1 -
pycorrfit/models/__init__.py | 2 -
pycorrfit/models/classes.py | 2 +-
pycorrfit/models/control.py | 2 +
pycorrfit/models/model_confocal_2d.py | 2 +-
pycorrfit/models/model_confocal_tt_2d.py | 124 +++++++++++++++++++++++
pycorrfit/models/model_confocal_tt_2d_2d.py | 6 +-
pycorrfit/models/model_confocal_tt_3d.py | 132 +++++++++++++++++++++++++
pycorrfit/models/model_confocal_tt_3d_3d.py | 2 +-
pycorrfit/readfiles/read_SIN_correlator_com.py | 65 ++++++------
setup.py | 43 ++++----
tests/data_file_dl.py | 20 ++--
tests/test_constraints.py | 9 +-
tests/test_file_formats.py | 12 ++-
tests/test_simple.py | 2 +-
31 files changed, 770 insertions(+), 96 deletions(-)
diff --git a/.travis/linux_build-wheels.sh b/.travis/linux_build-wheels.sh
new file mode 100755
index 0000000..4aee3da
--- /dev/null
+++ b/.travis/linux_build-wheels.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+set -e -x
+
+cd /io
+
+for PYBIN in /opt/python/cp${TRAVIS_PYTHON_VERSION//./}*/bin/; do
+ # Install
+ "${PYBIN}/pip" install -e .
+ "${PYBIN}/python" setup.py build_ext --inplace --force
+ # Test
+ "${PYBIN}/python" setup.py test
+ # Wheels
+ "${PYBIN}/pip" wheel /io/ -w wheelhouse/ --no-deps
+ rm -rf .eggs
+done
+
+# Bundle external shared libraries into the wheels
+for whl in /io/wheelhouse/*.whl; do
+ auditwheel repair "$whl" -w /io/dist/
+done
+
+
diff --git a/.travis/linux_dist.sh b/.travis/linux_dist.sh
new file mode 100755
index 0000000..7e7dbf5
--- /dev/null
+++ b/.travis/linux_dist.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+# Call this script from the parent directory
+# This will produce wheels using docker
+set -e
+# remove all .pyc files to prevent error:
+# - import file mismatch / unique basename
+find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf
+docker pull $DOCKER_IMAGE
+mkdir -p dist
+docker run -e TRAVIS_PYTHON_VERSION --rm -v `pwd`:/io $DOCKER_IMAGE $PRE_CMD /io/.travis/${TRAVIS_OS_NAME}_build-wheels.sh
+python setup.py sdist
+ls -l dist/
diff --git a/.travis/linux_install.sh b/.travis/linux_install.sh
new file mode 100755
index 0000000..70184c0
--- /dev/null
+++ b/.travis/linux_install.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+set -e
+deactivate
+sudo apt-get update -qq
+# Fixes the error:
+# - ImportError: No module named _tkinter, please install the python-tk package
+sudo apt-get install -qq python-pip python-tk
+sudo pip install virtualenv
+# use separate virtual environment
+virtualenv --system-site-packages ~/env
+source ~/env/bin/activate
+pip install --upgrade pip
+pip install cython matplotlib lmfit numpy scipy sympy
+
diff --git a/.travis/osx_dist.sh b/.travis/osx_dist.sh
new file mode 100755
index 0000000..654eca1
--- /dev/null
+++ b/.travis/osx_dist.sh
@@ -0,0 +1,117 @@
+#!/bin/bash
+set -e
+
+## Python Wheels
+# Create wheels
+pip install wheel
+pip wheel ./ -w wheelhouse/ --no-deps
+# Check for external dependencies
+pip install delocate
+# display dependencies
+delocate-listdeps wheelhouse/*.whl
+mkdir -p dist
+# repair wheels
+delocate-wheel -w dist wheelhouse/*.whl
+# check fixed wheels
+delocate-listdeps --all dist/*.whl
+ls -l dist
+
+# Stop here (OSx, WxPython, Pyinstaller will not work nicely together)
+exit 0
+
+## Pyinstaller
+pip install pyinstaller
+export PATH=/usr/local/bin:$PATH
+#export VERSIONER_PYTHON_PREFER_32_BIT=yes
+#defaults write com.apple.versioner.python Prefer-32-Bit -bool yes
+
+Progname="PyCorrFit"
+# Go to base dir of repo
+BASEDIR=$(dirname $0)
+cd $BASEDIR
+BASEDIR=$(pwd)
+cd "../"
+StartDir=$(pwd)"/"
+Progdir=${StartDir}"/"
+# We require a Progname_doc.tex in the source-doc directory
+DocDir=${StartDir}"/doc/"
+Docname=${DocDir}${Progname}"_doc.pdf"
+Changelogname="ChangeLog.txt"
+Specfile=${BASEDIR}"/"${Progname}"_mac.spec"
+codename="MacOSx"
+distrib=$(sw_vers -productVersion )
+version=$(head -n1 ./ChangeLog.txt | tr -d "\r\n")
+appn="./dist/${Progname}.app"
+StarterScript="./.travs/macOSx_script_starter.sh"
+Zipname=${Progname}_${version}_${codename}_${distrib}"_app.zip"
+DMGname=${Progname}_${version}_${codename}_${distrib}".dmg"
+
+echo $Specfile
+
+cd $StartDir
+
+
+echo "###################"
+echo "Building Extensions"
+echo "###################"
+rm -f $Docname
+python setup.py build_ext --inplace
+if [ $? -ne 0 ]; then
+ echo "Error - Aborting"
+ exit
+fi
+
+
+echo "############################"
+echo "Removing old build directory"
+echo "############################"
+rm -rf build
+if [ $? -ne 0 ]; then
+ echo "Error - Aborting"
+ exit
+fi
+
+
+
+echo "#######################"
+echo "Running Pyinstaller APP"
+echo "#######################"
+
+if [ -e $appn ]; then rm -R $appn; fi
+
+pyinstaller -y -F $Specfile
+if [ $? -ne 0 ]; then
+ echo "Error - Aborting"
+ exit
+fi
+
+
+if [ -e $Zipname ]; then rm $Zipname; fi
+
+
+#echo "############"
+#echo "Creating Zip"
+#echo "############"
+#pushd dist
+#zip -r ${Zipname} ${Progname}".app"
+#popd
+#zip -j "./dist/"${Zipname} ${Docname} ${Changelogname}
+
+
+echo "############"
+echo "Creating DMG"
+echo "############"
+pushd dist
+mkdir dmgsrc
+cp ../doc/*.pdf dmgsrc/
+cp ../ChangeLog.txt dmgsrc/
+cp -r ${Progname}".app" dmgsrc/
+# hdiutil: create failed - error -5341
+# http://stackoverflow.com/questions/18621467/error-creating-disk-image-using-hdutil
+# https://discussions.apple.com/thread/4712306
+touch dmgsrc/.Trash
+rm -rf dmgsrc/.DStore
+ls -la dmgsrc/
+# hdiutil create ${DMGname} -srcfolder dmgsrc/ -ov
+hdiutil create -volname "PyCorrFit_image" -megabytes 314m -format UDZO -imagekey zlib-level=9 -srcfolder dmgsrc -ov ${DMGname}
+popd
diff --git a/.travis/osx_install.sh b/.travis/osx_install.sh
new file mode 100644
index 0000000..815a755
--- /dev/null
+++ b/.travis/osx_install.sh
@@ -0,0 +1,56 @@
+#!/bin/bash
+set -e
+# a lot of cool formulae for scientific tools
+#- brew tap homebrew/science
+# numpy, scipy, matplotlib, ...
+#- brew tap homebrew/python
+#- brew tap homebrew/dupes
+#- brew update
+#- brew update && brew upgrade
+#- brew install python --universal --framework
+#- brew install wget
+#- which python
+#- python --version
+#- export VERSIONER_PYTHON_PREFER_32_BIT=no
+#- defaults write com.apple.versioner.python Prefer-32-Bit -bool no
+#- brew unlink gcc
+#- brew install gcc --universal
+#- brew install freetype --universal
+##- brew install numpy --universal
+##- brew install scipy --universal
+##- brew install matplotlib --universal
+#
+## https://github.com/Homebrew/homebrew/issues/34470
+##- brew install wxpython --universal
+##- brew install openblas
+##- brew install gfortran
+
+## wxPython
+#- wget http://downloads.sourceforge.net/wxpython/wxPython3.0-osx-3.0.2.0-cocoa-py2.7.dmg
+#sudo ./.travis/osx_install_dmg.sh
+
+MINICONDA=Miniconda2-latest-MacOSX-x86_64.sh
+wget http://repo.continuum.io/miniconda/${MINICONDA} -O miniconda.sh
+chmod +x miniconda.sh
+./miniconda.sh -b -p ${HOME}/miniconda
+export PATH=${HOME}/miniconda/bin:$PATH
+conda update --yes conda
+travis_retry conda install --yes cython matplotlib numpy pip scipy wxpython
+pip install -e .
+
+# Patch wx.lib.plot
+# http://trac.wxwidgets.org/ticket/16767#no1
+#python -c "import wx; print wx.__version__"
+#python -c "import wx; import wx.lib; import wx.lib.plot; print wx.lib.plot.__file__"
+#- patch /usr/local/lib/wxPython-3.0.2.0/lib/python2.7/site-packages/wx-3.0-osx_cocoa/wx/lib/plot.py ./freeze_travis/wxPython-3.0.2.0-plot.patch
+# wxPython is only available in 64bit version with homebrew
+#- brew install wxpython
+
+#- hdiutil create dist/hw.dmg -srcfolder dist/ -ov
+#./freeze_travis/macOSx_bundle_script.sh
+
+## Fixes
+# matplotlib backend workaround
+mkdir $HOME/.matplotlib
+echo "backend: TkAgg" >> $HOME/.matplotlib/matplotlibrc
+
diff --git a/.travis/osx_install_dmg.sh b/.travis/osx_install_dmg.sh
new file mode 100755
index 0000000..0e15f65
--- /dev/null
+++ b/.travis/osx_install_dmg.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+# packages.sh from
+# https://github.com/ayufan/travis-osx-vm-templates/blob/master/scripts/packages.sh
+
+set -eo pipefail
+shopt -s nullglob
+
+install_dmg() {
+ declare dmg="$1" target="${2:-/}"
+ echo "Installing $dmg..."
+ TMPMOUNT=`/usr/bin/mktemp -d /tmp/dmg.XXXX`
+ hdiutil attach "$dmg" -mountpoint "$TMPMOUNT"
+ for app in $TMPMOUNT/*.app; do
+ app_name="$(basename "$app")"
+ echo "Installing application $app_name..."
+ rm -rf "/Applications/$app_name"
+ cp -a "$app" "/Applications/"
+ done
+ find "$TMPMOUNT" -name '*.pkg' -exec installer -target "$target" -pkg "{}" \;
+ hdiutil detach "$TMPMOUNT"
+ rm -rf "$TMPMOUNT"
+ #rm -f "$dmg"
+}
+
+install_dmg_url() {
+ declare url="$1" target="$2"
+ local dmg="${dmg:-$(basename "$url")}"
+ echo "Downloading $url..."
+ curl --retry 3 -o "$dmg" "$url"
+ install_dmg "$dmg" "$target"
+}
+
+# install packages
+for package in ./*.dmg; do
+ install_dmg "$package"
+done
diff --git a/.travis/osx_pyinstaller.spec b/.travis/osx_pyinstaller.spec
new file mode 100644
index 0000000..bae61cc
--- /dev/null
+++ b/.travis/osx_pyinstaller.spec
@@ -0,0 +1,43 @@
+# -*- mode: python -*-
+from os.path import abspath, join
+
+# This is not relative to this file
+repo_dir = abspath("./")
+
+hiddenimports = [
+ "scipy.io.matlab.streams",
+ "scipy.special",
+ "scipy.special.specfun",
+ "scipy.io.matlab.streams",
+ "sympy.assumptions.handlers",
+ "sympy.assumptions.handlers.common",
+ "scipy.special._ufuncs_cxx",
+ "scipy.sparse.csgraph",
+ "scipy.sparse.csgraph.shortest_path",
+ "scipy.sparse.csgraph._validation"]
+
+a = Analysis([join(repo_dir, 'pycorrfit/PyCorrFit.py')],
+ hiddenimports=hiddenimports,
+ hookspath=None)
+a.datas += [('doc/ChangeLog.txt', join(repo_dir, 'ChangeLog.txt'), 'DATA'),
+ ('doc/PyCorrFit_doc.pdf', join(repo_dir, 'doc/PyCorrFit_doc.pdf'), 'DATA')]
+pyz = PYZ(a.pure)
+exe = EXE(pyz,
+ a.scripts,
+ exclude_binaries=True,
+ name='PyCorrFit',
+ debug=False,
+ strip=None,
+ upx=True,
+ console=False )
+coll = COLLECT(exe,
+ a.binaries,
+ a.zipfiles,
+ a.datas,
+ strip=None,
+ upx=True,
+ name='PyCorrFit')
+app = BUNDLE(coll,
+ name=join(repo_dir, 'dist/PyCorrFit.app'),
+ icon=join(repo_dir, 'freeze_pyinstaller/PyCorrFit.icns')
+ )
diff --git a/.travis/osx_requirements.txt b/.travis/osx_requirements.txt
new file mode 100644
index 0000000..f34e54d
--- /dev/null
+++ b/.travis/osx_requirements.txt
@@ -0,0 +1,8 @@
+Cython>=0.22
+lmfit
+matplotlib>=1.4.3
+numpy>=1.8.2
+PyYAML==3.11
+scipy>=0.14.0
+sympy>=0.7.6
+wheel
diff --git a/.travis/osx_wxPython-3.0.2.0-plot.patch b/.travis/osx_wxPython-3.0.2.0-plot.patch
new file mode 100644
index 0000000..f56956a
--- /dev/null
+++ b/.travis/osx_wxPython-3.0.2.0-plot.patch
@@ -0,0 +1,91 @@
+diff -up wxPython-src-3.0.2.0/wxPython/wx/lib/plot.py.plot wxPython-src-3.0.2.0/wxPython/wx/lib/plot.py
+--- wxPython-src-3.0.2.0/wxPython/wx/lib/plot.py.plot 2014-10-13 18:37:22.000000000 -0400
++++ wxPython-src-3.0.2.0/wxPython/wx/lib/plot.py 2015-01-04 20:38:04.645350202 -0500
+@@ -237,7 +237,7 @@ class PolyLine(PolyPoints):
+ :keyword `attr`: keyword attributes, default to:
+
+ ========================== ================================
+- 'colour'= 'black' wx.Pen Colour any wx.Colour
++ 'colour'= 'black' wx.Pen Colour any wx.NamedColour
+ 'width'= 1 Pen width
+ 'style'= wx.PENSTYLE_SOLID wx.Pen style
+ 'legend'= '' Line Legend to display
+@@ -251,7 +251,7 @@ class PolyLine(PolyPoints):
+ width = self.attributes['width'] * printerScale * self._pointSize[0]
+ style = self.attributes['style']
+ if not isinstance(colour, wx.Colour):
+- colour = wx.Colour(colour)
++ colour = wx.NamedColour(colour)
+ pen = wx.Pen(colour, width, style)
+ pen.SetCap(wx.CAP_BUTT)
+ dc.SetPen(pen)
+@@ -287,7 +287,7 @@ class PolySpline(PolyLine):
+ :keyword `attr`: keyword attributes, default to:
+
+ ========================== ================================
+- 'colour'= 'black' wx.Pen Colour any wx.Colour
++ 'colour'= 'black' wx.Pen Colour any wx.NamedColour
+ 'width'= 1 Pen width
+ 'style'= wx.PENSTYLE_SOLID wx.Pen style
+ 'legend'= '' Line Legend to display
+@@ -301,7 +301,7 @@ class PolySpline(PolyLine):
+ width = self.attributes['width'] * printerScale * self._pointSize[0]
+ style = self.attributes['style']
+ if not isinstance(colour, wx.Colour):
+- colour = wx.Colour(colour)
++ colour = wx.NamedColour(colour)
+ pen = wx.Pen(colour, width, style)
+ pen.SetCap(wx.CAP_ROUND)
+ dc.SetPen(pen)
+@@ -365,9 +365,9 @@ class PolyMarker(PolyPoints):
+ marker = self.attributes['marker']
+
+ if colour and not isinstance(colour, wx.Colour):
+- colour = wx.Colour(colour)
++ colour = wx.NamedColour(colour)
+ if fillcolour and not isinstance(fillcolour, wx.Colour):
+- fillcolour = wx.Colour(fillcolour)
++ fillcolour = wx.NamedColour(fillcolour)
+
+ dc.SetPen(wx.Pen(colour, width))
+ if fillcolour:
+@@ -595,9 +595,9 @@ class PlotCanvas(wx.Panel):
+
+ # set curser as cross-hairs
+ self.canvas.SetCursor(wx.CROSS_CURSOR)
+- self.HandCursor = wx.Cursor(Hand.GetImage())
+- self.GrabHandCursor = wx.Cursor(GrabHand.GetImage())
+- self.MagCursor = wx.Cursor(MagPlus.GetImage())
++ self.HandCursor = wx.CursorFromImage(Hand.GetImage())
++ self.GrabHandCursor = wx.CursorFromImage(GrabHand.GetImage())
++ self.MagCursor = wx.CursorFromImage(MagPlus.GetImage())
+
+ # Things for printing
+ self._print_data = None
+@@ -681,7 +681,7 @@ class PlotCanvas(wx.Panel):
+ if isinstance(colour, wx.Colour):
+ self._gridColour = colour
+ else:
+- self._gridColour = wx.Colour(colour)
++ self._gridColour = wx.NamedColour(colour)
+
+ # SaveFile
+ def SaveFile(self, fileName=''):
+@@ -1513,7 +1513,7 @@ class PlotCanvas(wx.Panel):
+ # Make new offscreen bitmap: this bitmap will always have the
+ # current drawing in it, so it can be used to save the image to
+ # a file, or whatever.
+- self._Buffer = wx.Bitmap(Size.width, Size.height)
++ self._Buffer = wx.EmptyBitmap(Size.width, Size.height)
+ self._setSize()
+
+ self.last_PointLabel = None # reset pointLabel
+@@ -1578,7 +1578,7 @@ class PlotCanvas(wx.Panel):
+ width = self._Buffer.GetWidth()
+ height = self._Buffer.GetHeight()
+ if sys.platform != "darwin":
+- tmp_Buffer = wx.Bitmap(width, height)
++ tmp_Buffer = wx.EmptyBitmap(width, height)
+ dcs = wx.MemoryDC()
+ dcs.SelectObject(tmp_Buffer)
+ dcs.Clear()
diff --git a/.travis/test.sh b/.travis/test.sh
new file mode 100755
index 0000000..a5310c4
--- /dev/null
+++ b/.travis/test.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+set -e
+pip install coverage coveralls
+coverage run --source=pycorrfit ./setup.py test
+coverage report -m
+# allow coveralls to fail
+coveralls || exit 0
+
diff --git a/ChangeLog.txt b/ChangeLog.txt
index 35beef5..bd87d74 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -1,3 +1,6 @@
+1.0.0
+- New confocal fitting models T+T+2D and T+T+3D
+- Fix regression: .sin files could not be opened (#167)
0.9.9
- Remove admin-requirement during install (Windows)
- Support newer correlator.com .sin file format (experimental, #135)
diff --git a/MANIFEST.in b/MANIFEST.in
index d00b2e8..f226117 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,12 +1,7 @@
-include doc/*.tex
-include doc/*.bib
-include doc/*.pdf
-include doc/*.md
-include doc/Images/*
-include examples/external_model_functions/*.txt
-include README.md
include ChangeLog.txt
-include pycorrfit/readfiles/read_pt3_scripts/*.py
-include pycorrfit/readfiles/read_pt3_scripts/*.pyx
-include pycorrfit/readfiles/read_pt3_scripts/LICENSE
-include tests/*.py
\ No newline at end of file
+include LICENSE
+include README.rst
+recursive-include examples *.txt
+recursive-include doc *.tex *.bib *.pdf *.md *.png *.svg
+recursive-include tests *.py *.md
+recursive-include pycorrfit *.py LICENCE README *.pyx
diff --git a/README.rst b/README.rst
index 457b9a2..71b7b65 100644
--- a/README.rst
+++ b/README.rst
@@ -1,7 +1,7 @@
|PyCorrFit|
===========
-|PyPI Version| |Build Status Win| |Build Status Mac| |Coverage Status|
+|PyPI Version| |Build Status Win| |Build Status Travis| |Coverage Status|
A graphical fitting tool for fluorescence correlation spectroscopy (FCS) that comes with support for several file formats, can be applied to a large variety of problems, and attempts to be as user-friendly as possible. Some of the features are
@@ -93,9 +93,9 @@ the running time of the build). From there you can download the Windows installe
.. |PyCorrFit| image:: https://raw.github.com/FCS-analysis/PyCorrFit/master/doc/Images/PyCorrFit_logo_dark.png
.. |PyPI Version| image:: http://img.shields.io/pypi/v/PyCorrFit.svg
:target: https://pypi.python.org/pypi/pycorrfit
-.. |Build Status Win| image:: https://img.shields.io/appveyor/ci/paulmueller/PyCorrFit/master.svg?label=build_win
+.. |Build Status Win| image:: https://img.shields.io/appveyor/ci/paulmueller/PyCorrFit/master.svg?label=win
:target: https://ci.appveyor.com/project/paulmueller/pycorrfit
-.. |Build Status Mac| image:: https://img.shields.io/travis/FCS-analysis/PyCorrFit/master.svg?label=build_mac
+.. |Build Status Travis| image:: https://img.shields.io/travis/FCS-analysis/PyCorrFit/master.svg?label=linux_osx
:target: https://travis-ci.org/FCS-analysis/PyCorrFit
.. |Coverage Status| image:: https://img.shields.io/coveralls/FCS-analysis/PyCorrFit.svg
:target: https://coveralls.io/r/FCS-analysis/PyCorrFit
diff --git a/pycorrfit/PyCorrFit.py b/pycorrfit/PyCorrFit.py
index 83a8b59..6fdaa24 100644
--- a/pycorrfit/PyCorrFit.py
+++ b/pycorrfit/PyCorrFit.py
@@ -6,5 +6,7 @@ from os.path import dirname, abspath, split
import sys
sys.path = [split(abspath(dirname(__file__)))[0]] + sys.path
-import pycorrfit
-pycorrfit.Main()
+from pycorrfit.gui import main
+
+if __name__ == "__main__":
+ main.Main()
diff --git a/pycorrfit/__init__.py b/pycorrfit/__init__.py
index a66e7c0..84c6a26 100644
--- a/pycorrfit/__init__.py
+++ b/pycorrfit/__init__.py
@@ -17,5 +17,3 @@ __version__ = meta.get_version()
__author__ = u"Paul Müller"
__license__ = "GPL v2"
-# Import the GUI in the end, because it needs `__version__`.
-from .gui.main import Main
\ No newline at end of file
diff --git a/pycorrfit/__main__.py b/pycorrfit/__main__.py
index 8fc4715..5467f23 100644
--- a/pycorrfit/__main__.py
+++ b/pycorrfit/__main__.py
@@ -2,6 +2,5 @@
"""
Runs PyCorrFit
"""
-
from .gui import main
main.Main()
diff --git a/pycorrfit/gui/frontend.py b/pycorrfit/gui/frontend.py
index 144b5cf..572ed13 100644
--- a/pycorrfit/gui/frontend.py
+++ b/pycorrfit/gui/frontend.py
@@ -9,7 +9,6 @@ functions and modules are called from here.
from distutils.version import LooseVersion # For version checking
import os
import webbrowser
-import wx
import wx.lib.agw.flatnotebook as fnb # Flatnotebook (Tabs)
import wx.py.shell
import numpy as np # NumPy
diff --git a/pycorrfit/models/__init__.py b/pycorrfit/models/__init__.py
index 28a4f25..d7d11eb 100644
--- a/pycorrfit/models/__init__.py
+++ b/pycorrfit/models/__init__.py
@@ -245,5 +245,3 @@ def GetPositionOfParameter(model, name):
for i in np.arange(len(stdparms[0])):
if name == stdparms[0][i]:
return int(i)
-
-
diff --git a/pycorrfit/models/classes.py b/pycorrfit/models/classes.py
index b1088ee..1be911a 100644
--- a/pycorrfit/models/classes.py
+++ b/pycorrfit/models/classes.py
@@ -152,4 +152,4 @@ class Model(object):
if len(self._definitions) < 5:
return None
else:
- return self._definitions[4]
\ No newline at end of file
+ return self._definitions[4]
diff --git a/pycorrfit/models/control.py b/pycorrfit/models/control.py
index 9b091fe..a7b0740 100644
--- a/pycorrfit/models/control.py
+++ b/pycorrfit/models/control.py
@@ -196,7 +196,9 @@ from . import model_confocal_t_3d_2d
from . import model_confocal_t_3d_3d_3d
from . import model_confocal_t_3d_3d_2d
+from . import model_confocal_tt_3d
from . import model_confocal_tt_3d_3d
+from . import model_confocal_tt_2d
from . import model_confocal_tt_2d_2d
from . import model_confocal_tt_3d_2d
diff --git a/pycorrfit/models/model_confocal_2d.py b/pycorrfit/models/model_confocal_2d.py
index a526ef8..1059f1a 100644
--- a/pycorrfit/models/model_confocal_2d.py
+++ b/pycorrfit/models/model_confocal_2d.py
@@ -21,7 +21,7 @@ def CF_Gxy_gauss(parms, tau):
Parameters (parms[i]):
[0] n Effective number of particles in confocal area
[1] τ_diff Characteristic residence time in confocal area
- [3] offset
+ [2] offset
*tau* - lag time
"""
n = parms[0]
diff --git a/pycorrfit/models/model_confocal_tt_2d.py b/pycorrfit/models/model_confocal_tt_2d.py
new file mode 100644
index 0000000..9ba5da6
--- /dev/null
+++ b/pycorrfit/models/model_confocal_tt_2d.py
@@ -0,0 +1,124 @@
+# -*- coding: utf-8 -*-
+from __future__ import division
+
+import numpy as np
+
+from .control import model_setup
+from .cp_confocal import twod
+from .cp_triplet import trip
+
+
+# 2D + TT Gauß
+# Model 6003
+def CF_Gxy_gauss_2DTT(parms, tau):
+ u""" Two-dimensional free diffusion
+ with a Gaussian laser profile, including two triplet components.
+ The triplet factor takes into account a blinking term.
+ Set *T* or *τ_trip* to 0, if no triplet component is wanted.
+
+ particle = 1/(1+τ/τ_diff)
+ triplet1 = 1 + T₁/(1-T₁)*exp(-τ/τ_trip₁)
+ triplet2 = 1 + T₂/(1-T₂)*exp(-τ/τ_trip₂)
+ G = 1/n*particle*triplet1*triplet2 + offset
+
+ *parms* - a list of parameters.
+ Parameters (parms[i]):
+ [0] n Effective number of particles in confocal volume
+ [1] τ_diff Diffusion time of particle
+ [2] τ_trip₁ Characteristic residence time in triplet state
+ [3] T₁ Fraction of particles in triplet (non-fluorescent) state
+ 0 <= T < 1
+ [4] τ_trip₂ Characteristic residence time in triplet state
+ [5] T₂ Fraction of particles in triplet (non-fluorescent) state
+ 0 <= T < 1
+ [6] offset
+ *tau* - lag time
+ """
+ n=parms[0]
+ taud=parms[1]
+ tautrip1=parms[2]
+ T1=parms[3]
+ tautrip2=parms[4]
+ T2=parms[5]
+ off=parms[6]
+
+ g = twod(tau=tau, taudiff=taud)
+
+ tr1 = trip(tau=tau, T=T1, tautrip=tautrip1)
+ tr2 = trip(tau=tau, T=T2, tautrip=tautrip2)
+
+ G = off + 1/n * g * tr1 * tr2
+
+ return G
+
+
+def supplements(parms, countrate=None):
+ # We can only give you the effective particle number
+ n = parms[0]
+ Info = list()
+ if countrate is not None:
+ # CPP
+ cpp = countrate/n
+ Info.append(["cpp [kHz]", cpp])
+ return Info
+
+
+parms = [
+ 4, # n
+ .4, # taud
+ 0.001, # tautrip1
+ 0.01, # T1
+ 0.002, # tautrip2
+ 0.01, # T2
+ 0.0 # offset
+ ]
+
+## Boundaries
+# strictly positive
+boundaries = [[0, np.inf]]*len(parms)
+# T
+boundaries[3] = [0,.9999999999999]
+boundaries[5] = [0,.9999999999999]
+# offset
+boundaries[-1] = [-np.inf, np.inf]
+
+
+model_setup(
+ modelid=6003,
+ name="2D diffusion with double triplet (confocal)",
+ comp="T+T+2D",
+ mtype="Confocal (Gaussian) with double triplet",
+ fctn=CF_Gxy_gauss_2DTT,
+ par_labels=[
+ u"n",
+ u"τ_diff [ms]",
+ u"τ_trip₁ [ms]",
+ u"T₁",
+ u"τ_trip₂ [ms]",
+ u"T₂",
+ u"offset"
+ ],
+ par_values=parms,
+ par_vary=[True, True, False, False, False, False, False],
+ par_boundaries=boundaries,
+ par_constraints=[[2, "<", 1], [4, ">", 2]],
+ par_hr_labels=[
+ u"n",
+ u"τ_diff [ms]",
+ u"τ_trip₁ [µs]",
+ u"T₁",
+ u"τ_trip₂ [µs]",
+ u"T₂",
+ u"offset"
+ ],
+ par_hr_factors=[
+ 1., # n
+ 1., # taudiff
+ 1000., # tautrip1 [µs]
+ 1., # T1
+ 1000., # tautrip2 [µs]
+ 1., # T2
+ 1. # offset
+ ],
+ supplementary_method=supplements
+ )
diff --git a/pycorrfit/models/model_confocal_tt_2d_2d.py b/pycorrfit/models/model_confocal_tt_2d_2d.py
index 623550b..2e4ce16 100644
--- a/pycorrfit/models/model_confocal_tt_2d_2d.py
+++ b/pycorrfit/models/model_confocal_tt_2d_2d.py
@@ -11,8 +11,8 @@ from .cp_mix import double_pnum
# 2D + 2D + TT Gauß
# Model 6044
-def CF_Gxyz_gauss_2D2DTT(parms, tau):
- u""" Two-component three-dimensional free diffusion
+def CF_Gxy_gauss_2D2DTT(parms, tau):
+ u""" Two-component two-dimensional free diffusion
with a Gaussian laser profile, including two triplet components.
The triplet factor takes into account a blinking term.
Set *T* or *τ_trip* to 0, if no triplet component is wanted.
@@ -122,7 +122,7 @@ model_setup(
name="Separate 2D diffusion with double triplet (confocal)",
comp="T+T+2D+2D",
mtype="Confocal (Gaussian) with double triplet",
- fctn=CF_Gxyz_gauss_2D2DTT,
+ fctn=CF_Gxy_gauss_2D2DTT,
par_labels=[
u"n",
u"τ"+u"\u2081"+" [ms]",
diff --git a/pycorrfit/models/model_confocal_tt_3d.py b/pycorrfit/models/model_confocal_tt_3d.py
new file mode 100644
index 0000000..d2b2843
--- /dev/null
+++ b/pycorrfit/models/model_confocal_tt_3d.py
@@ -0,0 +1,132 @@
+# -*- coding: utf-8 -*-
+from __future__ import division
+
+import numpy as np
+
+from .control import model_setup
+from .cp_confocal import threed
+from .cp_triplet import trip
+
+
+# 3D + Triplet Gauß
+# Model 6013
+def CF_Gxyz_gauss_3DTT(parms, tau):
+ u""" Three-dimensional free diffusion
+ with a Gaussian laser profile, including two triplet components.
+ The triplet factor takes into account a blinking term.
+ Set *T* or *τ_trip* to 0, if no triplet component is wanted.
+
+ particle1 = 1/( (1+τ/τ_diff) * sqrt(1+τ/(τ_diff*SP²)))
+ triplet1 = 1 + T₁/(1-T₁)*exp(-τ/τ_trip₁)
+ triplet2 = 1 + T₂/(1-T₂)*exp(-τ/τ_trip₂)
+ norm = (F₁ + α*(1-F₁))²
+ G = 1/n*particle*triplet1*triplet2 + offset
+
+ *parms* - a list of parameters.
+ Parameters (parms[i]):
+ [0] n Effective number of particles in confocal volume
+ [1] τ_diff Diffusion time of particle
+ [2] SP SP=z₀/r₀, Structural parameter,
+ describes elongation of the confocal volume
+ [3] τ_trip₁ Characteristic residence time in triplet state
+ [4] T₁ Fraction of particles in triplet (non-fluorescent) state
+ 0 <= T < 1
+ [5] τ_trip₂ Characteristic residence time in triplet state
+ [6] T₂ Fraction of particles in triplet (non-fluorescent) state
+ 0 <= T < 1
+ [7] offset
+ *tau* - lag time
+ """
+ n=parms[0]
+ taudiff=parms[1]
+ SP=parms[2]
+ tautrip1=parms[3]
+ T1=parms[4]
+ tautrip2=parms[5]
+ T2=parms[6]
+ off=parms[7]
+
+ g = threed(tau=tau, taudiff=taudiff, SP=SP)
+
+ tr1 = trip(tau=tau, T=T1, tautrip=tautrip1)
+ tr2 = trip(tau=tau, T=T2, tautrip=tautrip2)
+
+ G = off + 1/n * g * tr1 * tr2
+
+ return G
+
+
+def supplements(parms, countrate=None):
+ # We can only give you the effective particle number
+ n = parms[0]
+ Info = list()
+ if countrate is not None:
+ # CPP
+ cpp = countrate/n
+ Info.append(["cpp [kHz]", cpp])
+ return Info
+
+
+parms = [
+ 4, # n
+ .4, # taud1
+ 5, # SP
+ 0.001, # tautrip1
+ 0.01, # T1
+ 0.002, # tautrip2
+ 0.01, # T2
+ 0.0 # offset
+ ]
+
+## Boundaries
+# strictly positive
+boundaries = [[0, np.inf]]*len(parms)
+# T
+boundaries[4] = [0,.9999999999999]
+boundaries[6] = [0,.9999999999999]
+# offset
+boundaries[-1] = [-np.inf, np.inf]
+
+
+model_setup(
+ modelid=6009,
+ name="3D diffusion with double triplet (confocal)",
+ comp="T+T+3D",
+ mtype="Confocal (Gaussian) with double triplet",
+ fctn=CF_Gxyz_gauss_3DTT,
+ par_labels=[
+ u"n",
+ u"τ_diff [ms]",
+ u"SP",
+ u"τ_trip₁ [ms]",
+ u"T₁",
+ u"τ_trip₂ [ms]",
+ u"T₂",
+ u"offset"
+ ],
+ par_values=parms,
+ par_vary=[True, True, False, False, False, False, False, False],
+ par_boundaries=boundaries,
+ par_constraints=[[3, "<", 1], [5, ">", 3]],
+ par_hr_labels=[
+ u"n",
+ u"τ_diff [ms]",
+ u"SP",
+ u"τ_trip₁ [µs]",
+ u"T₁",
+ u"τ_trip₂ [µs]",
+ u"T₂",
+ u"offset"
+ ],
+ par_hr_factors=[
+ 1., # n
+ 1., # taudiff
+ 1., # SP
+ 1000., # tautrip1 [µs]
+ 1., # T1
+ 1000., # tautrip2 [µs]
+ 1., # T2
+ 1. # offset
+ ],
+ supplementary_method=supplements
+ )
diff --git a/pycorrfit/models/model_confocal_tt_3d_3d.py b/pycorrfit/models/model_confocal_tt_3d_3d.py
index 01b1e19..87fcf26 100644
--- a/pycorrfit/models/model_confocal_tt_3d_3d.py
+++ b/pycorrfit/models/model_confocal_tt_3d_3d.py
@@ -9,7 +9,7 @@ from .cp_triplet import trip
from .cp_mix import double_pnum
-# 3D + 3D + Triplet Gauß
+# 3D + 3D + TT Gauß
# Model 6043
def CF_Gxyz_gauss_3D3DTT(parms, tau):
u""" Two-component three-dimensional free diffusion
diff --git a/pycorrfit/readfiles/read_SIN_correlator_com.py b/pycorrfit/readfiles/read_SIN_correlator_com.py
index 3dc5c2c..2fd41d1 100644
--- a/pycorrfit/readfiles/read_SIN_correlator_com.py
+++ b/pycorrfit/readfiles/read_SIN_correlator_com.py
@@ -1,16 +1,14 @@
# -*- coding: utf-8 -*-
-"""
-methods to open correlator.com .sin files
-"""
+"""methods to open correlator.com .sin files"""
+from __future__ import division
+
import os
import csv
import numpy as np
def openSIN(dirname, filename):
- """ D
-
- """
+ """Parse .sin files (correlator.com)"""
path = os.path.join(dirname, filename)
with open(path) as fd:
data = fd.readlines()
@@ -27,11 +25,11 @@ def openSIN(dirname, filename):
if len(mode) - np.sum([len(m) for m in mode]) == 0:
return openSIN_integer_mode(path)
else:
- openSIN_old(path)
+ return openSIN_old(path)
def openSIN_integer_mode(path):
- """ Integer mode file format of e.g. flex03lq-1 correlator
+ """Integer mode file format of e.g. flex03lq-1 correlator (correlator.com)
This is a file format where the type (AC/CC) of the curve is
determined using integers in the "Mode=" line, e.g.
@@ -130,7 +128,7 @@ def openSIN_integer_mode(path):
dictionary["Correlation"] = correlations
dictionary["Trace"] = traces
dictionary["Type"] = curvelist
- filelist = list()
+ filelist = []
for _i in curvelist:
filelist.append(os.path.basename(path))
dictionary["Filename"] = filelist
@@ -138,7 +136,7 @@ def openSIN_integer_mode(path):
def openSIN_old(path):
- """ Parses the "old" sin file format using an "old" implementation.
+ """Parses the simple sin file format (correlator.com)
Read data from a .SIN file, usually created by
the software using correlators from correlator.com.
@@ -243,9 +241,9 @@ def openSIN_old(path):
StartT = i+2
if Alldata[i][0:11] == "[Histogram]":
EndT = i-2
- curvelist = list()
- correlations = list()
- traces = list()
+ curvelist = []
+ correlations = []
+ traces = []
# Get the correlation function
Truedata = Alldata.__getslice__(StartC, EndC)
timefactor = 1000 # because we want ms instead of s
@@ -264,12 +262,12 @@ def openSIN_old(path):
# Process all Data:
if Mode == "Single Auto":
curvelist.append("AC")
- corrdata = list()
+ corrdata = []
for row in readcorr:
# tau in ms, corr-function minus "1"
corrdata.append((np.float(row[0])*timefactor, np.float(row[1])-1))
correlations.append(np.array(corrdata))
- trace = list()
+ trace = []
for row in readtrace:
# tau in ms, corr-function minus "1"
trace.append((np.float(row[0])*timefactor,
@@ -277,13 +275,13 @@ def openSIN_old(path):
traces.append(np.array(trace))
elif Mode == "Single Cross":
curvelist.append("CC")
- corrdata = list()
+ corrdata = []
for row in readcorr:
# tau in ms, corr-function minus "1"
corrdata.append((np.float(row[0])*timefactor, np.float(row[1])-1))
correlations.append(np.array(corrdata))
- trace1 = list()
- trace2 = list()
+ trace1 = []
+ trace2 = []
for row in readtrace:
# tau in ms, corr-function minus "1"
trace1.append((np.float(row[0])*timefactor,
@@ -294,16 +292,16 @@ def openSIN_old(path):
elif Mode == "Dual Auto":
curvelist.append("AC1")
curvelist.append("AC2")
- corrdata1 = list()
- corrdata2 = list()
+ corrdata1 = []
+ corrdata2 = []
for row in readcorr:
# tau in ms, corr-function minus "1"
corrdata1.append((np.float(row[0])*timefactor, np.float(row[1])-1))
corrdata2.append((np.float(row[0])*timefactor, np.float(row[2])-1))
correlations.append(np.array(corrdata1))
correlations.append(np.array(corrdata2))
- trace1 = list()
- trace2 = list()
+ trace1 = []
+ trace2 = []
for row in readtrace:
# tau in ms, corr-function minus "1"
trace1.append((np.float(row[0])*timefactor,
@@ -315,16 +313,16 @@ def openSIN_old(path):
elif Mode == "Dual Cross":
curvelist.append("CC12")
curvelist.append("CC21")
- corrdata1 = list()
- corrdata2 = list()
+ corrdata1 = []
+ corrdata2 = []
for row in readcorr:
# tau in ms, corr-function minus "1"
corrdata1.append((np.float(row[0])*timefactor, np.float(row[1])-1))
corrdata2.append((np.float(row[0])*timefactor, np.float(row[2])-1))
correlations.append(np.array(corrdata1))
correlations.append(np.array(corrdata2))
- trace1 = list()
- trace2 = list()
+ trace1 = []
+ trace2 = []
for row in readtrace:
# tau in ms, corr-function minus "1"
trace1.append((np.float(row[0])*timefactor,
@@ -338,10 +336,10 @@ def openSIN_old(path):
curvelist.append("AC2")
curvelist.append("CC12")
curvelist.append("CC21")
- corrdata1 = list()
- corrdata2 = list()
- corrdata12 = list()
- corrdata21 = list()
+ corrdata1 = []
+ corrdata2 = []
+ corrdata12 = []
+ corrdata21 = []
for row in readcorr:
# tau in ms, corr-function minus "1"
corrdata1.append((np.float(row[0])*timefactor, np.float(row[1])-1))
@@ -352,8 +350,8 @@ def openSIN_old(path):
correlations.append(np.array(corrdata2))
correlations.append(np.array(corrdata12))
correlations.append(np.array(corrdata21))
- trace1 = list()
- trace2 = list()
+ trace1 = []
+ trace2 = []
for row in readtrace:
# tau in ms, corr-function minus "1"
trace1.append((np.float(row[0])*timefactor,
@@ -373,8 +371,9 @@ def openSIN_old(path):
dictionary["Correlation"] = correlations
dictionary["Trace"] = traces
dictionary["Type"] = curvelist
- filelist = list()
+ filelist = []
for i in curvelist:
filelist.append(os.path.basename(path))
dictionary["Filename"] = filelist
+
return dictionary
diff --git a/setup.py b/setup.py
index b2e3a6c..5f94a58 100644
--- a/setup.py
+++ b/setup.py
@@ -24,31 +24,33 @@ for scheme in INSTALL_SCHEMES.values():
# 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 "+
+ print("NumPy not available. Building extensions "+
"with this setup script will not work:", sys.exc_info())
- EXTENSIONS = []
- build_ext = None
+ extensions = []
else:
- EXTENSIONS = [Extension("pycorrfit.readfiles.read_pt3_scripts.fib4",
- ["pycorrfit/readfiles/read_pt3_scripts/fib4.pyx"],
- libraries=[],
- include_dirs=[np.get_include()]
- )
- ]
+ extensions = [Extension("pycorrfit.readfiles.read_pt3_scripts.fib4",
+ sources=["pycorrfit/readfiles/read_pt3_scripts/fib4.pyx"],
+ 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/FCS-analysis/PyCorrFit/wiki/PyCorrFit_doc.pdf"
-if not exists(Documentation):
- print("Downloading {} from {}".format(Documentation, webdoc))
+try:
import urllib
- #testfile = urllib.URLopener()
- urllib.urlretrieve(webdoc, Documentation)
+except ImportError:
+ pass
+else:
+ # Download documentation if it was not compiled with latex
+ pdfdoc = join(dirname(realpath(__file__)), "doc/PyCorrFit_doc.pdf")
+ webdoc = "https://github.com/FCS-analysis/PyCorrFit/wiki/PyCorrFit_doc.pdf"
+ if not exists(pdfdoc):
+ print("Downloading {} from {}".format(pdfdoc, webdoc))
+ try:
+ urllib.urlretrieve(webdoc, pdfdoc)
+ except:
+ print("Failed to download documentation.")
-
# Get the version of PyCorrFit from the Changelog.txt
StaticChangeLog = join(dirname(realpath(__file__)), "ChangeLog.txt")
try:
@@ -102,8 +104,7 @@ setup(
'pycorrfit.gui.tools': 'pycorrfit/gui/tools',
},
# cython
- ext_modules=EXTENSIONS,
- cmdclass={'build_ext': build_ext},
+ ext_modules = extensions,
# requirements
extras_require = {
# If you need the GUI of this project in your project, add
@@ -117,7 +118,7 @@ setup(
"PyYAML >= 3.09",
"lmfit >= 0.9.2",
],
- setup_requires=["cython", 'pytest-runner'],
+ setup_requires=["Cython", 'pytest-runner', 'NumPy'],
tests_require=["pytest", "urllib3", "simplejson"],
# scripts
entry_points={
diff --git a/tests/data_file_dl.py b/tests/data_file_dl.py
index 285ced2..2e697e7 100644
--- a/tests/data_file_dl.py
+++ b/tests/data_file_dl.py
@@ -163,13 +163,17 @@ def get_data_tree_remote(pool_manager=pool_manager, api_origin=api_origin):
# Key is generated with
#
# gem install travis
- # travis encrypt GH_READ_API_TOKEN=secret-token
+ # travis encrypt GITHUB_API_TOKEN=secret-token
#
# Add the result to env in travis.yml.
- if "GH_READ_API_TOKEN" in os.environ:
- headers["Authorization"] = "token {}".format(os.environ["GH_READ_API_TOKEN"])
- r = pool_manager.request("GET", url, headers=headers)
- jd = json.loads(r.data)
- tree = jd["tree"]
- _fcs_data_tree = [ t["path"] for t in tree ]
- return _fcs_data_tree
\ No newline at end of file
+ if "GITHUB_API_TOKEN" in os.environ:
+ headers["Authorization"] = "token {}".format(os.environ["GITHUB_API_TOKEN"])
+ r = pool_manager.request("GET", url, headers=headers, retries=10)
+ jd = json.loads(r.data)
+ tree = jd["tree"]
+ else:
+ r = pool_manager.request("GET", url, headers=headers, retries=10)
+ jd = json.loads(r.data)
+ tree = jd["tree"]
+ fcs_data_tree = [ t["path"] for t in tree ]
+ return fcs_data_tree
diff --git a/tests/test_constraints.py b/tests/test_constraints.py
index 84a4d8c..24f2f62 100644
--- a/tests/test_constraints.py
+++ b/tests/test_constraints.py
@@ -5,10 +5,11 @@ Test if constraints work with model functions.
"""
from __future__ import division, print_function
-import sys
-from os.path import abspath, dirname, split
import numpy as np
import os
+from os.path import abspath, dirname, split
+import pytest
+import sys
# Add parent directory to beginning of path variable
@@ -16,7 +17,10 @@ sys.path.insert(0, dirname(dirname(abspath(__file__))))
import data_file_dl
import pycorrfit as pcf
+NOAPITOKEN = "GITHUB_API_TOKEN" not in os.environ
+
+ at pytest.mark.xfail(NOAPITOKEN, reason="Restrictions to GitHub API")
def test_fit_constraint_simple_inequality():
""" Check "smaller than" relation during fitting.
"""
@@ -47,6 +51,7 @@ def test_fit_constraint_simple_inequality():
assert corr.fit_parameters[1] < corr.fit_parameters[2]
+ at pytest.mark.xfail(NOAPITOKEN, reason="Restrictions to GitHub API")
def test_fit_constraint_sum_smaller_one():
""" Check "a+b<c" relation during fitting.
"""
diff --git a/tests/test_file_formats.py b/tests/test_file_formats.py
index c08f2b2..59b9602 100644
--- a/tests/test_file_formats.py
+++ b/tests/test_file_formats.py
@@ -5,9 +5,11 @@ Test if pycorrfit can open all file formats.
"""
from __future__ import division, print_function
-import sys
-from os.path import abspath, dirname, split
import numpy as np
+import os
+from os.path import abspath, dirname, split
+import pytest
+import sys
# Add parent directory to beginning of path variable
sys.path.insert(0, dirname(dirname(abspath(__file__))))
@@ -17,7 +19,10 @@ import pycorrfit
# Files that are known to not work
exclude = []
+NOAPITOKEN = "GITHUB_API_TOKEN" not in os.environ
+
+ at pytest.mark.xfail(NOAPITOKEN, reason="Restrictions to GitHub API")
def test_open():
"""
Try to open all files supported files
@@ -30,7 +35,8 @@ def test_open():
continue
print(f)
dn, fn = split(f)
- pycorrfit.readfiles.openAny(dn, fn)
+ data = pycorrfit.readfiles.openAny(dn, fn)
+ assert len(data)
if __name__ == "__main__":
diff --git a/tests/test_simple.py b/tests/test_simple.py
index 50234ad..9bc5569 100644
--- a/tests/test_simple.py
+++ b/tests/test_simple.py
@@ -3,7 +3,6 @@
import sys
from os.path import abspath, dirname
-import matplotlib.pylab as plt
import numpy as np
# Add parent directory to beginning of path variable
@@ -41,6 +40,7 @@ def test_simple_corr():
if __name__ == "__main__":
+ import matplotlib.pylab as plt
corr = create_corr()
fig, (ax1, ax2) = plt.subplots(2,1)
--
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