Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2D colored noise? #7

Open
yxiao1996 opened this issue Mar 11, 2022 · 7 comments
Open

2D colored noise? #7

yxiao1996 opened this issue Mar 11, 2022 · 7 comments

Comments

@yxiao1996
Copy link

Hello there,

First of all thanks for the amazing library. I have a usecase where I need 2D colored noise. I suspect that simply generating a long array and resize it into a 2D matrix is not what I want as the power spectra on the second axis may not be correct. Curious if you have any suggestion on this?

Thanks a lot,
Yu

@felixpatzelt
Copy link
Owner

Hi @yxiao1996,

thank you for the interesting question! Sorry it took me so long to answer, I am quite busy ATM and I wanted to look into this case a bit before answering since I never needed it myself.

@yxiao1996
Copy link
Author

Hi Felix, thanks a lot! I will test it.

@felixpatzelt
Copy link
Owner

Thanks for the response.

I have looked into it a bit more and improved some limitations of the prototype. However, I also found a bug that isn't fixed yet: In the 1-d case, the real valued fft is used, which is faster. The rfft2 and rfftn functions of numpy, however, only do the real valued fft over the last dimension and the complex one over the others. Therefore we have to choose the size of the random amplitudes and phases that are generated accordingly. I.e. I believe that we need to generate values for twice as many frequencies but the spectrum will be symmetrical since we want a real output. This stuff is currently not my day-to-day work anymore so I have to do it carefully :)

I am unfortunately unable to work on this for the next three weeks but I would be interested to finish a 2d generator as a library feature in mid to late April.

Feel free to post some updates or to create your own prototype or a PR and share it here, I will look at it as soon as I have time.

@man-shu
Copy link

man-shu commented Jan 26, 2023

Hello! I have somehow stumbled upon the same question of generating pink noise 2d images. Have there been any updates so far?

EDIT: removed the StackOverflow question since it's already been referenced in the ipython notebook above

@felixpatzelt
Copy link
Owner

Hi @man-shu, I didn't hear back anything last year and so I wasn't sure that there is much interest in the feature. I could have another look as I remember it being almost done.

@man-shu
Copy link

man-shu commented Jan 30, 2023

Yes, please! If you have some time...

@DennisDannecker
Copy link

Did anything came up since then. I am also looking for 2D coloured noise generator.
I believe there is an implementation in matlab, but I would of course prefer an implementation in python.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants