S1S2Stimulus.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include "S1S2Stimulus.hpp"
00029
00030 S1S2Stimulus::S1S2Stimulus(double magnitude, double stimulusDuration, double s1Duration, double s1Period, double startTime, std::vector<double> s2Periods)
00031 : MultiStimulus()
00032 {
00033 mNumS2FrequencyValues = s2Periods.size();
00034 for (unsigned i=0; i<mNumS2FrequencyValues; i++)
00035 {
00036 boost::shared_ptr<MultiStimulus> p_experiment_stimulus(new MultiStimulus());
00037
00038 boost::shared_ptr<RegularStimulus> p_s1(new RegularStimulus(magnitude, stimulusDuration, s1Period, startTime, s1Duration+startTime));
00039 boost::shared_ptr<RegularStimulus> p_s2(new RegularStimulus(magnitude, stimulusDuration, s2Periods[i], s1Duration+startTime, s1Duration + 2*s2Periods[i]+startTime));
00040
00041 p_experiment_stimulus->AddStimulus(p_s1);
00042 p_experiment_stimulus->AddStimulus(p_s2);
00043
00044
00045
00046 this->AddStimulus(p_experiment_stimulus);
00047 }
00048 mS2Index=0u;
00049 }
00050
00051 double S1S2Stimulus::GetStimulus(double time)
00052 {
00053 return this->mStimuli[mS2Index]->GetStimulus(time);
00054 }
00055
00056 void S1S2Stimulus::SetS2ExperimentPeriodIndex(unsigned index)
00057 {
00058 if (index < mNumS2FrequencyValues)
00059 {
00060 mS2Index = index;
00061 }
00062 else
00063 {
00064 EXCEPTION("There are fewer S2 frequency values than the one you have requested.");
00065 }
00066 }
00067
00068 unsigned S1S2Stimulus::GetNumS2FrequencyValues()
00069 {
00070 return mNumS2FrequencyValues;
00071 }
00072
00073
00074 #include "SerializationExportWrapperForCpp.hpp"
00075 CHASTE_CLASS_EXPORT(S1S2Stimulus);
00076
00077