Skip to content

Commit

Permalink
fix pt3 test (numy 0.13)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Aug 27, 2017
1 parent 8fe839b commit 132991c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
12 changes: 7 additions & 5 deletions pycorrfit/readfiles/read_pt3_scripts/correlation_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,13 @@ def tttr2xfcs (y,num,NcascStart,NcascEnd, Nsub):
i1,i2 = fib4.dividAndConquer(y, y+lag,y.shape[0])

#If the weights (num) are one as in the first Ncasc round, then the correlation is equal to np.sum(i1)
i1 = i1.astype(np.bool);
i2 = i2.astype(np.bool);
i1 = np.where(i1.astype(np.bool))[0]
i2 = np.where(i2.astype(np.bool))[0]

#Now we want to weight each photon corectly.
#Faster dot product method, faster than converting to matrix.
auto[(k+(j)*Nsub),:,:] = np.dot((num[i1,:]).T,num[i2,:])/delta
if i1.size and i2.size:
auto[(k+(j)*Nsub),:,:] = np.dot((num[i1,:]).T,num[i2,:])/delta

autotime[k+(j)*Nsub] =shift;

Expand All @@ -108,8 +109,9 @@ def tttr2xfcs (y,num,NcascStart,NcascEnd, Nsub):


#Removes the trailing zeros.
autotime = autotime[autotime != 0]
auto = auto[autotime != 0,:,:]
idauto = np.where(autotime != 0)[0]
autotime = autotime[idauto]
auto = auto[idauto,:,:]
return auto, autotime


Expand Down
21 changes: 15 additions & 6 deletions tests/test_file_formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def test_asc_all_open():
for f in files:
if len([ex for ex in exclude if f.endswith(ex) ]):
continue
print(f)
dn, fn = split(f)
data = pycorrfit.readfiles.openAny(dn, fn)
assert len(data)
Expand All @@ -37,7 +36,6 @@ def test_asc_all_open():
@pytest.mark.xfail(NOAPITOKEN, reason="Restrictions to GitHub API")
def test_asc_alv7004usb():
"""Test alv7004/USB format"""

f1 = data_file_dl.get_data_file("ALV-7004USB_ac01_cc01_10.ASC")
data = pycorrfit.readfiles.openAny(f1)
assert data["Type"] == ["AC1", "AC2", "CC12", "CC21"]
Expand Down Expand Up @@ -88,7 +86,6 @@ def test_csv_all_open():
for f in files:
if len([ex for ex in exclude if f.endswith(ex) ]):
continue
print(f)
dn, fn = split(f)
data = pycorrfit.readfiles.openAny(dn, fn)
assert len(data)
Expand All @@ -102,7 +99,6 @@ def test_fcs_all_open():
for f in files:
if len([ex for ex in exclude if f.endswith(ex) ]):
continue
print(f)
dn, fn = split(f)
data = pycorrfit.readfiles.openAny(dn, fn)
assert len(data)
Expand All @@ -116,12 +112,26 @@ def test_pt3_all_open():
for f in files:
if len([ex for ex in exclude if f.endswith(ex) ]):
continue
print(f)
dn, fn = split(f)
data = pycorrfit.readfiles.openAny(dn, fn)
assert len(data)


@pytest.mark.xfail(NOAPITOKEN, reason="Restrictions to GitHub API")
def test_pt3_basic():
f1 = data_file_dl.get_data_file("PicoQuant_SymphoTime32_A42F-4jul2014/Point_1.pt3")
data = pycorrfit.readfiles.openAny(f1)

trace = data["Trace"][0][0]
assert trace.shape == (600, 2)
assert np.allclose(trace[40], np.array([2037, 6.48]))

corr = data["Correlation"][0]
assert corr.shape == (150, 2)
assert np.allclose(corr[40], np.array([0.000698, 0.58007174877053136]))
assert np.allclose(corr[100], np.array([0.72089, 0.019201608388821567]))


@pytest.mark.xfail(NOAPITOKEN, reason="Restrictions to GitHub API")
def test_sin_all_open():
# get list of supported file extensions
Expand All @@ -130,7 +140,6 @@ def test_sin_all_open():
for f in files:
if len([ex for ex in exclude if f.endswith(ex) ]):
continue
print(f)
dn, fn = split(f)
data = pycorrfit.readfiles.openAny(dn, fn)
assert len(data)
Expand Down

0 comments on commit 132991c

Please sign in to comment.