Skip to content

Commit

Permalink
Add ExpData::clear_observations (#2258)
Browse files Browse the repository at this point in the history
Makes it more convenient to unset all measurements, e.g. if one
wants to run a simulation for a given experimental condition but
with additional output timepoints while ignoring previously set
measuremnts.
  • Loading branch information
dweindl authored Jan 8, 2024
1 parent 3d01ebb commit 434e7be
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions include/amici/edata.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
12 changes: 12 additions & 0 deletions src/edata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 434e7be

Please sign in to comment.