Skip to content

Commit da4e464

Browse files
author
Paul Müller
committed
Merge pull request #134 from paulmueller/develop
Develop
2 parents b9bcdea + 0fbda79 commit da4e464

20 files changed

+1412
-739
lines changed

ChangeLog.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
0.9.2
2+
- Bugfixes:
3+
- "Slider Simulation"/"Parm Range" broken (#133)
4+
- Computation of average intensity did not work
5+
correctly for unequally spaced traces
6+
- Update .pt3 reader to version 8399ff7401
7+
- Import traces of .pt3 files (#118)
8+
Warning: Absolute values for intensity might be wrong
19
0.9.1
210
- Tool 'Overlay curves': improve UI (#117)
311
- Tool 'Statistics view': improve UI (#113)

appveyor.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@
1010
# only:
1111
# - master
1212

13+
notifications:
14+
- provider: Email
15+
on_build_success: false
16+
on_build_failure: false
17+
on_build_status_changed: false
18+
19+
1320
environment:
1421

1522
global:
@@ -51,18 +58,24 @@ install:
5158
# the parent CMD process).
5259
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
5360

54-
5561
# Check that we have the expected version and architecture for Python
5662
- "python --version"
57-
63+
64+
# Install package-specific libraries
65+
# CONDA installs
66+
# Pinned versions are defined in freeze_appveyor\pinned
67+
- xcopy freeze_appveyor\pinned %PYTHON%\conda-meta\ /Y
68+
- "conda install --yes numpy"
69+
- "conda install --yes pip"
70+
- "conda install --yes scipy"
71+
- "conda install --yes wxpython"
72+
# PIP installs
5873
# Install the build dependencies of the project.
5974
- "pip install cython"
6075
- "pip install wheel"
61-
6276
# Install package-specific libraries
6377
- "pip install matplotlib"
6478
- "pip install sympy"
65-
6679
# Install pyinstaller
6780
- 'ECHO Downloading %PYWIN_DL%'
6881
- ps: (new-object net.webclient).DownloadFile("$env:PYWIN_DL", 'C:/pywin_inst.exe')

freeze_appveyor/Readme.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
freeze_appveyor
2+
---------------
3+
4+
files that are used by ../appveyor.yaml.
5+
6+
- `install.ps1` : install Miniconda
7+
powershell script that donwloads and installs stuff
8+
9+
- `pinned` : pin packages in Anaconda
10+
For example, NumPy is pinned to something <1.9.0, because
11+
WxPython will not work with numpy>1.9.0 due to this bug:
12+
http://trac.wxwidgets.org/ticket/16590
13+
14+
- `run_with_compiler.cmd` : powershell tools
15+
Something required for running stuff on i386 and x64

freeze_appveyor/install.ps1

Lines changed: 0 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -8,92 +8,12 @@ $GET_PIP_URL = "https://bootstrap.pypa.io/get-pip.py"
88
$GET_PIP_PATH = "C:\get-pip.py"
99

1010

11-
function DownloadPython ($python_version, $platform_suffix) {
12-
$webclient = New-Object System.Net.WebClient
13-
$filename = "python-" + $python_version + $platform_suffix + ".msi"
14-
$url = $BASE_URL + $python_version + "/" + $filename
15-
16-
$basedir = $pwd.Path + "\"
17-
$filepath = $basedir + $filename
18-
if (Test-Path $filename) {
19-
Write-Host "Reusing" $filepath
20-
return $filepath
21-
}
22-
23-
# Download and retry up to 3 times in case of network transient errors.
24-
Write-Host "Downloading" $filename "from" $url
25-
$retry_attempts = 2
26-
for($i=0; $i -lt $retry_attempts; $i++){
27-
try {
28-
$webclient.DownloadFile($url, $filepath)
29-
break
30-
}
31-
Catch [Exception]{
32-
Start-Sleep 1
33-
}
34-
}
35-
if (Test-Path $filepath) {
36-
Write-Host "File saved at" $filepath
37-
} else {
38-
# Retry once to get the error message if any at the last try
39-
$webclient.DownloadFile($url, $filepath)
40-
}
41-
return $filepath
42-
}
43-
44-
45-
function InstallPython ($python_version, $architecture, $python_home) {
46-
Write-Host "Installing Python" $python_version "for" $architecture "bit architecture to" $python_home
47-
if (Test-Path $python_home) {
48-
Write-Host $python_home "already exists, skipping."
49-
return $false
50-
}
51-
if ($architecture -eq "32") {
52-
$platform_suffix = ""
53-
} else {
54-
$platform_suffix = ".amd64"
55-
}
56-
$msipath = DownloadPython $python_version $platform_suffix
57-
Write-Host "Installing" $msipath "to" $python_home
58-
$install_log = $python_home + ".log"
59-
$install_args = "/qn /log $install_log /i $msipath TARGETDIR=$python_home"
60-
$uninstall_args = "/qn /x $msipath"
61-
RunCommand "msiexec.exe" $install_args
62-
if (-not(Test-Path $python_home)) {
63-
Write-Host "Python seems to be installed else-where, reinstalling."
64-
RunCommand "msiexec.exe" $uninstall_args
65-
RunCommand "msiexec.exe" $install_args
66-
}
67-
if (Test-Path $python_home) {
68-
Write-Host "Python $python_version ($architecture) installation complete"
69-
} else {
70-
Write-Host "Failed to install Python in $python_home"
71-
Get-Content -Path $install_log
72-
Exit 1
73-
}
74-
}
75-
7611
function RunCommand ($command, $command_args) {
7712
Write-Host $command $command_args
7813
Start-Process -FilePath $command -ArgumentList $command_args -Wait -Passthru
7914
}
8015

8116

82-
function InstallPip ($python_home) {
83-
$pip_path = $python_home + "\Scripts\pip.exe"
84-
$python_path = $python_home + "\python.exe"
85-
if (-not(Test-Path $pip_path)) {
86-
Write-Host "Installing pip..."
87-
$webclient = New-Object System.Net.WebClient
88-
$webclient.DownloadFile($GET_PIP_URL, $GET_PIP_PATH)
89-
Write-Host "Executing:" $python_path $GET_PIP_PATH
90-
Start-Process -FilePath "$python_path" -ArgumentList "$GET_PIP_PATH" -Wait -Passthru
91-
} else {
92-
Write-Host "pip already installed."
93-
}
94-
}
95-
96-
9717
function DownloadMiniconda ($python_version, $platform_suffix) {
9818
$webclient = New-Object System.Net.WebClient
9919
if ($python_version -eq "3.4") {
@@ -159,60 +79,8 @@ function InstallMiniconda ($python_version, $architecture, $python_home) {
15979
}
16080

16181

162-
function InstallMinicondaPip ($python_home) {
163-
$pip_path = $python_home + "\Scripts\pip.exe"
164-
$conda_path = $python_home + "\Scripts\conda.exe"
165-
if (-not(Test-Path $pip_path)) {
166-
Write-Host "Installing pip..."
167-
$args = "install --yes pip"
168-
Write-Host $conda_path $args
169-
Start-Process -FilePath "$conda_path" -ArgumentList $args -Wait -Passthru
170-
} else {
171-
Write-Host "pip already installed."
172-
}
173-
}
174-
175-
176-
function InstallMinicondaNumpy ($python_home) {
177-
$conda_path = $python_home + "\Scripts\conda.exe"
178-
Write-Host "Installing numpy..."
179-
# Current WxPython will not work with numpy>1.9.0 due to this bug:
180-
# http://trac.wxwidgets.org/ticket/16590
181-
#$args = "install --yes numpy"
182-
$args = "install --yes 'numpy<1.9.0'"
183-
Write-Host $conda_path $args
184-
Start-Process -FilePath "$conda_path" -ArgumentList $args -Wait -Passthru
185-
}
186-
187-
function InstallMinicondaScipy ($python_home) {
188-
$conda_path = $python_home + "\Scripts\conda.exe"
189-
Write-Host "Installing scipy..."
190-
# Current WxPython will not work with numpy>1.9.0 due to this bug:
191-
# http://trac.wxwidgets.org/ticket/16590
192-
#$args = "install --yes scipy"
193-
$args = "install --yes scipy numpy=1.8"
194-
Write-Host $conda_path $args
195-
Start-Process -FilePath "$conda_path" -ArgumentList $args -Wait -Passthru
196-
}
197-
198-
199-
function InstallMinicondaWxpython ($python_home) {
200-
$conda_path = $python_home + "\Scripts\conda.exe"
201-
Write-Host "Installing wxpython..."
202-
$args = "install --yes wxpython"
203-
Write-Host $conda_path $args
204-
Start-Process -FilePath "$conda_path" -ArgumentList $args -Wait -Passthru
205-
}
206-
207-
20882
function main () {
209-
#InstallPython $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON
210-
#InstallPip $env:PYTHON
21183
InstallMiniconda $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON
212-
InstallMinicondaPip $env:PYTHON
213-
InstallMinicondaNumpy $env:PYTHON
214-
InstallMinicondaScipy $env:PYTHON
215-
InstallMinicondaWxpython $env:PYTHON
21684
}
21785

21886
main

freeze_appveyor/pinned

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
numpy 1.8.*

pycorrfit/doc.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def __init__(self):
4141
import yaml
4242

4343
import readfiles
44+
from readfiles import read_pt3_scripts
4445

4546

4647
def GetLocationOfFile(filename):
@@ -155,7 +156,7 @@ def SoftwareUsed():
155156
"\n - wxPython "+wx.__version__
156157
# Other software
157158
text += "\n\nOther software:"+\
158-
"\n - FCS_point_correlator (9311a5c15e)" +\
159+
"\n - FCS_point_correlator ({})".format(read_pt3_scripts.version) +\
159160
"\n PicoQuant file format for Python by Dominic Waithe"
160161
if hasattr(sys, 'frozen'):
161162
pyinst = "\n\nThis executable has been created using PyInstaller."

pycorrfit/fcs_data_set.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import hashlib
99
import numpy as np
10+
import scipy.integrate as spintg
1011
import scipy.interpolate as spintp
1112
import scipy.optimize as spopt
1213
import warnings
@@ -61,7 +62,9 @@ def __repr__(self):
6162
@property
6263
def countrate(self):
6364
if self._countrate is None:
64-
self._countrate = np.average(self._trace[:,1])
65+
#self._countrate = np.average(self._trace[:,1])
66+
# Take into account traces that have arbitrary sampling
67+
self._countrate = spintg.simps(self._trace[:,1], self._trace[:,0]) / self.duration
6568
return self._countrate
6669

6770
@countrate.setter

pycorrfit/readfiles/read_FCS_Confocor3.py

Lines changed: 5 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import numpy as np
88
import warnings
99

10+
from . import util
1011

1112
def openFCS(dirname, filename):
1213
"""
@@ -128,37 +129,8 @@ def openFCS_Multiple(dirname, filename):
128129
trace.append( (np.float(row[3])*1000,
129130
np.float(row[4])/1000) )
130131
trace = np.array(trace)
131-
# The trace is too big. Wee need to bin it.
132-
if len(trace) >= 500:
133-
# We want about 500 bins
134-
# We need to sum over intervals of length *teiler*
135-
teiler = int(len(trace)/500)
136-
newlength = len(trace)/teiler
137-
newsignal = np.zeros(newlength)
138-
# Simultaneously sum over all intervals
139-
for j in np.arange(teiler):
140-
newsignal = \
141-
newsignal+trace[j:newlength*teiler:teiler][:,1]
142-
newsignal = 1.* newsignal / teiler
143-
newtimes = trace[teiler-1:newlength*teiler:teiler][:,0]
144-
if len(trace)%teiler != 0:
145-
# We have a rest signal
146-
# We average it and add it to the trace
147-
rest = trace[newlength*teiler:][:,1]
148-
lrest = len(rest)
149-
rest = np.array([sum(rest)/lrest])
150-
newsignal = np.concatenate((newsignal, rest),
151-
axis=0)
152-
timerest = np.array([trace[-1][0]])
153-
newtimes = np.concatenate((newtimes, timerest),
154-
axis=0)
155-
newtrace=np.zeros((len(newtimes),2))
156-
newtrace[:,0] = newtimes
157-
newtrace[:,1] = newsignal
158-
else:
159-
# Declare newtrace -
160-
# otherwise we have a problem down three lines ;)
161-
newtrace = trace
132+
# If the trace is too big. Wee need to bin it.
133+
newtrace = util.downsample_trace(trace)
162134
# Finally add the trace to the list
163135
traces.append(newtrace)
164136
if FoundType[:2] != "AC":
@@ -370,37 +342,8 @@ def openFCS_Single(dirname, filename):
370342
# So we need to put some factors here
371343
trace.append( (np.float(row[0])*1000, np.float(row[1])) )
372344
trace = np.array(trace)
373-
# The trace is too big. Wee need to bin it.
374-
if len(trace) >= 500:
375-
# We want about 500 bins
376-
# We need to sum over intervals of length *teiler*
377-
teiler = int(len(trace)/500)
378-
newlength = len(trace)/teiler
379-
newsignal = np.zeros(newlength)
380-
# Simultaneously sum over all intervals
381-
for j in np.arange(teiler):
382-
newsignal = \
383-
newsignal+trace[j:newlength*teiler:teiler][:,1]
384-
newsignal = 1.* newsignal / teiler
385-
newtimes = trace[teiler-1:newlength*teiler:teiler][:,0]
386-
if len(trace)%teiler != 0:
387-
# We have a rest signal
388-
# We average it and add it to the trace
389-
rest = trace[newlength*teiler:][:,1]
390-
lrest = len(rest)
391-
rest = np.array([sum(rest)/lrest])
392-
newsignal = np.concatenate((newsignal, rest),
393-
axis=0)
394-
timerest = np.array([trace[-1][0]])
395-
newtimes = np.concatenate((newtimes, timerest),
396-
axis=0)
397-
newtrace=np.zeros((len(newtimes),2))
398-
newtrace[:,0] = newtimes
399-
newtrace[:,1] = newsignal
400-
else:
401-
# Declare newtrace -
402-
# otherwise we have a problem down three lines ;)
403-
newtrace = trace
345+
# If the trace is too big. Wee need to bin it.
346+
newtrace = util.downsample_trace(trace)
404347
tracecurve = False
405348
if fcscurve == True:
406349
if Alldata[i].partition("=")[0].strip() == "##NPOINTS":

0 commit comments

Comments
 (0)