Skip to content

Commit

Permalink
Fix missing units so tests run again (#269)
Browse files Browse the repository at this point in the history
* Fix missing units so tests run again
  • Loading branch information
mgeplf authored Sep 9, 2024
1 parent 8b827ca commit 835165d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Binary file modified tests/data/input_spikes.h5
Binary file not shown.
10 changes: 6 additions & 4 deletions tests/data/reporting/create_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import h5py
import numpy as np

string_dtype = h5py.special_dtype(vlen=str)


def write_spikes(filepath):
population_names = ["default", "default2"]
Expand All @@ -16,13 +18,15 @@ def write_spikes(filepath):
gpop_spikes = h5f.create_group("/spikes/" + population_names[0])
gpop_spikes.attrs.create("sorting", data=2, dtype=sorting_type)
timestamps, node_ids = zip(*sorted(zip(timestamps_base, node_ids_base)))
gpop_spikes.create_dataset("timestamps", data=timestamps, dtype=np.double)
dtimestamps = gpop_spikes.create_dataset("timestamps", data=timestamps, dtype=np.double)
dtimestamps.attrs.create("units", data="ms", dtype=string_dtype)
gpop_spikes.create_dataset("node_ids", data=node_ids, dtype=np.uint64)

gpop_spikes2 = h5f.create_group("/spikes/" + population_names[1])
gpop_spikes2.attrs.create("sorting", data=1, dtype=sorting_type)
node_ids, timestamps = zip(*sorted(zip(node_ids_base, timestamps_base)))
gpop_spikes2.create_dataset("timestamps", data=timestamps, dtype=np.double)
dtimestamps2 = gpop_spikes2.create_dataset("timestamps", data=timestamps, dtype=np.double)
dtimestamps2.attrs.create("units", data="ms", dtype=string_dtype)
gpop_spikes2.create_dataset("node_ids", data=node_ids, dtype=np.uint64)


Expand All @@ -33,7 +37,6 @@ def write_soma_report(filepath):
element_ids = np.zeros(3)
times = (0.0, 1.0, 0.1)
data = [node_ids + j * 0.1 for j in range(10)]
string_dtype = h5py.special_dtype(vlen=str)
with h5py.File(filepath, "w") as h5f:
h5f.create_group("report")
gpop_all = h5f.create_group("/report/" + population_names[0])
Expand Down Expand Up @@ -70,7 +73,6 @@ def write_element_report(filepath):

times = (0.0, 1, 0.1)

string_dtype = h5py.special_dtype(vlen=str)
with h5py.File(filepath, "w") as h5f:
h5f.create_group("report")
gpop_element = h5f.create_group("/report/" + population_names[0])
Expand Down
Binary file modified tests/data/reporting/spikes.h5
Binary file not shown.

0 comments on commit 835165d

Please sign in to comment.