diff --git a/include/amici/edata.h b/include/amici/edata.h index 78bcba0fc7..5d613c6262 100644 --- a/include/amici/edata.h +++ b/include/amici/edata.h @@ -390,6 +390,13 @@ class ExpData : public SimulationParameters { */ realtype const* getObservedEventsStdDevPtr(int ie) const; + /** + * @brief Set all observations and their standard deviations to NaN. + * + * Useful, e.g., after calling ExpData::setTimepoints. + */ + void clear_observations(); + /** * @brief Arbitrary (not necessarily unique) identifier. */ diff --git a/src/edata.cpp b/src/edata.cpp index b9f95fca97..05499bb9cf 100644 --- a/src/edata.cpp +++ b/src/edata.cpp @@ -338,6 +338,18 @@ realtype const* ExpData::getObservedEventsStdDevPtr(int ie) const { return nullptr; } +void ExpData::clear_observations() { + std::fill(observed_data_.begin(), observed_data_.end(), getNaN()); + std::fill( + observed_data_std_dev_.begin(), observed_data_std_dev_.end(), getNaN() + ); + std::fill(observed_events_.begin(), observed_events_.end(), getNaN()); + std::fill( + observed_events_std_dev_.begin(), observed_events_std_dev_.end(), + getNaN() + ); +} + void ExpData::applyDimensions() { applyDataDimension(); applyEventDimension();