[test] fix import

This commit is contained in:
Jan Grewe 2021-02-06 16:42:14 +01:00
parent 457301e7c7
commit b0e42ab5f8
3 changed files with 9 additions and 7 deletions

View File

@ -1,10 +1,9 @@
import nixio as nix
import lif
import os
import nixview.test.lif as lif
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
from PIL import Image as img
from IPython import embed
def bivariate_normal(X, Y, sigmax=1.0, sigmay=1.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):
# create multiple responses of a lif model neuron
voltages = []
time = None
for t in range(trials):
time, voltage, _ = fake_neuron()
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",
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.unit = "s"
da.label = "voltage"
@ -103,7 +103,9 @@ def create_2d(f, b, trials=10):
def create_3d(f, b):
# 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)
channels = list(image.mode)
data = b.create_data_array("lena", "nix.image.rgb", data=img_data)

View File

@ -8,7 +8,7 @@ test_file = os.path.join(".", "nix_test.h5")
def setup():
if not os.path.exists(test_file):
from nixview.test.create_test_file import create_test_file
create_test_file()
create_test_file(test_file)
fhandler = file_handler.FileHandler()
yield fhandler
fhandler.close()

View File

@ -9,7 +9,7 @@ test_file = os.path.join(".", "nix_test.h5")
def app(qtbot):
if not os.path.exists(test_file):
from nixview.test.create_test_file import create_test_file
create_test_file()
create_test_file(test_file)
test_nv = NixView()
qtbot.addWidget(test_nv)
yield test_nv