Comments (10)
I do not think this is in the scope of the Timer object, but it could certainly be added to Canvas.
from vispy.
We could provide at least the dt since last tick (it is quite useful and it saves the user the manipulation of time).
Nicolas
On Aug 25, 2013, at 2:45 PM, Luke Campagnola [email protected] wrote:
I do not think this is in the scope of the Timer object, but it could certainly be added to Canvas.
Reply to this email directly or view it on GitHub:
#28 (comment)
from vispy.
That's true.. there's a complication in that the timer can have multiple callbacks. Generally, each callback will want to know the time elapsed since that callback was last invoked (if one callback takes a variable amount of time, then subsequent callbacks would have an inaccurate measure of timestep). This would not be too difficult to implement, but the timer would need to keep track of the timing for each callback, probably with a subclass of EventEmitter.
from vispy.
Can we not assume (and document) that in a situation where timing is crucial, a custom timer will be used with just one callback?
From a look on the code, it seems that keeping track of time per callback is quite complicated (and hackish), while keeping track of the last tick is trivial.
from vispy.
That's not good. Getting elapsed time since last call is a very basic feature and if the current app architecture doesn't allow to implement this, we may want to reconsider the whole thing.
Again, pyglet is doing just that and quite precisely (even taking account clock over/under shoot) and thus, we might just to exract the clock.py object from pyglet.
from vispy.
I don't think this is due to the design of our event system. It is inherit to each design that supports multiple event handlers on a timer. So as long as a user in need of precise timings just adds a single handlers, all should be well.
Perhaps we should add some sort feature that can ensure that there is a single handler? For instance via an argument to the Timer class?
from vispy.
Not sure I understand.
Let's say I want a timer with 1/50 frequency and a second one with 1/20 frequency, how would I write that ? Maybe an example in app would be good. And of course, I would like to get dt in args/event since last tick in each timer, ~1/50 in first one, ~1/20 in second.
On Sep 1, 2013, at 8:12 PM, Almar Klein [email protected] wrote:
I don't think this is due to the design of our event system. It is inherit to each design that supports multiple event handlers on a timer. So as long as a user in need of precise timings just adds a single handlers, all should be well.
Perhaps we should add some sort feature that can ensure that there is a single handler? For instance via an argument to the Timer class?
Reply to this email directly or view it on GitHub:
#28 (comment)
from vispy.
Like this?
def callback1(event):
timesincelastcall = event.dt # This does not yet work, but we might do it like this
timer1 = app.Timer(1.0/50)
timer2 - app.Timer(1.0/20)
timer1.connect(callback1)
timer2.connect(callback2)
from vispy.
Yep exactly. Also dt should be time since last calling each callback (around 1/50 for callback1 and 1/20 for callback2)
On Sep 1, 2013, at 8:36 PM, Almar Klein [email protected] wrote:
Like this?
def callback1(event):
timesincelastcall = event.dt # This does not yet work, but we might do it like this
timer1 = app.Timer(1.0/50)
timer2 - app.Timer(1.0/20)
timer1.connect(callback1)
timer2.connect(callback2)
Reply to this email directly or view it on GitHub:
#28 (comment)
from vispy.
Timer events now have .dt attribute.
from vispy.
Related Issues (20)
- in (/vispy/visuals /surface_plot.py) line 129 HOT 2
- How to render canvas with original pixel values? HOT 13
- The case where the scan lines are parallel to the sides of the rectangle HOT 1
- Cannot find Quartz library on MacOS Sonoma HOT 18
- Issue with Image Clipping in Multiple Viewboxes HOT 3
- how can i disable the canvas border HOT 2
- No setter for some properties of Arrow or Line after instantiation HOT 3
- Question regarding datoviz, backends, gtk HOT 5
- destructive behaviour when lines overlap HOT 1
- Errorous behavior in Vispy.Visuals.Markers.set_data HOT 2
- grid solver constraint not working HOT 4
- Running vispy inside docker and not being able to access OpenGL drivers HOT 1
- SurfacePlotVisual.set_data cause vertex shader to perform unnecessary build HOT 3
- Looking for additional maintainers HOT 12
- vispy flickering on Windows with real time data HOT 12
- How to use a canvas decorator inside a custom class HOT 2
- How to change shortcut for camera Interaction in vispy HOT 2
- VisPy does not work properly if QtWebEngineWidgets is imported HOT 4
- Outdated Vispy version with Debian 12 package HOT 2
- Having problems with TextVisuals and InstancedMesh HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vispy.