Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ExpData::clear_observations #2258

Merged
merged 3 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading