-
Notifications
You must be signed in to change notification settings - Fork 8
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
053118 minor update #16
base: master
Are you sure you want to change the base?
Conversation
Could we merge this in? I have been doing hack workarounds for this since forever. |
These are two different kind of interpolations. I almost exclusively use interp1d with linear interpolation when dealing with Cls, but I wonder if there was a reason why spline was used in flipper. Maybe @blakesherwin or @amaurea can also comment before we merge? |
The problems usually happen when you have a power spectrum that falls abruptly to zero (due to some lmax being put in by hand). The cubic splines overshoot the zero (because they want to stay continuous), meaning they dip below zero. Then when you have a 2d power spectrum with at least one negative 2d Fourier pixel, the map you get out is filled with NaNs.
I agree that we should hesitate before changing code that gives a quantitatively different result. My guess is that this is due to Sudeep or Toby.
Alex
… On Sep 14, 2018, at 11:22 AM, Mathew S. Madhavacheril ***@***.***> wrote:
These are two different kind of interpolations. I almost exclusively use interp1d with linear interpolation when dealing with Cls, but I wonder if there was a reason why spline was used in flipper. Maybe @blakesherwin <https://github.com/blakesherwin> or @amaurea <https://github.com/amaurea> can also comment before we merge?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#16 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/APAXHCGUsO6YNB-_IupNwaMUw-4Fjs-5ks5ua8mfgaJpZM4UVolu>.
|
Yep, I understand the problem and have encountered it myself too. (I think I used to do something like set all negative power values to zero, which isn't a great solution.) I just wanted to raise the question of why spline interpolation specifically at cubic order was used to begin with. And should perhaps the order of interpolation in interp1d be higher? In some sense, for flat-sky testing, if sims are generated with order X interpolation and compared to theory with order X interpolation, you'll never see a difference. I'm not sure there is a good test for what interpolation is "correct" since this is intimately tied to wrongness of flat-sky Cls. |
Agreed
… On Sep 14, 2018, at 11:47 AM, Mathew S. Madhavacheril ***@***.***> wrote:
Yep, I understand the problem and have encountered it myself too. (I think I used to do something like set all negative power values to zero, which isn't a great solution.) I just wanted to raise the question of why spline interpolation specifically at cubic order was used to begin with. And should perhaps the order of interpolation in interp1d be higher?
In some sense, for flat-sky testing, if sims are generated with order X interpolation and compared to theory with order X interpolation, you'll never see a difference. I'm not sure there is a good test for what interpolation is "correct" since this is intimately tied to wrongness of flat-sky Cls.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#16 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/APAXHCxQOlNGehpfxKfVRodsQoauddyzks5ua896gaJpZM4UVolu>.
|
fillWithGaussianRandomField() fails sometimes because scipy spline interpolation routines (splrep,splev) can return superfluous negative values (it's not clear why this is the case.) I swapped them with scipy interp1d which seem to be more stable.