Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

Commit 4b30e15

Browse files
committed
Remove get_array()
1 parent e79ee11 commit 4b30e15

3 files changed

Lines changed: 1 addition & 36 deletions

File tree

include/bbp/sonata/report_reader.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@ struct SONATA_API DataFrame {
2525
std::vector<float> data;
2626
};
2727

28-
struct SpikeStruct {
29-
NodeID node_id;
30-
double timestamp;
31-
};
32-
using SpikeStruct = struct SpikeStruct;
3328
using Spike = std::pair<NodeID, double>;
3429
using Spikes = std::vector<Spike>;
3530

python/bindings.cpp

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,39 +1177,13 @@ PYBIND11_MODULE(_libsonata, m) {
11771177

11781178
bindStorageClass<EdgeStorage>(m, "EdgeStorage", "EdgePopulation");
11791179

1180-
PYBIND11_NUMPY_DTYPE(SpikeStruct, node_id, timestamp);
1181-
11821180
py::class_<SpikeReader::Population>(m, "SpikePopulation", "A population inside a SpikeReader")
11831181
.def("get",
11841182
&SpikeReader::Population::get,
11851183
DOC_SPIKEREADER_POP(get),
11861184
"node_ids"_a = nonstd::nullopt,
11871185
"tstart"_a = nonstd::nullopt,
11881186
"tstop"_a = nonstd::nullopt)
1189-
.def(
1190-
"get_array",
1191-
[](const SpikeReader::Population& self,
1192-
const py::object& node_ids = py::none(),
1193-
const py::object& tstart = py::none(),
1194-
const py::object& tstop = py::none()) {
1195-
auto spikes = self.get(
1196-
node_ids.is_none() ? nonstd::nullopt
1197-
: node_ids.cast<nonstd::optional<Selection>>(),
1198-
tstart.is_none() ? nonstd::nullopt : tstart.cast<nonstd::optional<double>>(),
1199-
tstop.is_none() ? nonstd::nullopt : tstop.cast<nonstd::optional<double>>());
1200-
std::vector<SpikeStruct> result;
1201-
result.reserve(spikes.size());
1202-
std::transform(spikes.begin(),
1203-
spikes.end(),
1204-
std::back_inserter(result),
1205-
[](const Spike& pair) {
1206-
return SpikeStruct{pair.first, pair.second};
1207-
});
1208-
return py::array_t<SpikeStruct>(result.size(), result.data());
1209-
},
1210-
"node_ids"_a = nonstd::nullopt,
1211-
"tstart"_a = nonstd::nullopt,
1212-
"tstop"_a = nonstd::nullopt)
12131187
.def(
12141188
"get_dict",
12151189
[](const SpikeReader::Population& self,

python/tests/test_reports.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,9 @@ def test_get_spikes_from_population(self):
4848

4949
self.assertEqual(len(self.test_obj['All'].get(node_ids=[])), 0)
5050

51-
structured_data = self.test_obj['All'].get_array()
51+
dict_data = self.test_obj['All'].get_dict()
5252
node_ids_ref = np.asarray([5, 2, 3, 2, 3])
53-
self.assertTrue((structured_data["node_id"] == node_ids_ref).all())
5453
timestamps_ref = np.asarray([0.1, 0.2, 0.3, 0.7, 1.3])
55-
self.assertTrue((structured_data["timestamp"] == timestamps_ref).all())
56-
57-
dict_data = self.test_obj['All'].get_dict()
5854
self.assertTrue((dict_data["node_ids"] == node_ids_ref).all())
5955
self.assertTrue((dict_data["timestamps"] == timestamps_ref).all())
6056

0 commit comments

Comments
 (0)