<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Fast way to create  a QSurfaceDataArray from a numpy array]]></title><description><![CDATA[<p dir="auto">Is there a fast way to create a QSurfaceDataArray  from a numpy array?<br />
In the example for the <a href="https://doc.qt.io/qtforpython/examples/example_datavisualization__surface.html" target="_blank" rel="noopener noreferrer nofollow ugc">Surface example</a>, they added each point separately to the QSurfaceDataArray.<br />
This is too slow for a live view with a lot of points.<br />
In my case, the update of the 3D surface graph takes roughly 0.08s, which is acceptable. The parsing from a numpy array to a QSurfaceDataArray takes 10 times longer, which is an order too long. The problem is that I have to loop through the entire array and convert every point separately.</p>
<p dir="auto">It would be nice if there exist a vectorized parsing method. Maybe I could implement the code in C++ with the QVector3D C++ class. I never did this, and I don't know if it works, if I return a List of List s of QVector3D objects.</p>
<p dir="auto">My code that is too slow:</p>
<pre><code class="language-python">def parse_data(data: np.ndarray):
    global vector_list
    for y_index in range(data.shape[0]):
        for x_index in range(data.shape[1]):
            vector_list[y_index][x_index] = QVector3D(x_index, data[y_index, x_index], y_index)
</code></pre>
]]></description><link>https://forum.qt.io/topic/135243/fast-way-to-create-a-qsurfacedataarray-from-a-numpy-array</link><generator>RSS for Node</generator><lastBuildDate>Wed, 19 Aug 2026 10:48:32 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/135243.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 23 Mar 2022 12:43:24 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Fast way to create  a QSurfaceDataArray from a numpy array on Wed, 06 Apr 2022 11:08:46 GMT]]></title><description><![CDATA[<p dir="auto">Link to the opened suggestion report:<br />
<a href="https://bugreports.qt.io/browse/PYSIDE-1880?jql=project%20%3D%20PYSIDE%20AND%20component%20%3D%20Shiboken" target="_blank" rel="noopener noreferrer nofollow ugc">https://bugreports.qt.io/browse/PYSIDE-1880?jql=project %3D PYSIDE AND component %3D Shiboken</a></p>
]]></description><link>https://forum.qt.io/post/709271</link><guid isPermaLink="true">https://forum.qt.io/post/709271</guid><dc:creator><![CDATA[ludw]]></dc:creator><pubDate>Wed, 06 Apr 2022 11:08:46 GMT</pubDate></item><item><title><![CDATA[Reply to Fast way to create  a QSurfaceDataArray from a numpy array on Thu, 31 Mar 2022 10:18:24 GMT]]></title><description><![CDATA[<p dir="auto">As far as I know Shiboken6 (the binding generator for PySide6) does support numpy array converters enabling direct conversion from Numpy arrays to C++ sequence containers. Maybe it is actually possible to do it.</p>
<p dir="auto">Could you raise a feature suggestion for this here: <a href="https://wiki.qt.io/Qt_for_Python/Reporting_Bugs" target="_blank" rel="noopener noreferrer nofollow ugc">https://wiki.qt.io/Qt_for_Python/Reporting_Bugs</a></p>
<p dir="auto">The senior PySide6 developers would have an opinion on this.</p>
]]></description><link>https://forum.qt.io/post/708352</link><guid isPermaLink="true">https://forum.qt.io/post/708352</guid><dc:creator><![CDATA[Shyamnath]]></dc:creator><pubDate>Thu, 31 Mar 2022 10:18:24 GMT</pubDate></item></channel></rss>