def spec_disk2(f1, f2, m, mdot, rmin, rmax): tref = tdisk(m, mdot, rmin) nfreq = 10 f1a = 10**float(int(np.log10(f1))) f2a = 10**float(int(np.log10(f2)) + 1) nrange = int(np.log10((f2a / f1a))) freq = [] dfreq = [] ftemp = f1a df = f1a / nfreq for i in range(nrange): for j in range(nfreq * 9): ftemp = ftemp + df if ftemp > f2: break if ftemp >= f1: freq.append(ftemp) df = df * 10.0 #print freq[0],freq[len(freq)-1] spec = np.zeros(len(freq)) rtemp = np.logspace(np.log10(rmin), np.log10(rmax), num=100) rdisk = [] for j in range(len(rtemp) - 1): rdisk.append((rtemp[j] + rtemp[j + 1]) / 2.0) r = rdisk[j] / rmin area = PI * (rtemp[j + 1] * rtemp[j + 1] - rtemp[j] * rtemp[j]) t = (disk.teff(tref, r)) for i in range(len(freq) - 1): spec[i] = spec[i] + (ah.planck_nu(t, freq[i]) * area * PI * 2) return (freq, spec)
def spec_disk2(f1, f2, m, mdot, rmin, rmax): tref = tdisk(m, mdot, rmin) nfreq = 10 f1a = 10 ** float(int(np.log10(f1))) f2a = 10 ** float(int(np.log10(f2)) + 1) nrange = int(np.log10((f2a / f1a))) freq = [] dfreq = [] ftemp = f1a df = f1a / nfreq for i in range(nrange): for j in range(nfreq * 9): ftemp = ftemp + df if ftemp > f2: break if ftemp >= f1: freq.append(ftemp) df = df * 10.0 # print freq[0],freq[len(freq)-1] spec = np.zeros(len(freq)) rtemp = np.logspace(np.log10(rmin), np.log10(rmax), num=100) rdisk = [] for j in range(len(rtemp) - 1): rdisk.append((rtemp[j] + rtemp[j + 1]) / 2.0) r = rdisk[j] / rmin area = PI * (rtemp[j + 1] * rtemp[j + 1] - rtemp[j] * rtemp[j]) t = disk.teff(tref, r) for i in range(len(freq) - 1): spec[i] = spec[i] + (ah.planck_nu(t, freq[i]) * area * PI * 2) return (freq, spec)
def llamb_disk(lamb, m, mdot, rmin, rmax): tref = tdisk(m, mdot, rmin) rtemp = np.logspace(np.log10(rmin), np.log10(rmax), num=100) rdisk = [] llamb = 0.0 for j in range(len(rtemp) - 1): rdisk.append((rtemp[j] + rtemp[j + 1]) / 2.0) r = rdisk[j] / rmin area = PI * (rtemp[j + 1] * rtemp[j + 1] - rtemp[j] * rtemp[j]) t = (disk.teff(tref, r)) llamb = llamb + (ah.planck_lamb(t, lamb) * area * PI * 2.0) return (llamb)
def lnu_disk(f, m, mdot, rmin, rmax): tref = tdisk(m, mdot, rmin) rtemp = np.logspace(np.log10(rmin), np.log10(rmax), num=100) rdisk = [] lnu = 0.0 for j in range(len(rtemp) - 1): rdisk.append((rtemp[j] + rtemp[j + 1]) / 2.0) r = rdisk[j] / rmin area = PI * (rtemp[j + 1] * rtemp[j + 1] - rtemp[j] * rtemp[j]) t = (disk.teff(tref, r)) lnu = lnu + (ah.planck_nu(t, f) * area * PI * 2.0) return (lnu)
def llamb_disk(lamb, m, mdot, rmin, rmax): tref = tdisk(m, mdot, rmin) rtemp = np.logspace(np.log10(rmin), np.log10(rmax), num=100) rdisk = [] llamb = 0.0 for j in range(len(rtemp) - 1): rdisk.append((rtemp[j] + rtemp[j + 1]) / 2.0) r = rdisk[j] / rmin area = PI * (rtemp[j + 1] * rtemp[j + 1] - rtemp[j] * rtemp[j]) t = disk.teff(tref, r) llamb = llamb + (ah.planck_lamb(t, lamb) * area * PI * 2.0) return llamb
def lnu_disk(f, m, mdot, rmin, rmax): tref = tdisk(m, mdot, rmin) rtemp = np.logspace(np.log10(rmin), np.log10(rmax), num=100) rdisk = [] lnu = 0.0 for j in range(len(rtemp) - 1): rdisk.append((rtemp[j] + rtemp[j + 1]) / 2.0) r = rdisk[j] / rmin area = PI * (rtemp[j + 1] * rtemp[j + 1] - rtemp[j] * rtemp[j]) t = disk.teff(tref, r) lnu = lnu + (ah.planck_nu(t, f) * area * PI * 2.0) return lnu
def spec_disk(f1, f2, m, mdot, rmin, rmax): tref = tdisk(m, mdot, rmin) nfreq = (f2 / f1) * 100 freq = np.linspace(f1, f2, nfreq) spec = np.empty(nfreq) dfreq = freq[1] - freq[0] rtemp = np.logspace(np.log10(rmin), np.log10(rmax), num=100) rdisk = [] for j in range(len(rtemp) - 1): rdisk.append((rtemp[j] + rtemp[j + 1]) / 2.0) r = rdisk[j] / rmin area = PI * (rtemp[j + 1] * rtemp[j + 1] - rtemp[j] * rtemp[j]) t = (disk.teff(tref, r)) for i in range(len(freq)): spec[i] = spec[i] + (ah.planck_nu(t, freq[i]) * area * PI * 2) return (freq, spec)
def spec_disk(f1, f2, m, mdot, rmin, rmax): tref = tdisk(m, mdot, rmin) nfreq = (f2 / f1) * 100 freq = np.linspace(f1, f2, nfreq) spec = np.empty(nfreq) dfreq = freq[1] - freq[0] rtemp = np.logspace(np.log10(rmin), np.log10(rmax), num=100) rdisk = [] for j in range(len(rtemp) - 1): rdisk.append((rtemp[j] + rtemp[j + 1]) / 2.0) r = rdisk[j] / rmin area = PI * (rtemp[j + 1] * rtemp[j + 1] - rtemp[j] * rtemp[j]) t = disk.teff(tref, r) for i in range(len(freq)): spec[i] = spec[i] + (ah.planck_nu(t, freq[i]) * area * PI * 2) return (freq, spec)
spectrum = [] fmax = [] lum_ioniz = [] lum_uv = [] L_2500 = 0.0 n_ioniz = [] cum_ioniz = [] tot_ioniz = 0.0 tot_c4 = 0.0 tot_nioniz = 0.0 peak_nioniz = 0.0 for j in range(len(rtemp) - 1): rdisk.append((rtemp[j] + rtemp[j + 1]) / 2.0) r = rdisk[j] / geo.rstar area = PI * (rtemp[j + 1] * rtemp[j + 1] - rtemp[j] * rtemp[j]) t = disk.teff(tref, r) tdisk.append(t) fmax.append(t * WIEN) temp_ioniz = 0.0 temp_uv = 0.0 temp_nioniz = 0.0 tempc4 = 0.0 i = 0 bnu = 1e-98 while bnu > 1e-99: freq = 1e15 + i * df bnu = ah.planck_nu(t, freq) if freq > fev: temp_ioniz = temp_ioniz + bnu temp_nioniz = temp_nioniz + (bnu / (H * freq)) if freq > f1 and freq < f2:
spectrum = [] fmax = [] lum_ioniz = [] lum_uv = [] L_2500 = 0.0 n_ioniz = [] cum_ioniz = [] tot_ioniz = 0.0 tot_c4 = 0.0 tot_nioniz = 0.0 peak_nioniz = 0.0 for j in range(len(rtemp) - 1): rdisk.append((rtemp[j] + rtemp[j + 1]) / 2.0) r = rdisk[j] / geo.rstar area = PI * (rtemp[j + 1] * rtemp[j + 1] - rtemp[j] * rtemp[j]) t = (disk.teff(tref, r)) tdisk.append(t) fmax.append(t * WIEN) temp_ioniz = 0.0 temp_uv = 0.0 temp_nioniz = 0.0 tempc4 = 0.0 i = 0 bnu = 1e-98 while (bnu > 1e-99): freq = 1e15 + i * df bnu = ah.planck_nu(t, freq) if (freq > fev): temp_ioniz = temp_ioniz + bnu temp_nioniz = temp_nioniz + (bnu / (H * freq)) if (freq > f1 and freq < f2):