File:White-noise-zoom-animation.gif

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

White-noise-zoom-animation.gif(416 × 272 pixels, file size: 1.12 MB, MIME type: image/gif, looped, 40 frames, 2.0 s)

Captions

Captions

Animation of infinite zoom into Gaussian white noise

Summary

[edit]
Description
English: Animation of a white noise plot with continuous zoom towards zero. The signal is self-similar, so the basic properties remain constant during the zoom. The animation repeats at a scaling factor of 2. The plot uses a finite number of sampling points, which are continuously added during the zoom, to keep the density constant.
Date
Source Own work
Author Geek3
GIF development
InfoField
 
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 ticker
from matplotlib import animation
import numpy as np
from math import *

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

fname = "White-noise-zoom-animation"
nframes = 40
fx = 0.5
nsamples = int(320 / fx)

# create pseudo-random sequence for continous adding of time points
golden = (sqrt(5) - 1) / 2
t_unsorted = (golden * np.arange(nsamples)) % 1
sort_idx = np.argsort(t_unsorted)
t = t_unsorted[sort_idx]
randnorm = np.random.normal(0, 1, nsamples)
X = randnorm

# use self-similar signal for small t-values
mask0 = sort_idx < nsamples * fx**(1 - 1 / nframes)
t0, X0 = t[mask0], X[mask0]
for i in range(int(fx * nsamples) - 1, 0, -1):
    tfx = t[i] / fx
    i2 = np.searchsorted(t0, tfx)
    i1 = i2 - 1
    if tfx - t0[i1] < t0[i2] - tfx:
        X2 = X0[i1]
    else:
        X2 = X0[i2]
    X[i] = X2
    X0 = X[mask0] # update masked X0 from X (a bit inefficient)

ylim = -2.5, 2.5
def animate(nframe):
    plt.cla()
    xscale = fx**(nframe / nframes)
    mask = sort_idx < nsamples * fx / xscale
    plt.plot(t[mask], X[mask], '-')
    plt.xlim(0, xscale)
    plt.ylim(ylim[0], ylim[1])
    plt.grid(True)
    plt.xlabel('t')
    plt.ylabel('X')
    plt.gca().axes.xaxis.set_ticklabels([])
    plt.gca().axes.yaxis.set_ticklabels([])
    

fig = plt.figure(figsize=(520 / 90.0, 340 / 90.0), dpi=72)
plt.xlim(0, 1)
plt.ylim(ylim[0], ylim[1])
plt.grid(True)
plt.xlabel('t')
plt.ylabel('X')
plt.gca().axes.xaxis.set_ticklabels([])
plt.gca().axes.yaxis.set_ticklabels([])
plt.tight_layout()
anim = animation.FuncAnimation(fig, animate, frames=nframes)
anim.save(fname + '.gif', writer='imagemagick', fps=20)

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
current16:08, 10 December 2022Thumbnail for version as of 16:08, 10 December 2022416 × 272 (1.12 MB)Geek3 (talk | contribs)Uploaded own work with UploadWizard

There are no pages that use this file.