<p dir="auto">I'm trying to parametrize mlab tests (which cuts out many many lines of classes), but there are a few differences between similar tests which makes it really difficult to parametrize things (e.g., real vs. complex). Here are some differences:</p>
<ul dir="auto">
<li>Between real and complex:
<ul dir="auto">
<li><code class="notranslate">len_x</code> differs in:
<ul dir="auto">
<li><code class="notranslate">nosig_defaultsided_trim</code> (1024 vs 256)</li>
</ul>
</li>
<li><code class="notranslate">NFFT_density</code> differs in:
<ul dir="auto">
<li><code class="notranslate">nosig_*_defaultsided_nopad_to</code> (-1 vs None)</li>
<li><code class="notranslate">nosig_*_defaultsided_oddlen</code> (33 vs 128)</li>
<li><code class="notranslate">nosig_*_defaultsided_trim</code> (512 vs 128)</li>
<li><code class="notranslate">nosig_*_twosided_nopad_to</code> (-1 vs None)</li>
</ul>
</li>
</ul>
</li>
<li>Between onesided and twosided:
<ul dir="auto">
<li><code class="notranslate">NFFT_density</code> differs in:
<ul dir="auto">
<li><code class="notranslate">nosig_complex_*_nopad_to</code> (-1 vs None)</li>
</ul>
</li>
</ul>
</li>
<li>Between onesided/twosided and defaultsided:
<ul dir="auto">
<li><code class="notranslate">len_x</code> differs in:
<ul dir="auto">
<li><code class="notranslate">nosig_complex_*_trim</code> (1024 vs 256)</li>
</ul>
</li>
<li><code class="notranslate">NFFT_density</code> differs in:
<ul dir="auto">
<li><code class="notranslate">nosig_complex_*_nopad_to</code> (-1 vs None)</li>
<li><code class="notranslate">nosig_complex_*_oddlen</code> (33 vs 128)</li>
<li><code class="notranslate">nosig_complex_*_trim</code> (512 vs 128)</li>
</ul>
</li>
</ul>
</li>
</ul>
<p dir="auto">Does anyone know why these differ in this way? @vollbier?<br>
Can I replace some of the values by the others (and which by which?)</p>
<h3 dir="auto">Bug summary</h3>
<p dir="auto">THIS IS NOT A POST FOR COMMUNITY HELP.</p>
<p dir="auto">THIS IS A BUG REPORT.</p>
<p dir="auto">PLEASE DO NOT CLOSE BEFORE REPLICATION.</p>
<h3 dir="auto">Code for reproduction</h3>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="%matplotlib ipympl

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import time

fig, ax = plt.subplots()

XX=[1,2,3]
YY=[2,4,6]
line, = ax.plot(XX,YY)

ax.set_xlim(-2,100)
ax.set_ylim(-2,100)

num=0

def init():
    line.set_ydata(YY)
    line.set_xdata(XX)
    return line,

def animate(i):
    ii=0
    while ii!=3:
        XX[ii]+=1
        ii+=1

    '''for ii in XX:
        ii+=1'''
    line.set_ydata(YY)
    line.set_xdata(XX)
    return line,

ani = animation.FuncAnimation(
    fig, animate,init_func=init,interval=50, blit=True, save_count=50) #interval is millisecond

plt.show()"><pre class="notranslate"><span class="pl-c1">%</span><span class="pl-s1">matplotlib</span> <span class="pl-s1">ipympl</span>

<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">import</span> <span class="pl-s1">matplotlib</span>.<span class="pl-s1">pyplot</span> <span class="pl-k">as</span> <span class="pl-s1">plt</span>
<span class="pl-k">import</span> <span class="pl-s1">matplotlib</span>.<span class="pl-s1">animation</span> <span class="pl-k">as</span> <span class="pl-s1">animation</span>
<span class="pl-k">import</span> <span class="pl-s1">time</span>

<span class="pl-s1">fig</span>, <span class="pl-s1">ax</span> <span class="pl-c1">=</span> <span class="pl-s1">plt</span>.<span class="pl-en">subplots</span>()

