[test] fix import
This commit is contained in:
parent
457301e7c7
commit
b0e42ab5f8
@ -1,10 +1,9 @@
|
|||||||
import nixio as nix
|
import nixio as nix
|
||||||
import lif
|
import os
|
||||||
|
import nixview.test.lif as lif
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import matplotlib.pyplot as plt
|
|
||||||
import matplotlib.mlab as mlab
|
import matplotlib.mlab as mlab
|
||||||
from PIL import Image as img
|
from PIL import Image as img
|
||||||
from IPython import embed
|
|
||||||
|
|
||||||
def bivariate_normal(X, Y, sigmax=1.0, sigmay=1.0,
|
def bivariate_normal(X, Y, sigmax=1.0, sigmay=1.0,
|
||||||
mux=0.0, muy=0.0, sigmaxy=0.0):
|
mux=0.0, muy=0.0, sigmaxy=0.0):
|
||||||
@ -70,6 +69,7 @@ def create_1d_sampled(f, b):
|
|||||||
def create_2d(f, b, trials=10):
|
def create_2d(f, b, trials=10):
|
||||||
# create multiple responses of a lif model neuron
|
# create multiple responses of a lif model neuron
|
||||||
voltages = []
|
voltages = []
|
||||||
|
time = None
|
||||||
for t in range(trials):
|
for t in range(trials):
|
||||||
time, voltage, _ = fake_neuron()
|
time, voltage, _ = fake_neuron()
|
||||||
voltages.append(voltage)
|
voltages.append(voltage)
|
||||||
@ -78,7 +78,7 @@ def create_2d(f, b, trials=10):
|
|||||||
|
|
||||||
da = b.create_data_array("membrane voltages", "nix.regular_sampled.series",
|
da = b.create_data_array("membrane voltages", "nix.regular_sampled.series",
|
||||||
dtype=nix.DataType.Double, data=voltages)
|
dtype=nix.DataType.Double, data=voltages)
|
||||||
d = da.append_sampled_dimension(time[1]-time[0])
|
d = da.append_sampled_dimension(time[1] - time[0])
|
||||||
d.label = "time"
|
d.label = "time"
|
||||||
d.unit = "s"
|
d.unit = "s"
|
||||||
da.label = "voltage"
|
da.label = "voltage"
|
||||||
@ -103,7 +103,9 @@ def create_2d(f, b, trials=10):
|
|||||||
|
|
||||||
def create_3d(f, b):
|
def create_3d(f, b):
|
||||||
# taken from nix tutorial
|
# taken from nix tutorial
|
||||||
image = img.open('lena.bmp')
|
path = os.path.realpath(__file__).split(os.sep)[:-1]
|
||||||
|
path.append("lena.bmp")
|
||||||
|
image = img.open(os.sep.join(path))
|
||||||
img_data = np.array(image)
|
img_data = np.array(image)
|
||||||
channels = list(image.mode)
|
channels = list(image.mode)
|
||||||
data = b.create_data_array("lena", "nix.image.rgb", data=img_data)
|
data = b.create_data_array("lena", "nix.image.rgb", data=img_data)
|
||||||
|
@ -8,7 +8,7 @@ test_file = os.path.join(".", "nix_test.h5")
|
|||||||
def setup():
|
def setup():
|
||||||
if not os.path.exists(test_file):
|
if not os.path.exists(test_file):
|
||||||
from nixview.test.create_test_file import create_test_file
|
from nixview.test.create_test_file import create_test_file
|
||||||
create_test_file()
|
create_test_file(test_file)
|
||||||
fhandler = file_handler.FileHandler()
|
fhandler = file_handler.FileHandler()
|
||||||
yield fhandler
|
yield fhandler
|
||||||
fhandler.close()
|
fhandler.close()
|
||||||
|
@ -9,7 +9,7 @@ test_file = os.path.join(".", "nix_test.h5")
|
|||||||
def app(qtbot):
|
def app(qtbot):
|
||||||
if not os.path.exists(test_file):
|
if not os.path.exists(test_file):
|
||||||
from nixview.test.create_test_file import create_test_file
|
from nixview.test.create_test_file import create_test_file
|
||||||
create_test_file()
|
create_test_file(test_file)
|
||||||
test_nv = NixView()
|
test_nv = NixView()
|
||||||
qtbot.addWidget(test_nv)
|
qtbot.addWidget(test_nv)
|
||||||
yield test_nv
|
yield test_nv
|
||||||
|
Loading…
Reference in New Issue
Block a user