[Python] Making a random grid that doesn't vary 'too much'

Discussão em 'Python' iniciado por Stack, Junho 30, 2025.

  1. Stack

    Stack Membro Participativo

    I'm making a meshgrid to represent background radiation levels, but I'd like it to be less noisy. My implementation is trivial, I've plotted

    import numpy as np

    x = np.linspace(-2, 2, 100)
    y = np.linspace(-2, 2, 100)
    X, Y = np.meshgrid(x, y)
    Z = np.random.rand(100,100)


    here's a picture

    I'd like each pixel to not deviate too much from those around it, while at the same time having sufficient global variation. My initial thought is to make a coarser grid, and use those values as reference values to build a finer grid, but I'm not sure how I'd implement this or if there's a better approach.

    Continue reading...

Compartilhe esta Página