remi-adam / pitszi

BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

NaN problem #1

Closed TomEynard closed 5 months ago

TomEynard commented 5 months ago

inference_main.get_p3d_to_p2d_from_window_function line 1180: The compton3d has zeros. the following line divides by compton3d which yields NaN values: W3d = (cst.sigma_T / (cst.m_e * cst.c*2) pressure3d_sph / compton3d).to_value('kpc-1')

remi-adam commented 5 months ago

This affects the Pk3d to Pk2d conversion in the case the cluster is undefined within the map (e.g. small R_truncation). But NaNs are expceted because N_theta is undefined in this case.

The correction is done in pk_setup (np.sum --> np.nansum): self._conv_pk2d3d = (np.nansum(ymap_wf*self.method_w82)/np.nansum(self.method_w82)).to_value('kpc-1')

When computing dy/y, the map is also set to 0 where y ==0, as an extra security, but this is not a bug: the mask/weight should be defined in an appropriate way by the user since delta y / y x W can explode if y-->0