def Psyn_iso(self, gamma, B): '''Total synchrotron radiated power for an isotropic distribution of velocities. Formula given in Rybicki & Lightman (1985), eq. (6.7b): P = (4 / 3) sigma_T c beta^2 gamma^2 (B^2 / 8 pi) ''' return 4.0 * C.sigmaT * C.cLight * SR.speed2( gamma) * gamma**2 * B**2 / (24.0 * np.pi)
def integrando_s(self, ll, l0, tt, It): te = self.Dopp * ((tt / (1.0 + self.z)) + (self.Gbulk * ll * l0 * (self.mu - SR.speed(self.Gbulk)))) # te = tt - ll * l0 if te < 0.0: res = 0.0 else: res = self.pwl_interp(te, self.t_em, It) * (ll - ll**2) return res
def Itobs(t, nu, jnut, sen_lum, R, muc, Gbulk, muo, z, D): pwl = pwlf.PwlInteg() Itobs = np.zeros_like(jnut) i_edge = np.argmin(np.abs(2.0 * R * muc - sen_lum)) if (sen_lum[i_edge] > 2.0 * R * muc): i_edge = i_edge - 1 for j in range(nu.size): for i in range(t.size): if (i <= i_edge): i_start = 0 else: i_start = i - i_edge for ii in range(i_start, i): tob_min = srtool.t_com(t[i], z, Gbulk, muo, x=t[ii - 1] * C.cLight * muc) tob_max = srtool.t_com(t[i], z, Gbulk, muo, x=t[ii] * C.cLight * muc) if ii == 0: Itobs[i, j] = np.abs(tob_max - tob_min) * jnut[0, j] else: if (jnut[ii, j] > 1e-100) & (jnut[ii - 1, j] > 1e-100): sind = -np.log(jnut[ii, j] / jnut[ii - 1, j]) / np.log( tob_max / tob_min) if (sind < -8.0): sind = -8.0 if (sind > 8.0): sind = 8.0 Itobs[i, j] = Itobs[ i, j] + jnut[ii - 1, j] * tob_min * pwl.P( tob_max / tob_min, sind, 1e-6) / (Gbulk * muc * (muo - srtool.speed(Gbulk)) * D) return Itobs
def build_avSpec(t_min, t_max, dset='Inut', only_load=True, inJanskys=False, **kwargs): run = runSSCC(**kwargs) if not only_load: run.cleanup() run.compile() run.runNewSSCC() D = SR.Doppler(run.par.gamma_bulk, run.par.theta_obs) nu = extr.hdf5Extract1D(run.outfile, 'frequency') t = extr.hdf5Extract1D(run.outfile, 'time') nu_obs = SR.nu_obs(nu, run.par.z, run.par.gamma_bulk, run.par.theta_obs) t_obs = SR.t_obs(t, run.par.z, run.par.gamma_bulk, view_angle=run.par.theta_obs) Inu = extr.hdf5Extract2D(run.outfile, dset) Fnu = spec.flux_dens(Inu, run.par.dLum, run.par.z, D, run.par.R) sp = spec.spectrum() if inJanskys: return nu_obs, spec.conv2Jy(sp.averaged(t_min, t_max, run.par.numdf, t_obs, Fnu)) else: return nu_obs, sp.averaged(t_min, t_max, run.par.numdf, t_obs, Fnu)
def build_LCs(nu_min, nu_max, dset='Inut', only_load=True, inJanskys=False, **kwargs): run = runSSCC(**kwargs) if not only_load: run.cleanup() run.compile() run.runNewSSCC() D = SR.Doppler(run.par.gamma_bulk, run.par.theta_obs) nu = extr.hdf5Extract1D(run.outfile, 'frequency') t = extr.hdf5Extract1D(run.outfile, 'time') nu_obs = SR.nu_obs(nu, run.par.z, run.par.gamma_bulk, run.par.theta_obs) t_obs = SR.t_obs(t, run.par.z, run.par.gamma_bulk, view_angle=run.par.theta_obs) Inu = extr.hdf5Extract2D(run.outfile, dset) Fnu = spec.flux_dens(Inu, run.par.dLum, run.par.z, D, run.par.R) LC = spec.LightCurves() if inJanskys: return t_obs, spec.conv2Jy(LC.integ(nu_min, nu_max, run.par.numdt, nu_obs, Fnu)) else: return t_obs, LC.integ(nu_min, nu_max, run.par.numdt, nu_obs, Fnu)
def integrando_v(self, ll, l0, tt, It): res = np.zeros_like(ll) for i in range(res.size): te = self.Dopp * ((tt / (1.0 + self.z)) + (self.Gbulk * ll[i] * l0 * (self.mu - SR.speed(self.Gbulk)))) # te = tt - ll[i] * l0 if te < 0.0: res[i] = 0.0 else: res[i] = self.pwl_interp(te, self.t_em, It) * (ll[i] - ll[i]**2) return res
import SAPyto.spectra as spec import SAPyto.SRtoolkit as SR import extractor.fromHDF5 as extr import matplotlib.pyplot as plt # In[]: Loading data f = 'HSTOThick-wSSC_FinDif-Ng256Nt300Nf384.h5' wdir = '/Users/jesus/lab/cSPEV/tests/SSCC_discret/Eq1p30RL79/' Inu = extr.hdf5Extract2D(wdir + f, 'Inut') t = extr.hdf5Extract1D(wdir + f, 'time') nu = extr.hdf5Extract1D(wdir + f, 'frequency') numt = extr.hdf5ExtractScalar(wdir + f, 'numdt') numf = extr.hdf5ExtractScalar(wdir + f, 'numdf') D = SR.Doppler(10.0, 5.0) Fnu = spec.EnergyFlux(Inu, 4.0793e26, 0.03, D, 1e18) nu_obs = SR.nu_obs(nu, 0.03, 10.0, 5.0) t_obs = SR.t_obs(t, 0.03, 10.0, view_angle=5.0) # In[]: Building light curves LC = spec.LightCurves() Fnu_lc = LC.integ(1e12, 1e15, numt, nu_obs, nu_obs * Fnu) Fnu_lc_mono = LC.integ(1e14, 1e14, numt, nu_obs, nu_obs * Fnu) Fnu_lc_near = LC.nearest(1e14, nu_obs, nu_obs * Fnu) Fnu_lc_pwl = LC.pwl_interp(1e14, numt, nu_obs, nu_obs * Fnu) # nuFnu_lc_Jy = LC.pwl_interp(1e12, numt, nu_obs, nu_obs * Fnu) # In[]: Plotting light curves fig, ax = plt.subplots() ax.set_xscale('log')