#include #include #include #include double l_band_HRH(double log_l_bol, double nu); double return_ratio_to_hard_xray(double nu); double return_ratio_to_b_band(double nu); double l_band_GTR(double log_L_bol, double nu); double l_band_MAR(double log_l_bol, double nu); double ratio_of_vandenberk_to_continuum(double nu); /* Script to return the model intrinsic (un-reddened/un-obscured) quasar spectrum as a function of frequency and bolometric quasar luminosity, constructed from observations from ~300 microns to ~100 keV in Hopkins, Richards, and Hernquist 2006, ApJ (HRH06) These model spectra are compiled in the paper above, which details the observational data sets, but in short, we draw heavily from the observations in a number of papers, including : Richards et al. 2006, Steffen et al. 2006, Hatziminaoglou et al. 2005, Tozzi et al. 2006, Strateva et al. 2005, Telfer et al. 2002, Vanden Berk et al. 2001, George et al. 1998, Elvis et al. 1994 also, Marconi et al. 2004 (we follow a similar methodology to their derivation) and note that we generate the X-ray reflection component following Ueda et al. 2003 in the PEXRAV code, Magdziarz & Zdziarski 1995 number of input parameters : 1-2 1 : log_{10}(L_bol/L_sun) -- the log of the bolometric quasar luminosity for which the mean spectrum is desired. This uses the model constructed from the observations above in HRH06, in which the mean intrinsic quasar SED is a function only of bolometric luminosity. units are : L_sun = the bolometric solar luminosity = 3.9 x 10^33 erg/s 2 : SDSS_KEY -- (OPTIONAL) keyword. By default, the template spectrum of vanden Berk et al. 2001 from SDSS is overlaid on the optical portion of the spectrum, as described in HRH06. If for some reason you want to turn this feature *off* (for example, you need to smooth over or otherwise don't want to include line details), then add a second input parameter, set to 0 results are simply printed to stdout, in three columns. The header printed out will describe them, in the general format : ;;// ;;// Intrinsic (un-reddened) AGN spectrum for ;;// log_{10}(L_bol/L_sun) = xx.xx ;;// log_{10}(L_bol/[erg/s]) = xx.xx ;;// (throughout, L_sun is the bolometric solar L = 3.9x10^33 erg/s) ;;// columns are frequency, AGN spectrum (nu*L_nu) in solar and CGS units : ;;// log_{10}(nu/Hz) log_{10}(nu*L_nu/L_sun) log_{10}(nu*L_nu/[erg/s]) ;;// the output frequency list spans ~300 microns to ~100 keV ;;// the last four columns compute bands frequently adopted : ;;// nu = -1.00 :: B-band (4400 Angstroms) ;;// nu = -2.00 :: mid-IR (15 microns) ;;// nu = -3.00 :: soft X-ray (integrated luminosity from 0.5-2 keV) ;;// nu = -4.00 :: hard X-ray (integrated luminosity from 2-10 keV) ;;// Example use : compile :: > gcc agn_spectrum.c -o agn_spec standard call :: > agn_spec 14.0 (print the template spectrum for a L_bol = 10^14 L_sun quasar to stdout) dump to file :: > agn_spec 14.0 > filename (the output results above get dumped to 'filename') turn off the SDSS template overlay :: > agn_spec 14.0 0 (as the above, but adds the second input set to 0, to turn off the overlay of the SDSS model spectrum in the optical) */ int main(int argc, char** argv) { double nu, log_L_bol, l_band, *l_band_vec; char *MODEL_SPECTRUM_SET; char *band_check; char *SLOAN_SET; int BAND_KEY=0; int MODEL_SPECTRUM_KEY; int SLOAN_KEY=0; int i_nu; // sets if simply calling the bolometric correction for a prefab band : // BB = B-band, IR = 15 micron, SX = 0.5-2 keV, HX = 2-10 keV if (argc < 2) { fprintf(stderr, "Expected >=1 arguments (found %d)\n",argc-1); exit(0); } int N_nu = 375; double nu_vec[375] = { 12.00, 12.02, 12.04, 12.06, 12.08, 12.10, 12.12, 12.14, 12.16, 12.18, 12.20, 12.22, 12.24, 12.26, 12.28, 12.30, 12.32, 12.34, 12.36, 12.38, 12.40, 12.42, 12.44, 12.46, 12.48, 12.50, 12.52, 12.54, 12.56, 12.58, 12.60, 12.62, 12.64, 12.66, 12.68, 12.70, 12.72, 12.74, 12.76, 12.78, 12.80, 12.82, 12.84, 12.86, 12.88, 12.90, 12.92, 12.94, 12.96, 12.98, 13.00, 13.02, 13.04, 13.06, 13.08, 13.10, 13.12, 13.14, 13.16, 13.18, 13.20, 13.22, 13.24, 13.26, 13.28, 13.30, 13.32, 13.34, 13.36, 13.38, 13.40, 13.42, 13.44, 13.46, 13.48, 13.50, 13.52, 13.54, 13.56, 13.58, 13.60, 13.62, 13.64, 13.66, 13.68, 13.70, 13.72, 13.74, 13.76, 13.78, 13.80, 13.82, 13.84, 13.86, 13.88, 13.90, 13.92, 13.94, 13.96, 13.98, 14.00, 14.02, 14.04, 14.06, 14.08, 14.10, 14.12, 14.14, 14.16, 14.18, 14.20, 14.22, 14.24, 14.26, 14.28, 14.30, 14.32, 14.34, 14.36, 14.38, 14.40, 14.42, 14.44, 14.46, 14.48, 14.50, 14.52, 14.54, 14.56, 14.58, 14.60, 14.62, 14.64, 14.66, 14.68, 14.70, 14.72, 14.74, 14.76, 14.78, 14.80, 14.82, 14.84, 14.86, 14.88, 14.90, 14.92, 14.94, 14.96, 14.98, 15.00, 15.02, 15.04, 15.06, 15.08, 15.10, 15.12, 15.14, 15.16, 15.18, 15.20, 15.22, 15.24, 15.26, 15.28, 15.30, 15.32, 15.34, 15.36, 15.38, 15.40, 15.42, 15.44, 15.46, 15.48, 15.50, 15.52, 15.54, 15.56, 15.58, 15.60, 15.62, 15.64, 15.66, 15.68, 15.70, 15.72, 15.74, 15.76, 15.78, 15.80, 15.82, 15.84, 15.86, 15.88, 15.90, 15.92, 15.94, 15.96, 15.98, 16.00, 16.02, 16.04, 16.06, 16.08, 16.10, 16.12, 16.14, 16.16, 16.18, 16.20, 16.22, 16.24, 16.26, 16.28, 16.30, 16.32, 16.34, 16.36, 16.38, 16.40, 16.42, 16.44, 16.46, 16.48, 16.50, 16.52, 16.54, 16.56, 16.58, 16.60, 16.62, 16.64, 16.66, 16.68, 16.70, 16.72, 16.74, 16.76, 16.78, 16.80, 16.82, 16.84, 16.86, 16.88, 16.90, 16.92, 16.94, 16.96, 16.98, 17.00, 17.02, 17.04, 17.06, 17.08, 17.10, 17.12, 17.14, 17.16, 17.18, 17.20, 17.22, 17.24, 17.26, 17.28, 17.30, 17.32, 17.34, 17.36, 17.38, 17.40, 17.42, 17.44, 17.46, 17.48, 17.50, 17.52, 17.54, 17.56, 17.58, 17.60, 17.62, 17.64, 17.66, 17.68, 17.70, 17.72, 17.74, 17.76, 17.78, 17.80, 17.82, 17.84, 17.86, 17.88, 17.90, 17.92, 17.94, 17.96, 17.98, 18.00, 18.02, 18.04, 18.06, 18.08, 18.10, 18.12, 18.14, 18.16, 18.18, 18.20, 18.22, 18.24, 18.26, 18.28, 18.30, 18.32, 18.34, 18.36, 18.38, 18.40, 18.42, 18.44, 18.46, 18.48, 18.50, 18.52, 18.54, 18.56, 18.58, 18.60, 18.62, 18.64, 18.66, 18.68, 18.70, 18.72, 18.74, 18.76, 18.78, 18.80, 18.82, 18.84, 18.86, 18.88, 18.90, 18.92, 18.94, 18.96, 18.98, 19.00, 19.02, 19.04, 19.06, 19.08, 19.10, 19.12, 19.14, 19.16, 19.18, 19.20, 19.22, 19.24, 19.26, 19.28, 19.30, 19.32, 19.34, 19.36, 19.38, 19.40, -1.00, -2.00, -3.00, -4.00 }; l_band_vec = calloc(N_nu,sizeof(double)); log_L_bol = atof(argv[1]); SLOAN_KEY = 1; if (argc >= 3) {SLOAN_KEY = atoi(argv[2]);} if ((SLOAN_KEY != 0)&&(SLOAN_KEY != 1)) {SLOAN_KEY=0;} // if specified, can turn on/off the superposition of the SDSS mean spectrum (default = ON) MODEL_SPECTRUM_KEY = 0; // switch to 1 for the Richards et al. 2006 luminosity-independent spectrum for (i_nu=0;i_nu14.575)&&(log_nu<15.500)) l_band += log10(ratio_of_vandenberk_to_continuum(nu)); l_band_vec[i_nu] = l_band; } // now print the resulting spectrum double to_cgs = log10(3.9) + 33.0; printf(";;// \n"); printf(";;// Intrinsic (un-reddened) AGN spectrum for \n"); printf(";;// log_{10}(L_bol/L_sun) = %5.2f \n",log_L_bol); printf(";;// log_{10}(L_bol/[erg/s]) = %5.2f \n",log_L_bol+to_cgs); printf(";;// (throughout, L_sun is the bolometric solar L = 3.9x10^33 erg/s) \n",log_L_bol); printf(";;// columns are frequency, AGN spectrum (nu*L_nu) in solar and CGS units : \n"); printf(";;// log_{10}(nu/Hz) log_{10}(nu*L_nu/L_sun) log_{10}(nu*L_nu/[erg/s]) \n"); printf(";;// the output frequency list spans ~300 microns to ~100 keV \n"); printf(";;// the last four rows compute bands frequently adopted : \n"); printf(";;// nu = -1.00 :: B-band (4400 Angstroms) \n"); printf(";;// nu = -2.00 :: mid-IR (15 microns) \n"); printf(";;// nu = -3.00 :: soft X-ray (integrated luminosity from 0.5-2 keV) \n"); printf(";;// nu = -4.00 :: hard X-ray (integrated luminosity from 2-10 keV) \n"); printf(";;// \n"); for (i_nu=0;i_nu log_nu[924]) return 1.0; if ((log_nu_obs>=log_nu[0])&&(log_nu_obs<=log_nu[924])) { int n0 = (int )((log_nu_obs-log_nu[0])/0.001); // interpolate over the observed range return nuLnu[n0] + (nuLnu[n0+1]-nuLnu[n0]) * ((log_nu_obs-log_nu[n0])/(log_nu[n0+1]-log_nu[n0])); } return 1.0; } // load the spectrum based on the all-quasar template of Richards et al. 2006 double l_band_GTR(double log_L_bol, double nu) { if (nu==0.) return log_L_bol; if (nu==-1.) return log_L_bol - 0.93863501; if (nu==-2.) return log_L_bol - 0.99164163; if (nu==-3.) return log_L_bol - 1.96992370; if (nu==-4.) return log_L_bol - 1.90528590; double log_nu[226]={ 12.50, 12.52, 12.54, 12.56, 12.58, 12.60, 12.62, 12.64, 12.66, 12.68, 12.70, 12.72, 12.74, 12.76, 12.78, 12.80, 12.82, 12.84, 12.86, 12.88, 12.90, 12.92, 12.94, 12.96, 12.98, 13.00, 13.02, 13.04, 13.06, 13.08, 13.10, 13.12, 13.14, 13.16, 13.18, 13.20, 13.22, 13.24, 13.26, 13.28, 13.30, 13.32, 13.34, 13.36, 13.38, 13.40, 13.42, 13.44, 13.46, 13.48, 13.50, 13.52, 13.54, 13.56, 13.58, 13.60, 13.62, 13.64, 13.66, 13.68, 13.70, 13.72, 13.74, 13.76, 13.78, 13.80, 13.82, 13.84, 13.86, 13.88, 13.90, 13.92, 13.94, 13.96, 13.98, 14.00, 14.02, 14.04, 14.06, 14.08, 14.10, 14.12, 14.14, 14.16, 14.18, 14.20, 14.22, 14.24, 14.26, 14.28, 14.30, 14.32, 14.34, 14.36, 14.38, 14.40, 14.42, 14.44, 14.46, 14.48, 14.50, 14.52, 14.54, 14.56, 14.58, 14.60, 14.62, 14.64, 14.66, 14.68, 14.70, 14.72, 14.74, 14.76, 14.78, 14.80, 14.82, 14.84, 14.86, 14.88, 14.90, 14.92, 14.94, 14.96, 14.98, 15.00, 15.02, 15.04, 15.06, 15.08, 15.10, 15.12, 15.14, 15.16, 15.18, 15.20, 15.22, 15.24, 15.26, 15.28, 15.30, 15.32, 15.34, 15.36, 15.38, 15.40, 15.42, 15.44, 15.46, 15.48, 15.50, 15.52, 15.54, 15.56, 15.58, 15.60, 15.62, 15.64, 15.66, 15.68, 15.70, 15.72, 15.74, 15.76, 15.78, 15.80, 15.82, 15.84, 15.86, 15.88, 15.90, 15.92, 15.94, 15.96, 15.98, 16.00, 16.02, 16.04, 16.06, 16.08, 16.10, 16.12, 16.14, 16.16, 16.18, 16.20, 16.22, 16.24, 16.26, 16.28, 16.30, 16.32, 16.34, 16.36, 16.38, 16.40, 16.42, 16.44, 16.46, 16.48, 16.50, 16.52, 16.54, 16.56, 16.58, 16.60, 16.62, 16.64, 16.66, 16.68, 16.70, 16.72, 16.74, 16.76, 16.78, 16.80, 16.82, 16.84, 16.86, 16.88, 16.90, 16.92, 16.94, 16.96, 16.98, 17.00 }; double log_nuLnu[226]={ 44.43, 44.49, 44.54, 44.59, 44.65, 44.70, 44.74, 44.79, 44.83, 44.87, 44.90, 44.93, 44.96, 44.99, 45.02, 45.04, 45.06, 45.09, 45.11, 45.13, 45.15, 45.16, 45.18, 45.20, 45.22, 45.23, 45.25, 45.26, 45.27, 45.28, 45.30, 45.31, 45.32, 45.33, 45.33, 45.34, 45.35, 45.36, 45.37, 45.37, 45.38, 45.39, 45.39, 45.40, 45.40, 45.41, 45.41, 45.42, 45.42, 45.43, 45.43, 45.44, 45.44, 45.44, 45.44, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.44, 45.44, 45.44, 45.44, 45.43, 45.43, 45.42, 45.42, 45.41, 45.40, 45.39, 45.37, 45.36, 45.34, 45.32, 45.30, 45.28, 45.26, 45.24, 45.21, 45.20, 45.18, 45.17, 45.16, 45.15, 45.15, 45.16, 45.16, 45.17, 45.17, 45.19, 45.20, 45.21, 45.22, 45.23, 45.25, 45.26, 45.27, 45.29, 45.30, 45.31, 45.32, 45.33, 45.35, 45.37, 45.38, 45.40, 45.42, 45.44, 45.46, 45.48, 45.51, 45.54, 45.56, 45.59, 45.61, 45.63, 45.64, 45.65, 45.65, 45.65, 45.65, 45.66, 45.66, 45.67, 45.69, 45.70, 45.71, 45.72, 45.73, 45.74, 45.75, 45.76, 45.76, 45.76, 45.76, 45.74, 45.73, 45.70, 45.67, 45.64, 45.60, 45.57, 45.54, 45.52, 45.49, 45.48, 45.46, 45.45, 45.43, 45.41, 45.40, 45.38, 45.36, 45.34, 45.32, 45.30, 45.27, 45.25, 45.23, 45.20, 45.18, 45.16, 45.14, 45.12, 45.09, 45.07, 45.05, 45.03, 45.01, 44.98, 44.96, 44.94, 44.92, 44.90, 44.87, 44.85, 44.83, 44.81, 44.79, 44.77, 44.74, 44.72, 44.70, 44.68, 44.66, 44.63, 44.61, 44.59, 44.57, 44.55, 44.52, 44.50, 44.48, 44.46, 44.44, 44.42, 44.41, 44.39, 44.37, 44.36, 44.34, 44.33, 44.31, 44.30, 44.29, 44.29, 44.28, 44.27, 44.27, 44.27, 44.27, 44.27, 44.27, 44.26, 44.26, 44.26 }; double GTR_lbol = 46.372012; double log_nu_obs = log10(nu); double nuLnu_obs; if (log_nu_obs < log_nu[0]) nuLnu_obs = log_nuLnu[0] + 2.0*(log_nu_obs - log_nu[0]); if (log_nu_obs > log_nu[224]) nuLnu_obs = log_nuLnu[224]; // assumes Gamma=2.0 if ((log_nu_obs>=log_nu[0])&&(log_nu_obs<=log_nu[224])) { int n0 = (int )((log_nu_obs-log_nu[0])/0.02); nuLnu_obs = log_nuLnu[n0] + (log_nuLnu[n0+1]-log_nuLnu[n0]) * ((log_nu_obs-log_nu[n0])/(log_nu[n0+1]-log_nu[n0])); } return nuLnu_obs-GTR_lbol + log_L_bol; } // return the intrinsic band luminosity for some bolometric luminosity and frequency; // nu = 0 (l_bol), -1 (B-band), -2 (15 microns), -3 (0.5-2 keV), -4 (2-10 keV), // otherwise nu is the observed frequency and the return is nu*L_nu double l_band_HRH(double log_l_bol, double nu) { double x = log_l_bol - 10.; double lband = 0.; double P0,P1,P2,P3; if (nu==(0.)) return pow(10.,log_l_bol); if (nu < 0.) { if (nu==(-1.)) {P0=8.99833; P1=6.24800; P2=-0.370587; P3=-0.0115970;} if (nu==(-2.)) {P0=10.6615; P1=7.40282; P2=-0.370587; P3=-0.0115970;} if (nu==(-3.)) {P0=10.0287; P1=17.8653; P2=0.276804; P3=-0.0199558;} if (nu==(-4.)) {P0=6.08087; P1=10.8331; P2=0.276802; P3=-0.0199597;} lband = P0*pow(10.,P3*x) + P1*pow(10.,P2*x); return pow(10.,log_l_bol)/lband; } // if not one of the specified bands, then take advantage of the fact that our model // spectrum is not l-dependent below 500 angstroms or above 50 angstroms, so // just take the appropriate ratios to renormalize to those luminosities double nu_angstrom = (2.998e8)/(1.0e-10); double nu500 = nu_angstrom/500.; double nu50 = nu_angstrom/50.; if (nu <= nu500) { // just take the ratio relative to B-band double P[4] = {8.99833 , 6.24800 , -0.370587 , -0.0115970}; lband = P[0]*pow(10.,P[3]*x) + P[1]*pow(10.,P[2]*x); return return_ratio_to_b_band(nu)*pow(10.,log_l_bol)/lband; } if (nu >= nu50) { // just take the ratio relative to the hard X-rays double P[4] = {6.08087 , 10.8331 , 0.276802 , -0.0199597}; lband = P[0]*pow(10.,P[3]*x) + P[1]*pow(10.,P[2]*x); return return_ratio_to_hard_xray(nu)*pow(10.,log_l_bol)/lband; } if ((nu>nu500)&&(nu log_nu[273]) nuLnu_obs = -2.0 - pow(10.0,log_nu_obs-20.1204)*(0.43429448); if ((log_nu_obs>=log_nu[0])&&(log_nu_obs<=log_nu[273])) { int n0 = (int )((log_nu_obs-log_nu[0])/0.02); nuLnu_obs = log_nuLnu[n0] + (log_nuLnu[n0+1]-log_nuLnu[n0]) * ((log_nu_obs-log_nu[n0])/(log_nu[n0+1]-log_nu[n0])); } return pow(10.0,nuLnu_obs-L_HX); } // load the optical-IR template, based on the observations in text and specifically // the Richards et al. 2006 mean blue SED double return_ratio_to_b_band(double nu) { double log_nu[226]={ 12.50, 12.52, 12.54, 12.56, 12.58, 12.60, 12.62, 12.64, 12.66, 12.68, 12.70, 12.72, 12.74, 12.76, 12.78, 12.80, 12.82, 12.84, 12.86, 12.88, 12.90, 12.92, 12.94, 12.96, 12.98, 13.00, 13.02, 13.04, 13.06, 13.08, 13.10, 13.12, 13.14, 13.16, 13.18, 13.20, 13.22, 13.24, 13.26, 13.28, 13.30, 13.32, 13.34, 13.36, 13.38, 13.40, 13.42, 13.44, 13.46, 13.48, 13.50, 13.52, 13.54, 13.56, 13.58, 13.60, 13.62, 13.64, 13.66, 13.68, 13.70, 13.72, 13.74, 13.76, 13.78, 13.80, 13.82, 13.84, 13.86, 13.88, 13.90, 13.92, 13.94, 13.96, 13.98, 14.00, 14.02, 14.04, 14.06, 14.08, 14.10, 14.12, 14.14, 14.16, 14.18, 14.20, 14.22, 14.24, 14.26, 14.28, 14.30, 14.32, 14.34, 14.36, 14.38, 14.40, 14.42, 14.44, 14.46, 14.48, 14.50, 14.52, 14.54, 14.56, 14.58, 14.60, 14.62, 14.64, 14.66, 14.68, 14.70, 14.72, 14.74, 14.76, 14.78, 14.80, 14.82, 14.84, 14.86, 14.88, 14.90, 14.92, 14.94, 14.96, 14.98, 15.00, 15.02, 15.04, 15.06, 15.08, 15.10, 15.12, 15.14, 15.16, 15.18, 15.20, 15.22, 15.24, 15.26, 15.28, 15.30, 15.32, 15.34, 15.36, 15.38, 15.40, 15.42, 15.44, 15.46, 15.48, 15.50, 15.52, 15.54, 15.56, 15.58, 15.60, 15.62, 15.64, 15.66, 15.68, 15.70, 15.72, 15.74, 15.76, 15.78, 15.80, 15.82, 15.84, 15.86, 15.88, 15.90, 15.92, 15.94, 15.96, 15.98, 16.00, 16.02, 16.04, 16.06, 16.08, 16.10, 16.12, 16.14, 16.16, 16.18, 16.20, 16.22, 16.24, 16.26, 16.28, 16.30, 16.32, 16.34, 16.36, 16.38, 16.40, 16.42, 16.44, 16.46, 16.48, 16.50, 16.52, 16.54, 16.56, 16.58, 16.60, 16.62, 16.64, 16.66, 16.68, 16.70, 16.72, 16.74, 16.76, 16.78, 16.80, 16.82, 16.84, 16.86, 16.88, 16.90, 16.92, 16.94, 16.96, 16.98, 17.00 }; double log_nuLnu[226]={ 44.39, 44.44, 44.50, 44.55, 44.60, 44.65, 44.70, 44.74, 44.78, 44.82, 44.86, 44.89, 44.92, 44.95, 44.97, 45.00, 45.02, 45.04, 45.06, 45.08, 45.10, 45.12, 45.14, 45.16, 45.17, 45.19, 45.20, 45.22, 45.23, 45.24, 45.25, 45.26, 45.27, 45.28, 45.29, 45.30, 45.31, 45.31, 45.32, 45.33, 45.34, 45.34, 45.35, 45.35, 45.36, 45.36, 45.37, 45.38, 45.38, 45.38, 45.39, 45.39, 45.39, 45.40, 45.40, 45.40, 45.40, 45.41, 45.41, 45.41, 45.41, 45.41, 45.41, 45.41, 45.41, 45.41, 45.40, 45.40, 45.40, 45.40, 45.40, 45.40, 45.39, 45.39, 45.38, 45.38, 45.37, 45.36, 45.35, 45.34, 45.33, 45.31, 45.30, 45.28, 45.26, 45.24, 45.22, 45.19, 45.17, 45.15, 45.13, 45.12, 45.11, 45.11, 45.11, 45.11, 45.12, 45.12, 45.13, 45.14, 45.15, 45.16, 45.18, 45.19, 45.20, 45.22, 45.23, 45.25, 45.26, 45.27, 45.28, 45.30, 45.32, 45.34, 45.36, 45.38, 45.40, 45.42, 45.44, 45.47, 45.49, 45.52, 45.55, 45.58, 45.60, 45.62, 45.64, 45.65, 45.65, 45.66, 45.66, 45.67, 45.68, 45.69, 45.71, 45.72, 45.74, 45.75, 45.77, 45.78, 45.79, 45.80, 45.80, 45.80, 45.80, 45.79, 45.77, 45.74, 45.71, 45.68, 45.64, 45.60, 45.57, 45.55, 45.52, 45.51, 45.49, 45.47, 45.46, 45.44, 45.42, 45.40, 45.38, 45.36, 45.34, 45.32, 45.29, 45.27, 45.25, 45.22, 45.20, 45.18, 45.15, 45.13, 45.11, 45.08, 45.06, 45.04, 45.02, 44.99, 44.97, 44.95, 44.92, 44.90, 44.88, 44.86, 44.83, 44.81, 44.79, 44.77, 44.74, 44.72, 44.70, 44.67, 44.65, 44.63, 44.61, 44.58, 44.56, 44.54, 44.52, 44.50, 44.47, 44.45, 44.43, 44.41, 44.40, 44.38, 44.36, 44.35, 44.33, 44.32, 44.30, 44.29, 44.28, 44.27, 44.27, 44.26, 44.26, 44.26, 44.26, 44.26, 44.25, 44.25, 44.25, 44.25 }; // want the ratio with respect to the intrinsic B-band: double nu_BB = 14.833657; double L_BB = 45.413656; double log_nu_obs = log10(nu); double nuLnu_obs = 0.; if (log_nu_obs < log_nu[0]) nuLnu_obs = log_nuLnu[0] + 2.0*(log_nu_obs - log_nu[0]); if (log_nu_obs > log_nu[224]) nuLnu_obs = log_nuLnu[224]; // assumes Gamma=2.0; the calling code will actually use X-ray template for this case if ((log_nu_obs>=log_nu[0])&&(log_nu_obs<=log_nu[224])) { int n0 = (int )((log_nu_obs-log_nu[0])/0.02); nuLnu_obs = log_nuLnu[n0] + (log_nuLnu[n0+1]-log_nuLnu[n0]) * ((log_nu_obs-log_nu[n0])/(log_nu[n0+1]-log_nu[n0])); } return pow(10.0,nuLnu_obs-L_BB); }