ledatelescope / bifrost

A stream processing framework for high-throughput applications.
BSD 3-Clause "New" or "Revised" License
64 stars 29 forks source link

Create ndarray from BFarray ctypes struct #190

Closed telegraphic closed 1 year ago

telegraphic commented 1 year ago

This allows a bifrost ndarray to be instantiated from a BFarray struct (as returned by ndarray.as_BFarray())

Minimal example:

        a = bifrost.ndarray(np.arange(100), dtype='i32')
        aa = a.as_BFarray()
        b = bifrost.ndarray(aa)
        np.testing.assert_equal(a, b)
telegraphic commented 1 year ago

(PS: Apologies, meant to push this to my telegraphic fork and then open PR request)