//---------------------------------------------------------------------- void WS::Update(const PointProcess &data){ // Incrementing event counts is easy... for(int i = 0; i < data.number_of_events(); ++i) { const DateTime &event(data.event(i).timestamp()); DayNames day = event.date().day_of_week(); int hour = event.hour(); ++count_(day, hour); } // Increment exposure by integrating over the observation window. const DateTime &window_begin(data.window_begin()); const DateTime &window_end(data.window_end()); add_exposure_window(window_begin, window_end); }
void WrapperPointSet::go(int N, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int n9, int n10, int n11, int n12, int n13, int numLin){ _nsim = N; // std::cout <<_nsim<<std::endl; bool bools[12] = {(bool)n2,(bool)n3, (bool)n4, (bool)n5, (bool)n6, (bool)n7, (bool)n8, (bool)n9, (bool)n10, (bool)n11, (bool)n12, (bool)n13}; std::vector<bool> whichNonLin; for(int i =0;i<12;i++){ whichNonLin.push_back(bools[i]); } Parameters para; para.update(whichNonLin, numLin); PointProcess pointprocess; pointprocess.start(_nsim, para); _prepointsX = pointprocess.getXcord(); _prepointsY = pointprocess.getYcord(); }
static autoERPTier EEG_PointProcess_to_ERPTier (EEG me, PointProcess events, double fromTime, double toTime) { try { autoERPTier thee = Thing_new (ERPTier); Function_init (thee.peek(), fromTime, toTime); thy numberOfChannels = my numberOfChannels - EEG_getNumberOfExtraSensors (me); Melder_assert (thy numberOfChannels > 0); thy channelNames = NUMvector <char32 *> (1, thy numberOfChannels); for (long ichan = 1; ichan <= thy numberOfChannels; ichan ++) { thy channelNames [ichan] = Melder_dup (my channelNames [ichan]); } long numberOfEvents = events -> nt; thy events = SortedSetOfDouble_create (); double soundDuration = toTime - fromTime; double samplingPeriod = my sound -> dx; long numberOfSamples = (long) floor (soundDuration / samplingPeriod) + 1; if (numberOfSamples < 1) Melder_throw (U"Time window too short."); double midTime = 0.5 * (fromTime + toTime); double soundPhysicalDuration = numberOfSamples * samplingPeriod; double firstTime = midTime - 0.5 * soundPhysicalDuration + 0.5 * samplingPeriod; // distribute the samples evenly over the time domain for (long ievent = 1; ievent <= numberOfEvents; ievent ++) { double eegEventTime = events -> t [ievent]; autoERPPoint event = Thing_new (ERPPoint); event -> number = eegEventTime; event -> erp = Sound_create (thy numberOfChannels, fromTime, toTime, numberOfSamples, samplingPeriod, firstTime); double erpEventTime = 0.0; double eegSample = 1 + (eegEventTime - my sound -> x1) / samplingPeriod; double erpSample = 1 + (erpEventTime - firstTime) / samplingPeriod; long sampleDifference = lround (eegSample - erpSample); for (long ichannel = 1; ichannel <= thy numberOfChannels; ichannel ++) { for (long isample = 1; isample <= numberOfSamples; isample ++) { long jsample = isample + sampleDifference; event -> erp -> z [ichannel] [isample] = jsample < 1 || jsample > my sound -> nx ? 0.0 : my sound -> z [ichannel] [jsample]; } } Collection_addItem_move (thy events.get(), event.move()); } return thee; } catch (MelderError) { Melder_throw (me, U": ERP analysis not performed."); } }
void PoissonProcessSuf::update_raw(const PointProcess &data){ number_of_events_ += data.number_of_events(); exposure_time_ += data.window_duration(); }
void PoissonProcessSuf::Update(const PointProcess &process){ number_of_events_ += process.number_of_events(); exposure_time_ += process.window_duration(); }