Skip to content
Open
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
18 changes: 16 additions & 2 deletions src/single_cell/AbstractActionPotentialMethod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ AbstractActionPotentialMethod::AbstractActionPotentialMethod()
mRepeat(false),
mRepeatNumber(0u),
mSuppressOutput(false),
mSuppressWarnings(false),
mHertz(1.0), // default to 1 Hz, replaced by suitable command line
// argument if present.
mSuccessful(false),
Expand Down Expand Up @@ -157,15 +158,24 @@ unsigned AbstractActionPotentialMethod::GetErrorCode()
void AbstractActionPotentialMethod::WriteMessageToFile(
const std::string &rMessage)
{
WARNING(rMessage); // Send the message to std::cout as well as any message
// file in subclasses.
if (!mSuppressWarnings)
{
// Send the message to std::cout as well as any message
// file in subclasses.
WARNING(rMessage);
}
}

void AbstractActionPotentialMethod::SuppressOutput(bool suppress)
{
mSuppressOutput = suppress;
}

void AbstractActionPotentialMethod::SuppressWarnings(bool suppress)
{
mSuppressWarnings = suppress;
}

OdeSolution AbstractActionPotentialMethod::SteadyStatePacingExperiment(
boost::shared_ptr<AbstractCvodeCell> pModel,
double &rApd90,
Expand Down Expand Up @@ -292,6 +302,10 @@ OdeSolution AbstractActionPotentialMethod::SteadyStatePacingExperiment(
{
steady_runner.SuppressOutput();
}
if (mSuppressWarnings)
{
steady_runner.SuppressWarnings();
}
if (mMaxNumPaces != UNSIGNED_UNSET)
{
steady_runner.SetMaxNumPaces(mMaxNumPaces - num_paces_analysed_elsewhere);
Expand Down
10 changes: 10 additions & 0 deletions src/single_cell/AbstractActionPotentialMethod.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ class AbstractActionPotentialMethod
/** Whether to suppress output to std::cout */
bool mSuppressOutput;

/** Whether to suppress warning messages when no AP is detected. */
bool mSuppressWarnings;

/** The frequency in Hz at which to perform this run */
double mHertz;

Expand Down Expand Up @@ -385,6 +388,13 @@ class AbstractActionPotentialMethod
*/
void SuppressOutput(bool suppress = true);

/**
* Tell the simulator whether to suppress warnings when no AP is detected.
*
* @param suppress Whether to suppress no-AP warnings (defaults to true).
*/
void SuppressWarnings(bool suppress = true);

/**
* Tell this class to treat a lack of 1:1 correspondence between stimuli and
* action potentials
Expand Down
1 change: 1 addition & 0 deletions src/single_cell/ApPredictMethods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1064,6 +1064,7 @@ void ApPredictMethods::CommonRunMethod()
{
SingleActionPotentialPrediction ap_runner(mpModel);
ap_runner.SuppressOutput();
ap_runner.SuppressWarnings(); // We expect this not to be converged and to cause AP failures, don't want warnings
ap_runner.SetMaxNumPaces(100u);
this->SetVoltageThresholdForRecordingAsActionPotential(ap_runner.DetectVoltageThresholdForActionPotential());
}
Expand Down
40 changes: 21 additions & 19 deletions src/single_cell/SingleActionPotentialPrediction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ class SingleActionPotentialPrediction : public AbstractActionPotentialMethod
OdeSolution RunSteadyPacingExperiment()
{
double printing_timestep = 0.1;
return AbstractActionPotentialMethod::SteadyStatePacingExperiment(mpModel,
mApd90,
mApd50,
mUpstroke,
mPeak,
mPeakTime,
mCaMax,
mCaMin,
printing_timestep);
return this->SteadyStatePacingExperiment(mpModel,
mApd90,
mApd50,
mUpstroke,
mPeak,
mPeakTime,
mCaMax,
mCaMin,
printing_timestep);
}

/**
Expand All @@ -89,16 +89,16 @@ class SingleActionPotentialPrediction : public AbstractActionPotentialMethod
OdeSolution RunSteadyPacingExperiment(double conc)
{
double printing_timestep = 0.1;
return AbstractActionPotentialMethod::SteadyStatePacingExperiment(mpModel,
mApd90,
mApd50,
mUpstroke,
mPeak,
mPeakTime,
mCaMax,
mCaMin,
printing_timestep,
conc);
return this->SteadyStatePacingExperiment(mpModel,
mApd90,
mApd50,
mUpstroke,
mPeak,
mPeakTime,
mCaMax,
mCaMin,
printing_timestep,
conc);
}

/**
Expand Down Expand Up @@ -217,7 +217,9 @@ class SingleActionPotentialPrediction : public AbstractActionPotentialMethod
// Remember state variables
N_Vector steady_full_conductance_state_vars = mpModel->GetStateVariables();

this->SuppressWarnings(true);
OdeSolution solution = RunSteadyPacingExperiment();
this->SuppressWarnings(false);

// Put conductances back where they were!
mpModel->SetParameter(fast_sodium_name, original_na_conductance);
Expand Down