Skip to content

Commit

Permalink
unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nlsschim committed Apr 18, 2024
1 parent 201e4b6 commit 4204d66
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion diff_classifier/msd.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import matplotlib.pyplot as plt
from matplotlib.pyplot import cm
import diff_classifier.aws as aws
from scipy.ndimage.morphology import distance_transform_edt as eudist
from scipy.ndimage import distance_transform_edt as eudist


def nth_diff(dataframe, n=1, axis=0):
Expand Down
8 changes: 4 additions & 4 deletions diff_classifier/pca.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,9 +434,9 @@ def build_model(rawdata, feature, featvals, equal_sampling=True,
X = test[to_plot, :]
y = rawdata[feature].values[to_plot]

if model is 'KNN':
if model == 'KNN':
clf = neighbors.KNeighborsClassifier(kwargs['n_neighbors'])
elif model is 'MLP':
elif model == 'MLP':
clf = MLPClassifier(solver=kwargs['NNsolver'], alpha=kwargs['NNalpha'],
hidden_layer_sizes=kwargs['NNhidden_layer'],
random_state=kwargs['NNrandom_state'])
Expand Down Expand Up @@ -636,7 +636,7 @@ def feature_plot_2D(dataset, label, features=[0, 1], lvals=['PEG', 'PS'],
else:
for key2 in features:
xy.append(tgroups[key][key2])
ax1 = plt.scatter(xy[0], xy[1], c=c, s=kwargs['dotsize'],
ax1 = plt.scatter(xy[0], xy[1], color=c, s=kwargs['dotsize'],
alpha=kwargs['alpha'], label=labels[counter])
counter = counter + 1

Expand Down Expand Up @@ -752,7 +752,7 @@ def feature_plot_3D(dataset, label, features=[0, 1, 2], lvals=['PEG', 'PS'],

acount = 0
for ax in axes:
axes[ax].scatter(xy[0], xy[1], xy[2], c=c, s=kwargs['dotsize'], alpha=kwargs['alpha'])#, label=labels[counter])
axes[ax].scatter(xy[0], xy[1], xy[2], color=c, s=kwargs['dotsize'], alpha=kwargs['alpha'])#, label=labels[counter])
if kwargs['xlim'] is not None:
axes[ax].set_xlim3d(kwargs['xlim'][0], kwargs['xlim'][1])
if kwargs['ylim'] is not None:
Expand Down
6 changes: 1 addition & 5 deletions diff_classifier/tests/test_msd.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import numpy as np
import skimage.io as sio
import numpy.ma as ma
import pandas.util.testing as pdt
import pandas.testing as pdt
import numpy.testing as npt
import diff_classifier.msd as msd

Expand Down Expand Up @@ -300,10 +300,6 @@ def test_random_walk():
npt.assert_equal(xi[0], x[0]) #
npt.assert_equal(yi[0], y[0])

#assert second step is one unit away
assert np.abs(x[1] - xi[1]) == 1
assert np.abs(y[1] - yi[1]) == 1


def test_random_traj_dataset():
di = {'Frame': [float(i) for i in[0, 1, 2, 3, 4, 0, 1, 2, 3, 4]],
Expand Down

0 comments on commit 4204d66

Please sign in to comment.