<span class="pl-v">XX</span><span class="pl-c1">=</span>[<span class="pl-c1">1</span>,<span class="pl-c1">2</span>,<span class="pl-c1">3</span>]
<span class="pl-v">YY</span><span class="pl-c1">=</span>[<span class="pl-c1">2</span>,<span class="pl-c1">4</span>,<span class="pl-c1">6</span>]
<span class="pl-s1">line</span>, <span class="pl-c1">=</span> <span class="pl-s1">ax</span>.<span class="pl-en">plot</span>(<span class="pl-v">XX</span>,<span class="pl-v">YY</span>)

<span class="pl-s1">ax</span>.<span class="pl-en">set_xlim</span>(<span class="pl-c1">-</span><span class="pl-c1">2</span>,<span class="pl-c1">100</span>)
<span class="pl-s1">ax</span>.<span class="pl-en">set_ylim</span>(<span class="pl-c1">-</span><span class="pl-c1">2</span>,<span class="pl-c1">100</span>)

<span class="pl-s1">num</span><span class="pl-c1">=</span><span class="pl-c1">0</span>

<span class="pl-k">def</span> <span class="pl-en">init</span>():
    <span class="pl-s1">line</span>.<span class="pl-en">set_ydata</span>(<span class="pl-v">YY</span>)
    <span class="pl-s1">line</span>.<span class="pl-en">set_xdata</span>(<span class="pl-v">XX</span>)
    <span class="pl-k">return</span> <span class="pl-s1">line</span>,

<span class="pl-k">def</span> <span class="pl-en">animate</span>(<span class="pl-s1">i</span>):
    <span class="pl-s1">ii</span><span class="pl-c1">=</span><span class="pl-c1">0</span>
    <span class="pl-k">while</span> <span class="pl-s1">ii</span><span class="pl-c1">!=</span><span class="pl-c1">3</span>:
        <span class="pl-v">XX</span>[<span class="pl-s1">ii</span>]<span class="pl-c1">+=</span><span class="pl-c1">1</span>
        <span class="pl-s1">ii</span><span class="pl-c1">+=</span><span class="pl-c1">1</span>

    <span class="pl-s">'''for ii in XX:</span>
<span class="pl-s">        ii+=1'''</span>
    <span class="pl-s1">line</span>.<span class="pl-en">set_ydata</span>(<span class="pl-v">YY</span>)
    <span class="pl-s1">line</span>.<span class="pl-en">set_xdata</span>(<span class="pl-v">XX</span>)
    <span class="pl-k">return</span> <span class="pl-s1">line</span>,

<span class="pl-s1">ani</span> <span class="pl-c1">=</span> <span class="pl-s1">animation</span>.<span class="pl-v">FuncAnimation</span>(
    <span class="pl-s1">fig</span>, <span class="pl-s1">animate</span>,<span class="pl-s1">init_func</span><span class="pl-c1">=</span><span class="pl-s1">init</span>,<span class="pl-s1">interval</span><span class="pl-c1">=</span><span class="pl-c1">50</span>, <span class="pl-s1">blit</span><span class="pl-c1">=</span><span class="pl-c1">True</span>, <span class="pl-s1">save_count</span><span class="pl-c1">=</span><span class="pl-c1">50</span>) <span class="pl-c">#interval is millisecond</span>

<span class="pl-s1">plt</span>.<span class="pl-en">show</span>()</pre></div>
<h3 dir="auto">Actual outcome</h3>
<p dir="auto">the pic do not move.</p>
<h3 dir="auto">Expected outcome</h3>
<p dir="auto">the pic should move.</p>
<h3 dir="auto">Additional information</h3>
<p dir="auto">use while instead of for can solve this problem.</p>
<h3 dir="auto">Operating system</h3>
<p dir="auto">windows 10</p>
<h3 dir="auto">Matplotlib Version</h3>
<p dir="auto">3.5.1</p>
<h3 dir="auto">Matplotlib Backend</h3>
<p dir="auto">ipympl</p>
<h3 dir="auto">Python version</h3>
<p dir="auto">3.8.1</p>
<h3 dir="auto">Jupyter version</h3>
<p dir="auto">3.0.16</p>
<h3 dir="auto">Installation</h3>
<p dir="auto">pip</p>