sigmoid.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
A social space for people researching, working with, or just interested in AI!

Server stats:

596
active users

#numpy

3 posts3 participants0 posts today

Ugh great.

I sing mild praises of #Python documentation, but when it comes to third party libraries like #NumPy and especially #SciPy the documentation ranges from less than stellar to utterly atrocious.

And now I have a problem: scipy.optimize.fsolve() is throwing a numpy DeprecationWarning: Conversion of an array with nim > 0 to a scalar is deprecated.

The function I'm passing in to fsolve() returns a scalar!! And I'm already extracting index 0 from the return of fsolve!! WTF???

🗣️ Announcing Python-Blosc2 3.6.1

!Unlock new levels of data manipulation with Blosc2! 🚀

We've introduced a major improvement: powerful fancy indexing and orthogonal indexing for Blosc2 arrays.

We've tamed the complexity of fancy indexing to make it intuitive, efficient, and consistent with NumPy's behavior. 💪

Read all about it on our blog! 📝 blosc.org/posts/blosc2-fancy-i

Compress Better, Compute Bigger!

🚀 Great news for OpenMP on Python!

NumPy 2.3 includes early OpenMP support, making sorting operations like np.sort and np.argsort faster by using multiple processor cores — a big step for performance!

🛠️ This new feature is off by default but can be turned on during installation with -Denable_openmp=true

This marks the beginning of more parallel computing support in NumPy!

phoronix.com/news/NumPy-2.3-Re

www.phoronix.comNumPy 2.3 Introduces OpenMP Parallelization Support

If you're writing python libraries, DON'T REQUIRE fileno ON FILE OBJECTS!

Dealing w/ the bullshit that numpy.fromfile wants the fileno attribute on a file object. Yes, it's slightly faster, but it also makes it harder to mock when doing testing.

Now I'm going to have to deal w/ creating a temporary directory, writing the file, and cleaning up afterward. Things that unittest.TestCase should have an option to do, but doesn't. Luckily I've dealt w/ this BS before, so I'll just copy the code from another project.

Since I couldn't figure out how to use numpy.take, and LLMs couldn't figure out how to do what I needed to do, I read the numpy slicing chapter, and I came up with the following:
indexes = np.arange(W * H)
rgb[0, i].flat = c[0].flat[np.array(reps[i].flat) * (W * H) + indexes]

EDIT: it was broken, needed to add in the position index and simplification.

📢 We are pleased to announce the integration of a new stack feature in #Blosc2 🚀, which allows for stacking large arrays along a new axis.

Performance benchmarks show that while aligned chunks yield the best results, #Blosc2 with unaligned chunks can still outperform #NumPy—a welcome discovery! 🎉

Many thanks to Luke Shaw for his excellent work on this new functionality. 🙏

We've updated our recent blog post:
Check it out! 🔗 blosc.org/posts/blosc2-new-con

Today I was scratching my head why k-means didn't seem to reduce Mean Squared Error. The clustering seemed fine. Is the error computation broken? How can it be when it's so simple:

def compute_mse(a, b):
return np.mean((a-b)**2)

Well, arguments 'a' and 'b' were images with 8 bits per channel, so...