Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 31 2019 16:26
    kmuehlbauer commented #1568
  • Jan 31 2019 16:15
    kmuehlbauer commented #1568
  • Jan 31 2019 15:53
    djhoese commented #1568
  • Jan 31 2019 15:46
    kmuehlbauer edited #1568
  • Jan 31 2019 15:44
    kmuehlbauer opened #1568
  • Jan 31 2019 15:32
    djhoese commented #1566
  • Jan 31 2019 15:30
    djhoese commented #1567
  • Jan 31 2019 14:18
    GuillaumeFavelier commented #1561
  • Jan 31 2019 14:15
    GuillaumeFavelier commented #1561
  • Jan 31 2019 12:46
    opekar synchronize #1130
  • Jan 31 2019 09:54
    kmuehlbauer commented #1567
  • Jan 31 2019 09:53
    kmuehlbauer synchronize #1567
  • Jan 31 2019 09:37
    kmuehlbauer labeled #1567
  • Jan 31 2019 09:37
    kmuehlbauer labeled #1567
  • Jan 31 2019 09:37
    kmuehlbauer labeled #1563
  • Jan 31 2019 09:36
    kmuehlbauer labeled #1563
  • Jan 31 2019 09:28
    kmuehlbauer commented #1567
  • Jan 31 2019 09:27
    kmuehlbauer synchronize #1567
  • Jan 31 2019 09:19
    kmuehlbauer assigned #1563
  • Jan 31 2019 09:17
    kmuehlbauer opened #1567
David Hoese
@djhoese
VisPy 0.9.5 has been released on PyPI! conda-forge should be later tonight
Lorenzo Gaifas
@brisvag
<3
David Hoese
@djhoese
I ended making a 0.9.6 release too. Hopefully fixes an issue @jni was seeing
are the individual plots considered vertex and are the individual plot locations set by the 'index' variable on line 39? I would like to build on this example for a basic real time stream plotter from a USB link. Also, have you guys ever tested this with pyinstaller so it can be packaged up with a python application and deployed as an exe?
David Hoese
@djhoese
@m3atwad There are multiple issues discussing pyinstaller use. See vispy/vispy#1643 and vispy/vispy#2300
for that example and what you're doing, how many signals do you want to plot at once? I personally really dislike this example and want to rename it or remove it. It creates these many plots by "cheating" and doesn't resemble what a real world maintainable and flexible application would look like.
m3atwad
@m3atwad
@djhoese thank you very much for you reply! I see, I'm ok with python but very new to the GPU situation and am trying to at most plot 4 different plots from an ADC. I am using matplot lib now and get a decent frame rate using blitting with ~2048 16 bit integers. I am trying to upgrade this to maybe 1M points of floats. I would at most just do 4 of these plots and am just nervous about investing a lot of my dev time in another platform that ultimately is a dead end. This approach looks awesome but I'm so new I don't know what I don't know yet to pull the trigger in commiting dev time to this library. Is it possible to elaborate on what this example is missing? Also, is the individual plot location and settings (not data points / y values but actual size, location etc...) set by the shader code (FRAG and VERT shader lines)?
Nicolas P. Rougier
@rougier
@m3atwad @djhoese This example fits a real time signal that need to update only one data point at eah time step. Instead of reuploading 1M points, you only update the new point and the shader knows how to display it properly.
m3atwad
@m3atwad
is it possible to have a vector where you update a block say in 1M points you update 512 or 1024 or 60 etc...?
Nicolas P. Rougier
@rougier
Theoretically yes as long as they are displayed continuously on screen. The trick is to use a moving index to make the upload. for large chunk, thi may need to be split into two upload. You can test the trick with matplotlib only.
m3atwad
@m3atwad
@rougier I apologize if asking this many questions on here is inappropriate for this forum. Please let me know if so. My goal is to effectively create a vector of data and refresh a plot. In an ideal situation I'm trying to end up with a software window that mimics an oscilloscope to view electrical signals. So with this said I'm looking to get a decent framerate for a data vector and plot (1 to 4) that I can manipulate. What do you mean "continuously displayed on screen" and are you recommending I have a giant data vector I append to and just move the index for plotting rather than create a new data vector every time that I would submit to vispy?
Nicolas P. Rougier
@rougier
For an oscilloscope-like display, you don't need much data since the resolution of the screen limits what you can display. Let's say you want to display 2000 vertices, you need a vertex buffer of 2000 floats but you need to update only one at each timestep (unless your data refresh rate is faster than the display refresh rate). The trick to update the vertex buffer is to have an index that is incremented by one at each time step adn this where you upload your new data. Now, the shader must be aware of this index to properly display the line, that is actually two lines. Best is to test using matplotlib. For example, let's pretend a numpy array is a vertex buffer holding y value only and plot it using a mpl.plot. You'll need to split it in two line plots I think.
m3atwad
@m3atwad
so as an example right now I have 60 bytes coming in as a block rather than a byte data stream. This will yield 30 16bit values. So would I need to loop through all 30 and added them individually to the vertex buffer? It looks like this example is doing just what I'm referring to with a chunk of 10 values.
Nicolas P. Rougier
@rougier
You can upload any contiguous chunk of data with a single call, no need to loop. In numpy, you would write something like Z[index:index+chunk_size] = chunk, index += chunk_size But you have to take care of the case where index is close to the end of Z. in such case, you need to split your data in two parts and make 2 uploads.
m3atwad
@m3atwad
oh ok, yea i'm thinking about it more as a hardware digital guy....i'd shift data out of the array at one end and shift data in at the other....OR create a new frame every time.
Nicolas P. Rougier
@rougier
David Hoese
@djhoese
@m3atwad The key in the glumpy example is the np.roll. You could also do this kind of thing on a numpy array that's 2 times the size of the buffer you need and treat it like a circular buffer. You update the array in two places with your new chunk, but the data you upload to matplotlib/vispy is the slice of the large array that represents the current N data points.
The key point of this whole discussion is that you could use vispy or matplotlib for this, but since you're already using matplotlib with blitting you should be fine. If you reduce the resolution of your data (ex. average or only show some of the data) and/or reduce how often you try to update the display then you should see better results while not effecting what you/the user actually sees
Omicron91
@Omicron91
Hello guys. I'm trying to rotate a point cloud aplying a SSTTransform to the scatter plot. The origin of the transform component is always on center by default i think, how could I move it?
Omicron91
@Omicron91
reference.png
Nicolas P. Rougier
@rougier
Can't you first apply a translation then a rotation ?
Omicron91
@Omicron91
I tried, how ever, it seems that the origin moves with the translation
David Hoese
@djhoese
I'm a little confused. Are you using a camera? Usually the cameras have properties for rotation. This would mean you rotate that camera rather than the data.
Omicron91
@Omicron91
Mmm I need to manually align a point cloud. I'm changing de cross-section over the Z axis of my cloud, then i can compare the shape in that section with a given ellipse to visually check if it is aligned or not. I.e. If the cloud is not aligned i'll see an offset between the cross-section and the ellipse. Then i need to rotate and store the data to work with the aligned cloud in the future
David Hoese
@djhoese
@Omicron91 Do you have some sample code you could show us?
Omicron91
@Omicron91
@djhoese Umm it's not easy to share a sample code due i'm working this with qt, and a point cloud has a size of 1~5GB. I will try to code some minimal example today
David Hoese
@djhoese
I'm not sure if I understand what you are doing and what you are having trouble with without some minimal example. You could even use fake point cloud (random) data. You didn't answer the question I had before though which may help. Are you using a camera? Are you using the SceneCanvas or the regular Canvas? You want to change the STTransform, but which one? The one on your visual or a camera?
Omicron91
@Omicron91
mmm I'm using panzoom camera over a SceneCanvas. Now i can properly rotate the cloud translating > rotating > translating back. When I create my scatter = scene.visuals.Markers(), then scatter.set_data(pos=points) I would like to get back the points of my rotated cloud, where can I found all of these points when I add a transform component?
David Hoese
@djhoese

I would like to get back the points of my rotated cloud

So you want to get an array of the positions with the transform applied?

