-
Notifications
You must be signed in to change notification settings - Fork 19
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
get_map() method of orphics.maps.MapGen class is broken #25
Comments
Facing same issue. Can I request you to part of the code that you modified to resolve this issue? or it is related to numpy version. Tried with tensorflow routine. Could not resolve |
@debuadakiitk I am still using orphics but have not kept up with the latest versions, so hopefully my fix still works. To fix the issue I changed the get_map() function of the MapGen class in maps.py to: def get_map(self,seed=None,scalar=False,iau=False,real=False,harm=False):
if seed is not None: np.random.seed(seed)
rand = enmap.fft(enmap.rand_gauss(self.shape, self.wcs)) if real else enmap.rand_gauss_harm(self.shape, self.wcs)
# Changes begin here
if rand.ndim == 2:
rand = np.expand_dims(rand, axis=0)
data = (enmap.map_mul(self.covsqrt, rand))[0]
else:
data = enmap.map_mul(self.covsqrt, rand)
# Changes end here
kmap = enmap.ndmap(data, self.wcs)
if harm:
return kmap
else:
if scalar:
return enmap.ifft(kmap).real
else:
return enmap.harm2map(kmap,iau=iau) If I remember correctly, just modifying the axes of the array fixes the issue with the numpy.einsum() in pixell. I can't quite remember if I made any other changes anywhere else in the code, but I think that was all I did. Ill check later today if just making these few changes fixes the current version of orphics as well. |
Thanks a lot. If you find some other modifications, kindly let me know. It
would be helpful for me.
thanks,
Debabrata
…On Tue, Nov 8, 2022 at 10:55 PM EEmGuzman ***@***.***> wrote:
@debuadakiitk <https://github.com/debuadakiitk> I am still using orphics
but have not kept up with the latest versions, so hopefully my fix still
works.
To fix the issue I changed the get_map() function of the MapGen class in
maps.py to:
def get_map(self,seed=None,scalar=False,iau=False,real=False,harm=False):
if seed is not None: np.random.seed(seed)
rand = enmap.fft(enmap.rand_gauss(self.shape, self.wcs)) if real else enmap.rand_gauss_harm(self.shape, self.wcs)
# Changes begin here
if rand.ndim == 2:
rand = np.expand_dims(rand, axis=0)
data = (enmap.map_mul(self.covsqrt, rand))[0]
else:
data = enmap.map_mul(self.covsqrt, rand)
# Changes end here
kmap = enmap.ndmap(data, self.wcs)
if harm:
return kmap
else:
if scalar:
return enmap.ifft(kmap).real
else:
return enmap.harm2map(kmap,iau=iau)
If I remember correctly, just modifying the axes of the array fixes the
issue with the numpy.einsum() in pixell. I can't quite remember if I made
any other changes anywhere else in the code, but I think that was all I
did. Ill check later today if just making these few changes fixes the
current version of orphics as well.
—
Reply to this email directly, view it on GitHub
<#25 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A4CNW34VRVAMXB6XKLLGGSTWHKEHBANCNFSM4W6LDRFA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Hi Mat,
The get_map() method in the orphics.maps.MapGen class is broken when using Pixell Version 0.10.3.
Running the command:
unlensed,kappa,lensed,beamed,noise_map,observed = flsims.get_sim(return_intermediate=True)
Results in an error of:
I printed the dimensions of what was being multiplied when it failed:
covsqrt shape (1, 1, 128, 128)
rand shape (128, 128)
Expanding the dimension of the rand variable in the get_map() method when rand.ndim==2 then reducing the dimension again after the multiplication fixed the issue on my end, so I assume the problem is isolated to the case of rand.ndim==2.
The text was updated successfully, but these errors were encountered: