File:Red-noise-density-animation.gif

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Red-noise-density-animation.gif(416 × 272 pixels, file size: 149 KB, MIME type: image/gif, looped, 20 frames, 10 s)

Captions

Captions

Animation of a red noise plot with changing sampling density

Summary[edit]

Description
English: Animation of a red noise plot with changing sampling density. With increasing density, the trace converges to a thick, but limited band.
Date
Source Own work
Author Geek3
GIF development
InfoField
Created with Matplotlib-logo 
This plot was created with Matplotlib.
Source code
InfoField

Matplotlib source code

The plot was generated with Matplotlib
#! /usr/bin/env python3
# -*- coding:utf8 -*-

import matplotlib.pyplot as plt
from matplotlib import animation
import numpy as np
from math import *

plt.rcParams['font.sans-serif'] = 'DejaVu Sans'
np.random.seed(7)

fname = "Red-noise-density-animation"
nframes = 20
nsamples = 2**nframes+1
t0 = 1.
t = np.linspace(0, t0, nsamples)
randnorm = np.random.normal(0, 1, nsamples)
X = np.cumsum(randnorm / sqrt(nsamples))
X -= np.mean(X)
X /= np.std(X)

def animate(nframe):
    nframe = (nframe + 6) % nframes # start with frame 6
    plt.cla()
    dsample = 2**(nframes - nframe)
    plt.plot(t[::dsample], X[::dsample], '.-', markersize=4,
        label=f"$\Delta$t = 1/{nsamples//dsample:.0f}")
    plt.xlim(0, 1)
    plt.ylim(-3, 3)
    plt.grid(True)
    plt.xlabel('t')
    plt.ylabel('X')
    plt.legend(loc="upper center", framealpha=1)

fig = plt.figure(figsize=(520 / 90.0, 340 / 90.0), dpi=72)
plt.xlim(0, 1)
plt.ylim(-3, 3)
plt.grid(True)
plt.xlabel('t')
plt.ylabel('X')
plt.tight_layout()
anim = animation.FuncAnimation(fig, animate, frames=nframes)
anim.save(fname + '.gif', writer='imagemagick', fps=2)

Licensing[edit]

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current15:22, 6 December 2022Thumbnail for version as of 15:22, 6 December 2022416 × 272 (149 KB)Geek3 (talk | contribs)Uploaded own work with UploadWizard

There are no pages that use this file.