m3atwad
@m3atwad
@rougier Hi Nicholas, quick question about glumpy. I am trying to run your linked example and I think I have everything installed but am stuck at the "back end" requirement. I have wxpython installed, but it seems thats not what is meant by installing one of the backends. What type of backend does python need to be installed to run these examples? Is there a difference between wxpython and Wx3?
Nicolas P. Rougier
@rougier
You need the corresponding C library so it depends on your installation. Easiest is to use the GLFW backend which is rahter light.
m3atwad
@m3atwad
Ok. is it possible to embed the glumpy plot in a wxPython frame?
Nicolas P. Rougier
@rougier
Theoretically yes but I've never tested it.
m3atwad
@m3atwad
ok. Does the installation tutorial work with a python vm?
Nicolas P. Rougier
@rougier
Not sure how this would interact with the hardware but it may be worth a try. Other solution is to translate the example to vispy.
m3atwad
@m3atwad
so what exactly is the difference between vispy and glumpy?
Nicolas P. Rougier
@rougier
Long story short, vispy has been created by 4 developpers having each their own library. I've designed glumpy and I use it as a teste bed for vispy. It's less advanced and maintained compated to vispy and best is to use vispy.
m3atwad
@m3atwad
oh ok
I noticed in the installation tutorial for GLFW it says to pull out the "glfw.dll" file from the binary download. I think they have updated some stuff and I see all glfw3.dll files instead. I assume there is no issue following the installation tutorial and just using glfw3.dll from the lib-mingw-w64 folder?
the issue is that I can't get the example to run because it can't find the back end
Nicolas P. Rougier
@rougier
It's a reccurent problme with ctypes that fail at locating some libraries. You can try to help ctypes by feeding absolute path.
m3atwad
@m3atwad
Would this be difficult to port over to vispy or is it pretty much just a copy and past? I found this github pull request that actually is very close to what I need to do.
vispy/vispy#694
So if I need to switch to vispy to use wxpython maybe I'm just better off taking this example over to vispy now?
David Hoese
@djhoese
Yes, I would try to use vispy for this. Glumpy is low-level enough that there are very few things that it can do that vispy can't (my guess). It has extra examples that @rougier has built up over the years to show off the features though so some things need to be done "manually".
Nicolas P. Rougier
@rougier
@djhoese Your guess is correct and I second that vispy is a better option.
m3atwad
@m3atwad

hey guys - i have gotten the original vispy example up and running. What direction should I go to add cursors? I figured the first two things I need to do is add this example to a WxPython frame which seems possible and start getting cursors up and running. The cursors are to mimic an oscilloscope trigger (horizontal bar) and location (vertical yellow bar). If you aren't familiar with an O'scope, these will basically cause the signal content that breaks above the horzontal yellow bar to be centered at the vertical bar. So I need a way for the user to drag these bars around on the screen to affect the data displayed and the x-axis location. I see how the 'y data' vector is working, but how do you add a line/cursor to the plot? It looks like I would need to plot two separate vectors? One being the data vector and one being the cursor line vector? Maybe listing would be better

  1. How do I add another vector (line) to each plot?
  2. Can I get the position of this vector (x or y values from the cursor) once plotted?
  3. Is it difficult to add plot legends? Like -1 to 1 or 0 to 2 and x axis time (so many seconds or milliseconds)?
  4. would the x/y axis legends be done on the gpu or do those need to be done manually in the GUI toolkit by the cpu?

basically my next step is to try to get this looking like a plot. I've added a picture too.

image.png
David Hoese
@djhoese
@m3atwad
  1. What does your code look like now? It would be easiest if you used a SceneCanvas (if not already) and added a separate LineVisual for the cursors.
  2. If you're using mouse events to move/set the lines then you could use the mouse position to convert (transform) to the line/data coordinates.
  3. By legends you mean a little box that shows a line of one color and says "Voltage" and another line with another color and says "Current" to essentially label the plots? There are Visual objects for axes if you want those. I should warn though that the more Visuals you add the slower the drawing may become.
  4. You could do either, but to make it perform well would require some "fun" custom shader code.
m3atwad
@m3atwad

Hi David, Thank you! I am currently just trying to gauge a little bit of the difficulty so I can estimate what kind of time investment there would be to get a pretty good proof of concept UI up and running. I don't have much code yet and am just working off a modified version of the example I originally started with (realtime signal example). Before I jumped in I was just trying to figure out how to connect cursors and UI controls (wx python UI widgets) to the data actually being plotted by the shaders (I think that would be the correct way to say it). As I'm new to this ideally I could conceptually wrap my head around what path to go down to create this interface and how to interact with the plots. It looks like so far you just create variables in the shader code and it is linked by the gloo.program() like the following.

    self.program = gloo.Program(VERT_SHADER, FRAG_SHADER)
    self.program['a_position'] = y.reshape(-1, 1)
    self.program['a_color'] = color
    self.program['a_index'] = index
    self.program['u_scale'] = (1., 1.)
    self.program['u_size'] = (nrows, ncols)
    self.program['u_n'] = n

I was a little concerned though as to how difficult it would be to add cursors or other lines to the same plot the data is on. My current task is to figure out how to get a line on the plot along with the data that I can move up and down like the horizontal one I drew in the screenshot.