fosstodon.org is one of the many independent Mastodon servers you can use to participate in the fediverse.
Fosstodon is an invite only Mastodon instance that is open to those who are interested in technology; particularly free & open source software. If you wish to join, contact us for an invite.

Administered by:

Server stats:

8.8K
active users

#pyqtgraph

0 posts0 participants0 posts today

Welp. I spent WAAAAYYYYY too long computing zoomed ticks/labels on my custom #python #pyqtgraph polar plots

But at least I'm not doing a tremendously great job and the code is incomprehensible!

To be fair, I looked at some other graphing packages and none of them really worked how you'd expect in all cases.

Desmos has the same behavior as mine as 0,0 crosses over the viewable area.

Both Desmos and another only add ticks in the radial dimension past a certain point.

That seems not helpful, so I'm beating the pros! And I shoved my last remaining error in a try/except. So....done?

A while ago I created my own polar #graph (θ,r but also built az,el on top of that) inside the excellent #pyqtgraph (#python)

I also implemented a spaced tick computation similar to the one it uses. However, I didn't make it work in zoom for lack of time

I got a bug report about how the ticks/grids/labels "disappear" during zoom (i.e. stay at a larger scale while the zoom goes inside) so I thought I'd just fix that

This turns out to be non-trivial. Or at least I can't think of a simple way to do it

I was getting the xy coords of the corners of the zoombox and computing the θ,r to figure out where I was. That doesn't really work, tho. Imagine the zoom box just to the right of 0,0: θ->0,180. Now imagine it just barely containing 0,0: θ->0,360.

I think I need to measure angles from 0,0 but that means....uh....I need a whiteboard and some rubber duckies. I wish my nerd kids were awake at this hour...

#dataviz is critical, but I don't think in pictures, I think in spatial relations and movement (is this an #adhd thing?)

Movement happens in time and you usually want to viz the time axis all at once, so I've trained myself to turn "$variable vs t" into mental motion

Other times you need an interactive #ux and that usually means 3D

I love love love #pyqtgraph for #python plotting but they will be the first to tell you the 3D needs some love

My punfully-named work project has proved to be a hit[1] and I managed to get an 30y-experienced #software #developer *with an #astronomy degree* assigned to it. (This is a #space application)

She agreed that the 3D portion was neat but hard to use. She found #vtk, which seems to be the perfect partner because it does 3D really well, stays out of 2D and has a #pyqt connector.

I just worked through a tutorial and, yeah, this could be a huge breakthrough in my viz apps.

[1]They think they want to change the pun name but they are wrong. An unforgettable name is money in the bank.

Replied in thread

@glob_god FWIW the next release is having some major performance improvements on 3D plots (one of the regular contributors took it upon himself to learn some OpenGL and made the library much better for it).

#PyQtGraph definitely seems to have a niche in the experimental science/engineering fields for sure.

How did you come across the library to begin with?

I've been working on a #space #visualization tool for our operators. It basically needs to always know, and be ready to plot, where every single one of 60k+ objects is down to millidegree/meter/second resolution just in case the sensor suddenly slews there

My own constraint is that it has to be 1) a single 2) #python executable because otherwise I'm not interested

Earlier this year, I found a great 30x faster technique for determining which #satellites are above the horizon. (In fact, it's far more general than that, but that's all the help it gives me to this problem.)

I also realized I could spawn a #multiprocessing child to do lookahead on data and then pass a huge #numpy array to my graphing process. (Investigated ~9 different ways, chose the best)

But there I was stuck.

At any given moment, there are ~4500 space objects above the horizon (at our latitude). Putting 4500 points with little persistence trails and labels and then updating all that at 1Hz let alone the 10Hz I'd like was taking too long, even using the amazing #pyqtgraph

So there I was stuck. Until this week.

Replied in thread

@mcc I maintain #PyQtGraph ; and I can’t tell you how many issues I identify if I try and pretend like I am a complete newcomer, don’t look at past examples but look at the docs and try and plow forward.

We have recently merged into the repo a new on of related improvements, mostly for 3D, but PColorMeshItem got some love too. If you use for 3D visualization, we’d love to hear back from you.

Every time I update the sphinx theme for #PyQtGraph I get a different CSS coloring issue.

For the record, I'm throwing no shade at the theme maintainers, it's not their fault that I'm probably modifying the underlying CSS in a way that is so bizarre that nobody that has any resemblance of knowing what they're doing would do 😂

#genuary

Layers upon layers upon layers.

I still like the basic idea here, but I couldn't make it work on multiple levels (how ironic).

I spent several hours trying to understand how color compositing works in general and in #qt in particular. I kind of got something fragile sort-of working.

When I gave up on Making It Perfect, I realized that looping a blizzard is unlikely to work.

Welp. This is a #learning #python #pyqtgraph project anyway and that goal was accomplished.

Replied to dr 🛠️🛰️📡🎧:blobfoxcomputer:

@davidr FYI #PyQtGraph has an issue with thick lines (>1px) and partial alpha. If the QPen instance has partial alpha, we can't use our fast "drawLines" codepath, and are stuck with "drawPath”, which performs _terribly_ with >1px lines. If you're plotting static plots, you may not notice, but if you're doing anything that updates frequently, you're likely to have problems.

So. I want to #pyqtgraph plot some colored items with medium alphas and then overlap them to produce the usual kindergarten color wheel results.

But it turns out that #pyqt only supports compositing in the RGB #color space.

In fact, the Wikipedia article makes it sound like alpha blending is only even *defined* for RGB. Which I guess makes sense for speed reasons, but I'd still expect some way to put in a callback or whatever for a custom mode.

I guess what I'll do it do all the HSV and compositing work in a #python #numpy array and the convert to an RGB image and display it that way...?

Unless there's a better idea?

Continued thread

ooooookaaaayyyyy!!!

Got the ticks #python #code working for "numbers" and "angles" (where the difference is what constitutes a "nice" value)

Just now made a #pyqtgraph with 4 subplots. Two default axes, two custom axes using "my" #algorithm for tick generation, one for "numbers" and one for "angles".

Very, very reasonable behavior! (bottom row is custom ticks) (I know radians are still technically angles, but that's not the point)(I just realized I should have called that feature "degrees" not "angles")

One potential upgrade is to compute something for minor ticks. How do I....oh, those are probably the next lower mantissa! Except for snow removal I have nothing else to do today, so....

Replied in thread

@villares if you’re wanting live plot updates that’s sort of #PyQtGraph ‘s thing. I will freely admit that pyqtgraph does not have the plotting customization that matplotlib does but it’s very straight forward to integrate into a Qt application.

Continued thread

W H E W i finally did it

- created my own polar graph in #pyqtgraph

- created a subclass that maps azimuth to theta (easy) and elevation to R (not hard, but not necessarily obvious for stereographic projection)

- used that to re-implement the faulty graph I made like....6 years ago? also had to find and rewrite a bunch of code to use a great-circle distance from a point rather than azimuth/elevation ranges #python #space #math

The original toot in this chain is from 1/3, so that's exactly two weeks of A B S O L U T E P A N I C on my part

I mean, it was my bug. And it's kind of a dumb bug. And it has been keeping me from my regular #coding and also from doing a good job as a #mentor for the super-fresh new-hire

But it's really #adhd #rsd perfectionism/terror that drove me for these two weeks. I could barely think straight. I should probably note this at my adhd evaluation on 1/30.