WIP: Add reporter using circular buffer
Hi Jorn, Walter,
Currently with the reporter you can only get the instantaneous speed from the motility reporter, but I needed something that was a little smoother (my cells are a bit jumpy, so the movement direction can complete reverse from one frame to the next). So I wrote a moving avarage/sum reporter using boost::circular_buffer
and I thought maybe you would be interested as well.
(In hindsight I probably could have used the same approach as in the persistent motion plugin, as Margriet pointed out after I wrote the code
Pros:
- Works in logger/plots (see attached movie)
- Less code duplication in plugins
Cons:
- Requires boost (header only) (could roll your own circular buffer, but this works with all kinds of nice STL stuff)
- Getting the buffered value into other plugins is a little more work (need more symbol refs -> more complex xml)
Questions:
- I stored the values in a
map<CPM::CELL_ID, std::unique_ptr<boost::circular_buffer<VDOUBLE>>>
, but I guess I should usecellType->addProperty
? Would that work? - Currently I need to specify a time step, but I see in other plugins that you use stuff like
registerCellPositionDependency
, does that take care of setting the time-step as well? In principle I would like the plugin to work for arbitrary SymbolRefs/Expressions, are there similar tricks I could use (register symbol dependencies)? - Does the reworked symbol stuff you emailed me/us about change anything for this plugin? Is there a better way to do it?
Hope to hear from you!
Attachment: I took the RunAndTumble example, and added a buffered move_dir
variable:
movie
buffered_reporter_model.xml