8 #include <highfive/H5File.hpp>
10 #include <bbp/sonata/optional.hpp>
11 #include <bbp/sonata/population.h>
17 template <
typename KeyType>
19 using DataType = std::vector<KeyType>;
20 std::vector<double> times;
23 std::vector<float> data;
26 using Spike = std::pair<NodeID, double>;
27 using Spikes = std::vector<Spike>;
29 std::vector<NodeID> node_ids;
30 std::vector<double> timestamps;
40 enum class Sorting : char {
81 Population(
const std::string& filename,
const std::string& populationName);
84 Sorting sorting_ = Sorting::none;
86 double tstart_, tstop_;
87 std::string time_units_;
89 void filterNode(Spikes& spikes,
const Selection& node_ids)
const;
90 void filterTimestamp(Spikes& spikes,
double tstart,
double tstop)
const;
94 Spikes createSpikes()
const;
106 const Population& openPopulation(
const std::string& populationName)
const;
109 std::string filename_;
112 mutable std::map<std::string, Population> populations_;
115 template <
typename KeyType>
125 std::tuple<double, double, double>
getTimes()
const;
180 struct NodeIdElementLayout {
181 typename DataFrame<KeyType>::DataType ids;
182 Selection::Ranges node_ranges;
183 std::vector<uint64_t> node_offsets;
184 std::vector<uint64_t> node_index;
185 Selection::Ranges min_max_blocks;
188 Population(
const HighFive::File& file,
const std::string& populationName);
200 NodeIdElementLayout getNodeIdElementLayout(
204 HighFive::Group pop_group_;
205 std::vector<NodeID> node_ids_;
206 std::vector<Selection::Range> node_ranges_;
207 std::vector<uint64_t> node_offsets_;
208 std::vector<uint64_t> node_index_;
209 double tstart_, tstop_, tstep_;
210 std::vector<std::pair<size_t, double>> times_index_;
211 std::string time_units_;
212 std::string data_units_;
213 bool is_node_ids_sorted_;
225 const Population& openPopulation(
const std::string& populationName)
const;
228 HighFive::File file_;
231 mutable std::map<std::string, Population> populations_;
Definition: report_reader.h:120
std::tuple< double, double, double > getTimes() const
std::string getDataUnits() const
DataFrame< KeyType > get(const nonstd::optional< Selection > &node_ids=nonstd::nullopt, const nonstd::optional< double > &tstart=nonstd::nullopt, const nonstd::optional< double > &tstop=nonstd::nullopt, const nonstd::optional< size_t > &tstride=nonstd::nullopt, const nonstd::optional< size_t > &block_gap_limit=nonstd::nullopt) const
std::vector< NodeID > getNodeIds() const
DataFrame< KeyType >::DataType getNodeIdElementIdMapping(const nonstd::optional< Selection > &node_ids=nonstd::nullopt, const nonstd::optional< size_t > &block_gap_limit=nonstd::nullopt) const
std::string getTimeUnits() const
Definition: report_reader.h:117
std::vector< std::string > getPopulationNames() const
Definition: selection.h:13
Definition: report_reader.h:38
const SpikeTimes & getRawArrays() const
Sorting getSorting() const
Spikes get(const nonstd::optional< Selection > &node_ids=nonstd::nullopt, const nonstd::optional< double > &tstart=nonstd::nullopt, const nonstd::optional< double > &tstop=nonstd::nullopt) const
std::string getTimeUnits() const
std::tuple< double, double > getTimes() const
SpikeTimes getArrays(const nonstd::optional< Selection > &node_ids=nonstd::nullopt, const nonstd::optional< double > &tstart=nonstd::nullopt, const nonstd::optional< double > &tstop=nonstd::nullopt) const
Used to read spike files.
Definition: report_reader.h:35
std::vector< std::string > getPopulationNames() const
class optional
Definition: optional.hpp:847
Definition: report_reader.h:18
Definition: report_reader.h:28