def calc_electron_density(self): """ Deproject the surface brightness profile to derive the 3D electron number density (and then gas mass density) profile by incorporating the cooling function profile. unit: [ cm^-3 ] if the units converted for input data """ if self.s_spline is None: self.fit_spline(spline="brightness", log10=["x", "y"]) if self.cf_spline is None: self.fit_spline(spline="cooling_function", log10=[]) # s_new = self.eval_spline(spline="brightness", x=self.r) cf_new = self.eval_spline(spline="cooling_function", x=self.r) # projector = Projection(rout=self.r + self.r_err) s_deproj = projector.deproject(s_new) # emission measure per unit volume em_v = s_deproj / cf_new ne = np.sqrt(em_v * AstroParams.ratio_ne_np) self.ne = ne return ne