<p dir="auto">This is not really bugging me, but just would like to know if there is anything wrong with the code (I am on Ubuntu 18.04 if that helps).</p>
<h4 dir="auto">Reproducing code example (<code class="notranslate">test.py</code>):</h4>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import numpy as np
from scipy.interpolate import LSQBivariateSpline

# generate data
x, y = np.meshgrid(
    np.linspace(0, 10, 30),
    np.linspace(0, 5, 40)
)
x = x.flatten()
y = y.flatten()
z = np.exp(-(x-5)**2/4) + np.exp(-(y-2)**2/3)

# define the knot positions
tx = [1, 2, 4, 5, 6, 8, 9]
ty = [0.2, 0.8, 1.1, 1.8, 2.5, 3, 3.7, 4.2, 4.9]

# get spline fit
s = LSQBivariateSpline(x, y, z, tx, ty, kx=3, ky=3)

# new evaluation
x2, y2 = np.meshgrid(
    np.linspace(0, 10, 50),
    np.linspace(0, 5, 60)
)
z_new = s(x2, y2, grid=False)"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>
<span class="pl-k">from</span> <span class="pl-s1">scipy</span>.<span class="pl-s1">interpolate</span> <span class="pl-k">import</span> <span class="pl-v">LSQBivariateSpline</span>

<span class="pl-c"># generate data</span>
<span class="pl-s1">x</span>, <span class="pl-s1">y</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">meshgrid</span>(
    <span class="pl-s1">np</span>.<span class="pl-en">linspace</span>(<span class="pl-c1">0</span>, <span class="pl-c1">10</span>, <span class="pl-c1">30</span>),
    <span class="pl-s1">np</span>.<span class="pl-en">linspace</span>(<span class="pl-c1">0</span>, <span class="pl-c1">5</span>, <span class="pl-c1">40</span>)
)
<span class="pl-s1">x</span> <span class="pl-c1">=</span> <span class="pl-s1">x</span>.<span class="pl-en">flatten</span>()
<span class="pl-s1">y</span> <span class="pl-c1">=</span> <span class="pl-s1">y</span>.<span class="pl-en">flatten</span>()
<span class="pl-s1">z</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">exp</span>(<span class="pl-c1">-</span>(<span class="pl-s1">x</span><span class="pl-c1">-</span><span class="pl-c1">5</span>)<span class="pl-c1">**</span><span class="pl-c1">2</span><span class="pl-c1">/</span><span class="pl-c1">4</span>) <span class="pl-c1">+</span> <span class="pl-s1">np</span>.<span class="pl-en">exp</span>(<span class="pl-c1">-</span>(<span class="pl-s1">y</span><span class="pl-c1">-</span><span class="pl-c1">2</span>)<span class="pl-c1">**</span><span class="pl-c1">2</span><span class="pl-c1">/</span><span class="pl-c1">3</span>)

<span class="pl-c"># define the knot positions</span>
<span class="pl-s1">tx</span> <span class="pl-c1">=</span> [<span class="pl-c1">1</span>, <span class="pl-c1">2</span>, <span class="pl-c1">4</span>, <span class="pl-c1">5</span>, <span class="pl-c1">6</span>, <span class="pl-c1">8</span>, <span class="pl-c1">9</span>]
<span class="pl-s1">ty</span> <span class="pl-c1">=</span> [<span class="pl-c1">0.2</span>, <span class="pl-c1">0.8</span>, <span class="pl-c1">1.1</span>, <span class="pl-c1">1.8</span>, <span class="pl-c1">2.5</span>, <span class="pl-c1">3</span>, <span class="pl-c1">3.7</span>, <span class="pl-c1">4.2</span>, <span class="pl-c1">4.9</span>]

<span class="pl-c"># get spline fit</span>
<span class="pl-s1">s</span> <span class="pl-c1">=</span> <span class="pl-v">LSQBivariateSpline</span>(<span class="pl-s1">x</span>, <span class="pl-s1">y</span>, <span class="pl-s1">z</span>, <span class="pl-s1">tx</span>, <span class="pl-s1">ty</span>, <span class="pl-s1">kx</span><span class="pl-c1">=</span><span class="pl-c1">3</span>, <span class="pl-s1">ky</span><span class="pl-c1">=</span><span class="pl-c1">3</span>)

<span class="pl-c"># new evaluation</span>
<span class="pl-s1">x2</span>, <span class="pl-s1">y2</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">meshgrid</span>(
    <span class="pl-s1">np</span>.<span class="pl-en">linspace</span>(<span class="pl-c1">0</span>, <span class="pl-c1">10</span>, <span class="pl-c1">50</span>),
    <span class="pl-s1">np</span>.<span class="pl-en">linspace</span>(<span class="pl-c1">0</span>, <span class="pl-c1">5</span>, <span class="pl-c1">60</span>)
)
<span class="pl-s1">z_new</span> <span class="pl-c1">=</span> <span class="pl-en">s</span>(<span class="pl-s1">x2</span>, <span class="pl-s1">y2</span>, <span class="pl-s1">grid</span><span class="pl-c1">=</span><span class="pl-c1">False</span>)</pre></div>
<h4 dir="auto">Error message:</h4>

<p dir="auto">Run code in terminal as <code class="notranslate">python -i test.py</code>, with the following error bumps out before quitting Python terminal:</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="python -i tmp.py 
&gt;&gt;&gt; 
corrupted size vs. prev_size
Aborted (core dumped)"><pre class="notranslate">python -i tmp.py 
&gt;&gt;&gt; 
corrupted size vs. prev_size
Aborted (core dumped)</pre></div>
<p dir="auto">or</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="python tmp.py 
Segmentation fault (core dumped)"><pre class="notranslate">python tmp.py 
Segmentation fault (core dumped)</pre></div>
<p dir="auto">This error message shows up randomly, roughly 1 out of 5 trials will trigger the error.</p>
<h4 dir="auto">Scipy/Numpy/Python version information:</h4>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="1.6.0 1.19.4 sys.version_info(major=3, minor=8, micro=0, releaselevel='final', serial=0)"><pre class="notranslate"><span class="pl-c1">1.6</span>.<span class="pl-c1">0</span> <span class="pl-c1">1.19</span>.<span class="pl-c1">4</span> <span class="pl-s1">sys</span>.<span class="pl-en">version_info</span>(<span class="pl-s1">major</span><span class="pl-c1">=</span><span class="pl-c1">3</span>, <span class="pl-s1">minor</span><span class="pl-c1">=</span><span class="pl-c1">8</span>, <span class="pl-s1">micro</span><span class="pl-c1">=</span><span class="pl-c1">0</span>, <span class="pl-s1">releaselevel</span><span class="pl-c1">=</span><span class="pl-s">'final'</span>, <span class="pl-s1">serial</span><span class="pl-c1">=</span><span class="pl-c1">0</span>)</pre></div>
<p dir="auto"><em>Original ticket <a href="http://projects.scipy.org/scipy/ticket/133" rel="nofollow">http://projects.scipy.org/scipy/ticket/133</a> on 2006-04-02 by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/rkern/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/rkern">@rkern</a>, assigned to <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/rkern/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/rkern">@rkern</a>.</em></p>
<p dir="auto">The function <code class="notranslate">f_value</code> in file source:trunk/Lib/stats/stats.py needs review.</p>
<p dir="auto">Please look over the StatisticsReview guidelines and add your comments below.</p>