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 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)
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') ax.set_yscale('log') ax.set_xlabel(r'$t\; \mathrm{[s]}$', fontsize='x-large')