diff --git a/README.md b/README.md index 9b931ded4c8dc4e44f80db7ad8c78cd3f35da028..9d5536ba4f4508dddd52d3a80e0af754ba1690bc 100644 --- a/README.md +++ b/README.md @@ -51,19 +51,19 @@ SpikeDetectorDataView gives access to two arrays with the same number of entries class NestMultimeterDataView { double GetTimestep() const; conduit::uint64_array GetNeuronIds() const; - std::vector<std::string> GetIntegerParameterNames() const; - std::vector<std::string> GetFloatingPointParameterNames() const; - conduit::int64_array GetIntegerParameterValues( - const std::string& parameter + std::vector<std::string> GetIntegerAttributeNames() const; + std::vector<std::string> GetFloatingPointAttributeNames() const; + conduit::int64_array GetIntegerAttributeValues( + const std::string& attribute ) const; - conduit::float64_array GetFloatingPointParameterValues( - const std::string& parameter + conduit::float64_array GetFloatingPointAttributeValues( + const std::string& attribute ) const; }; ``` -NestMultimeterDataView gives access to the data recorded by a nest multimeter. One dataset describes the values of multiple parameters of multiple neurons *for a single timestep*. +NestMultimeterDataView gives access to the data recorded by a nest multimeter. One dataset describes the values of multiple attributes of multiple neurons *for a single timestep*. -The timestep can be retreived using `GetTimestep()`. The IDs of the nereurons whose attributes values are contained in this dataset can be retrieved using `GetNeuronIds()`. The names of the parameters stored in the dataset can be retrieved using `GetIntegerParameterNames()` and `GetFloatingPointParameterNames()` depending on their type. Finally, the values of each neuron for one parameter can be retrieved using `GetIntegerParameterValues()` or `GetFloatingPointParameterValues()` again depending on their type. The value with index `i` again corresponds to the neuron id with index `i` returned from `GetNeuronIds()`. +The timestep can be retreived using `GetTimestep()`. The IDs of the nereurons whose attributes values are contained in this dataset can be retrieved using `GetNeuronIds()`. The names of the attributes stored in the dataset can be retrieved using `GetIntegerAttributeNames()` and `GetFloatingPointAttributeNames()` depending on their type. Finally, the values of each neuron for one attribute can be retrieved using `GetIntegerAttributeValues()` or `GetFloatingPointAttributeValues()` again depending on their type. The value with index `i` again corresponds to the neuron id with index `i` returned from `GetNeuronIds()`. # Building nesci diff --git a/consumer/include/nesci/consumer/nest_multimeter_data_view.hpp b/consumer/include/nesci/consumer/nest_multimeter_data_view.hpp index 26f10e4d70606f5a28084c17901176239ae51d8b..361a5e1e6570cdb7e266305b7739ba6e1014b6ea 100644 --- a/consumer/include/nesci/consumer/nest_multimeter_data_view.hpp +++ b/consumer/include/nesci/consumer/nest_multimeter_data_view.hpp @@ -44,12 +44,12 @@ class NestMultimeterDataView : public DeviceDataView { bool IsValid() const; double GetTimestep() const; conduit::uint64_array GetNeuronIds() const; - std::vector<std::string> GetIntegerParameterNames() const; - std::vector<std::string> GetFloatingPointParameterNames() const; - conduit::int64_array GetIntegerParameterValues( - const std::string& parameter) const; - conduit::float64_array GetFloatingPointParameterValues( - const std::string& parameter) const; + std::vector<std::string> GetIntegerAttributeNames() const; + std::vector<std::string> GetFloatingPointAttributeNames() const; + conduit::int64_array GetIntegerAttributeValues( + const std::string& attribute) const; + conduit::float64_array GetFloatingPointAttributeValues( + const std::string& attribute) const; }; } // namespace consumer diff --git a/consumer/src/nest_multimeter_data_view.cpp b/consumer/src/nest_multimeter_data_view.cpp index d85391770e0cca55cfc5ccf76e21f6cce0891773..8727cd1f1e1af862d79f139e3879d29791f0094c 100644 --- a/consumer/src/nest_multimeter_data_view.cpp +++ b/consumer/src/nest_multimeter_data_view.cpp @@ -53,47 +53,47 @@ conduit::uint64_array NestMultimeterDataView::GetNeuronIds() const { } std::vector<std::string> -NestMultimeterDataView::GetFloatingPointParameterNames() const { - std::vector<std::string> parameters; - auto data_node = FetchPath(device_layout::GetParameterPath()); +NestMultimeterDataView::GetFloatingPointAttributeNames() const { + std::vector<std::string> attributes; + auto data_node = FetchPath(device_layout::GetAttributePath()); if (data_node) { const auto& data_schema = data_node->schema(); for (conduit::index_t i = 0; i < data_schema.number_of_children(); ++i) { const auto& child = data_schema.child(i); if (child.dtype().is_float64()) { - parameters.push_back(data_schema.child_name(i)); + attributes.push_back(data_schema.child_name(i)); } } } - return parameters; + return attributes; } -conduit::float64_array NestMultimeterDataView::GetFloatingPointParameterValues( - const std::string& parameter) const { - auto data_node = FetchPath(device_layout::GetPathForParameter(parameter)); +conduit::float64_array NestMultimeterDataView::GetFloatingPointAttributeValues( + const std::string& attribute) const { + auto data_node = FetchPath(device_layout::GetPathForAttribute(attribute)); return data_node != nullptr ? data_node->as_float64_array() : conduit::float64_array{}; } -std::vector<std::string> NestMultimeterDataView::GetIntegerParameterNames() +std::vector<std::string> NestMultimeterDataView::GetIntegerAttributeNames() const { - std::vector<std::string> parameters; - auto data_node = FetchPath(device_layout::GetParameterPath()); + std::vector<std::string> attributes; + auto data_node = FetchPath(device_layout::GetAttributePath()); if (data_node) { const auto& data_schema = data_node->schema(); for (conduit::index_t i = 0; i < data_schema.number_of_children(); ++i) { const auto& child = data_schema.child(i); if (child.dtype().is_int64()) { - parameters.push_back(data_schema.child_name(i)); + attributes.push_back(data_schema.child_name(i)); } } } - return parameters; + return attributes; } -conduit::int64_array NestMultimeterDataView::GetIntegerParameterValues( - const std::string& parameter) const { - auto data_node = FetchPath(device_layout::GetPathForParameter(parameter)); +conduit::int64_array NestMultimeterDataView::GetIntegerAttributeValues( + const std::string& attribute) const { + auto data_node = FetchPath(device_layout::GetPathForAttribute(attribute)); return data_node != nullptr ? data_node->as_int64_array() : conduit::int64_array{}; } diff --git a/consumer/tests/test_nest_multimeter_data_view.cpp b/consumer/tests/test_nest_multimeter_data_view.cpp index 5b14fdd2e48838aa9b1a0c094c75f4ec2a95f6df..a90a681d1e74ae193f1d85d2cfc8526361d75cc7 100644 --- a/consumer/tests/test_nest_multimeter_data_view.cpp +++ b/consumer/tests/test_nest_multimeter_data_view.cpp @@ -47,14 +47,14 @@ SCENARIO("NestMultimeter retrieves datum for time, attribute, neuron", REQUIRE(neuron_ids[0] == nesci::testing::ANY_ID); REQUIRE(neuron_ids[1] == nesci::testing::OTHER_ID); } - THEN("the double parameters are correct") { - auto float_param_names = multimeter_view.GetFloatingPointParameterNames(); + THEN("the double attributes are correct") { + auto float_param_names = multimeter_view.GetFloatingPointAttributeNames(); REQUIRE(float_param_names == nesci::testing::ANY_DOUBLE_ATTRIBUTES); for (size_t i = 0; i < nesci::testing::ANY_DOUBLE_ATTRIBUTES.size(); ++i) { auto float_param_values = - multimeter_view.GetFloatingPointParameterValues( + multimeter_view.GetFloatingPointAttributeValues( nesci::testing::ANY_DOUBLE_ATTRIBUTES[i]); REQUIRE(float_param_values.number_of_elements() == 2); REQUIRE(float_param_values[0] == nesci::testing::ANY_DOUBLE_VALUES[i]); @@ -62,12 +62,12 @@ SCENARIO("NestMultimeter retrieves datum for time, attribute, neuron", nesci::testing::OTHER_DOUBLE_VALUES[i]); } } - THEN("the long parameters are correct") { - auto int_param_names = multimeter_view.GetIntegerParameterNames(); + THEN("the long attributes are correct") { + auto int_param_names = multimeter_view.GetIntegerAttributeNames(); REQUIRE(int_param_names == nesci::testing::ANY_LONG_ATTRIBUTES); for (size_t i = 0; i < nesci::testing::ANY_LONG_ATTRIBUTES.size(); ++i) { - auto int_param_values = multimeter_view.GetIntegerParameterValues( + auto int_param_values = multimeter_view.GetIntegerAttributeValues( nesci::testing::ANY_LONG_ATTRIBUTES[i]); REQUIRE(int_param_values.number_of_elements() == 2); REQUIRE(int_param_values[0] == nesci::testing::ANY_LONG_VALUES[i]); diff --git a/nesci/include/nesci/nest_multimeter_layout.hpp b/nesci/include/nesci/nest_multimeter_layout.hpp index 394abe135bb0d89969e027e6cecafc72255eb71a..03404562a35e8c67eb385710e841f9b385e62333 100644 --- a/nesci/include/nesci/nest_multimeter_layout.hpp +++ b/nesci/include/nesci/nest_multimeter_layout.hpp @@ -32,10 +32,10 @@ inline std::string GetTimestepPath() { return "info/timestep"; } inline std::string GetNeuronIdsPath() { return "neuronIds"; } -inline std::string GetParameterPath() { return "parameters"; } +inline std::string GetAttributePath() { return "attributes"; } -inline std::string GetPathForParameter(const std::string& parameter) { - return GetParameterPath() + "/" + parameter; +inline std::string GetPathForAttribute(const std::string& attribute) { + return GetAttributePath() + "/" + attribute; } } // namespace nest_multimeter diff --git a/producer/src/nest_multimeter.cpp b/producer/src/nest_multimeter.cpp index 306bd574b52bffe5d1514fa21fd89238d5f0c112..f6c4e5ae4e4ce9325918827cd1461c761f06b87b 100644 --- a/producer/src/nest_multimeter.cpp +++ b/producer/src/nest_multimeter.cpp @@ -58,13 +58,13 @@ NestMultimeter::NestMultimeter(std::string device_name, current_offset += 8; for (const auto& name : double_value_names_) { - schema()[device_layout::GetPathForParameter(name)] = + schema()[device_layout::GetPathForAttribute(name)] = conduit::DataType::float64(0, current_offset, record_stride); current_offset += 8; } for (const auto& name : long_value_names_) { - schema()[device_layout::GetPathForParameter(name)] = + schema()[device_layout::GetPathForAttribute(name)] = conduit::DataType::int64(0, current_offset, record_stride); // NOLINT current_offset += 8; } @@ -94,7 +94,7 @@ void NestMultimeter::Record(double time, uint64_t node_id, // Set double values for (size_t i = 0; i < double_value_names_.size(); ++i) { *reinterpret_cast<double*>(record_pointer) = double_values[i]; - schema()[device_layout::GetPathForParameter(double_value_names_[i])] + schema()[device_layout::GetPathForAttribute(double_value_names_[i])] .dtype() .set_number_of_elements(record_count); record_pointer += 8; @@ -103,7 +103,7 @@ void NestMultimeter::Record(double time, uint64_t node_id, // Set long values for (size_t i = 0; i < long_value_names_.size(); ++i) { *reinterpret_cast<int64_t*>(record_pointer) = long_values[i]; - schema()[device_layout::GetPathForParameter(long_value_names_[i])] + schema()[device_layout::GetPathForAttribute(long_value_names_[i])] .dtype() .set_number_of_elements(record_count); record_pointer += 8; diff --git a/producer/tests/test_nest_multimeter.cpp b/producer/tests/test_nest_multimeter.cpp index 3e6eac2ad578ff108d05c807498236ccaa27fb6f..bbe2dba6eb069e2d1dfff413b1bc57e38702073a 100644 --- a/producer/tests/test_nest_multimeter.cpp +++ b/producer/tests/test_nest_multimeter.cpp @@ -56,7 +56,7 @@ SCENARIO("A nest multimeter records to a conduit node", for (size_t i = 0; i < nesci::testing::ANY_DOUBLE_ATTRIBUTES.size(); ++i) { - REQUIRE(node[device_layout::GetPathForParameter( + REQUIRE(node[device_layout::GetPathForAttribute( nesci::testing::ANY_DOUBLE_ATTRIBUTES[i])] .as_double() == Approx(nesci::testing::ANY_DOUBLE_VALUES[i])); @@ -64,7 +64,7 @@ SCENARIO("A nest multimeter records to a conduit node", for (size_t i = 0; i < nesci::testing::ANY_LONG_ATTRIBUTES.size(); ++i) { - REQUIRE(node[device_layout::GetPathForParameter( + REQUIRE(node[device_layout::GetPathForAttribute( nesci::testing::ANY_LONG_ATTRIBUTES[i])] .as_long() == nesci::testing::ANY_LONG_VALUES[i]); } @@ -90,7 +90,7 @@ SCENARIO("A nest multimeter records to a conduit node", for (size_t i = 0; i < nesci::testing::ANY_DOUBLE_ATTRIBUTES.size(); ++i) { const auto values = - node[device_layout::GetPathForParameter( + node[device_layout::GetPathForAttribute( nesci::testing::ANY_DOUBLE_ATTRIBUTES[i])] .as_double_array(); REQUIRE(values.number_of_elements() == 2); @@ -101,7 +101,7 @@ SCENARIO("A nest multimeter records to a conduit node", for (size_t i = 0; i < nesci::testing::ANY_LONG_ATTRIBUTES.size(); ++i) { const auto values = - node[device_layout::GetPathForParameter( + node[device_layout::GetPathForAttribute( nesci::testing::ANY_LONG_ATTRIBUTES[i])] .as_long_array(); REQUIRE(values.number_of_elements() == 2); @@ -115,7 +115,7 @@ SCENARIO("A nest multimeter records to a conduit node", for (size_t i = 0; i < nesci::testing::ANY_DOUBLE_ATTRIBUTES.size(); ++i) { - REQUIRE(node[device_layout::GetPathForParameter( + REQUIRE(node[device_layout::GetPathForAttribute( nesci::testing::ANY_DOUBLE_ATTRIBUTES[i])] .as_double() == Approx(nesci::testing::ANY_DOUBLE_VALUES[i])); @@ -123,7 +123,7 @@ SCENARIO("A nest multimeter records to a conduit node", for (size_t i = 0; i < nesci::testing::ANY_LONG_ATTRIBUTES.size(); ++i) { - REQUIRE(node[device_layout::GetPathForParameter( + REQUIRE(node[device_layout::GetPathForAttribute( nesci::testing::ANY_LONG_ATTRIBUTES[i])] .as_long() == nesci::testing::ANY_LONG_VALUES[i]); } diff --git a/testing/include/catch2/catch.hpp b/testing/include/catch2/catch.hpp index b1b2411d24885571e21ec4b3653af58c57011c3e..ac815d077d6676be0b806f599b8ac899ff754f34 100644 --- a/testing/include/catch2/catch.hpp +++ b/testing/include/catch2/catch.hpp @@ -688,8 +688,8 @@ struct is_unique<T0, T1, Rest...> : std::integral_constant #define CATCH_REC_LIST1_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0_UD) ) ( f, userdata, peek, __VA_ARGS__ ) #define CATCH_REC_LIST2_UD(f, userdata, x, peek, ...) f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ ) -// Applies the function macro `f` to each of the remaining parameters, inserts commas between the results, -// and passes userdata as the first parameter to each invocation, +// Applies the function macro `f` to each of the remaining attributes, inserts commas between the results, +// and passes userdata as the first attribute to each invocation, // e.g. CATCH_REC_LIST_UD(f, x, a, b, c) evaluates to f(x, a), f(x, b), f(x, c) #define CATCH_REC_LIST_UD(f, userdata, ...) CATCH_RECURSE(CATCH_REC_LIST2_UD(f, userdata, __VA_ARGS__, ()()(), ()()(), ()()(), 0)) diff --git a/testing/src/data.cpp b/testing/src/data.cpp index 47dfdeb6c5fc779a73962d6af1877ff401cbd82f..c54a64c84d609a2281677bbbdd54e3e806a32a09 100644 --- a/testing/src/data.cpp +++ b/testing/src/data.cpp @@ -27,7 +27,7 @@ namespace nesci { namespace testing { template <typename T> -std::string ParameterEntry(const std::string& name, const std::string& type, +std::string AttributeEntry(const std::string& name, const std::string& type, const std::vector<T>& values) { std::stringstream stream; stream << name << ": " @@ -56,19 +56,19 @@ conduit::Node CreateNestMultimeterDataNode() { << ANY_ID << "," << OTHER_ID << "]" " }," - " parameters: {" - << ParameterEntry<double>( + " attributes: {" + << AttributeEntry<double>( ANY_DOUBLE_ATTRIBUTES[0], "float64", {ANY_DOUBLE_VALUES[0], OTHER_DOUBLE_VALUES[0]}) << ", " - << ParameterEntry<double>( + << AttributeEntry<double>( ANY_DOUBLE_ATTRIBUTES[1], "float64", {ANY_DOUBLE_VALUES[1], OTHER_DOUBLE_VALUES[1]}) << ", " - << ParameterEntry<long>(ANY_LONG_ATTRIBUTES[0], "int64", // NOLINT + << AttributeEntry<long>(ANY_LONG_ATTRIBUTES[0], "int64", // NOLINT {ANY_LONG_VALUES[0], OTHER_LONG_VALUES[0]}) << ", " - << ParameterEntry<long>(ANY_LONG_ATTRIBUTES[1], "int64", // NOLINT + << AttributeEntry<long>(ANY_LONG_ATTRIBUTES[1], "int64", // NOLINT {ANY_LONG_VALUES[1], OTHER_LONG_VALUES[1]}) << " }" "}";