def rm_all(): rmid_list = get_total_rmid_list() for each in rmid_list: try: rm(each) except Exception as reason: print("Failed because of: " + str(reason))
def inte_all(): rmid_list = get_total_rmid_list() for each in rmid_list: try: line_integration(each) except Exception as reason: print("Failed because of: " + str(reason))
def error_estimation_all(): rmid_list = get_total_rmid_list() for each in rmid_list: try: mc_ee(each) except Exception as reason: print("Failed because of: " + str(reason))
def plot_lum_vs_lag(): rmid_list = get_total_rmid_list() zfinal = pickle.load(open(Location.project_loca + "/info_database/zfinal.pkl")) lag_list = list() lag_err_list = list() lum_list = list() lum_err_list = list() fig = plt.figure() for each in rmid_list: try: lag, lag_err = get_lag(each, zfinal) lum, lum_err = get_lum(each, zfinal) if lag < 3.0 * lag_err or lum < 3.0 * lum_err: raise Exception lag_list.append(lag) lag_err_list.append(lag_err) lum_list.append(lum) lum_err_list.append(lum_err) except Exception: continue # plt.errorbar([lum], [lag]) # fig.text(np.log10(lum), np.log10(lag), str(each)) lag = np.log10(np.array(lag_list)) lum = np.log10(np.array(lum_list)) lag_err = np.array(lag_err_list) / np.array(lag_list) lum_err = np.array(lum_err_list) / np.array(lum_list) theory = models.Linear1D(0.5, -10.0, fixed={"slope": True}) obs = models.Const1D(0.0) fitter = fitting.LinearLSQFitter() theory_fit = fitter(theory, lum, lag, weights = lag_err ** 2.0) print(theory_fit.parameters) obs_fit = fitter(obs, lum, lag, weights = lag_err ** 2.0) print(obs_fit.parameters) rcs = np.sum((obs_fit(lum) - lag) ** 2.0) ** 0.5 / (len(rmid_list) - 1.0) print(rcs) print(len(lum)) plt.errorbar(lum, lag, xerr=lum_err, yerr=lag_err, fmt='o') # plt.plot(lum, theory_fit(lum)) plt.plot(lum, obs_fit(lum)) plt.show()
[wave, flux, error] = read_raw_data(rmid, mjd) [wave, flux, error] = extract_fit_part(wave, flux, error, hb[0] - 2.0 * hb[1], hb[0] + 2.0 * hb[1]) [wave, flux, error] = mask_points(wave, flux, error) flux = flux - cont_func(wave) up_wave = wave[0:flux.argmax()] up_flux = flux[0:flux.argmax()] down_flux = flux[flux.argmax():-1] down_wave = wave[flux.argmax():-1] wave_min = find_wave(up_wave, up_flux, 0.5 * np.amax(flux)) wave_max = find_wave(down_wave, down_flux, 0.5 * np.amax(flux)) return (wave_max - wave_min) / hb[1] rmid_list = get_total_rmid_list() fe = list() fe_e = list() hb = list() hb_e = list() for each in rmid_list: try: a, b, e, f = get_fe_hb(each) mjd_list = map( int, os.listdir(Location.project_loca + "data/raw/" + str(each))) hb_fwhm = list() for each_day in mjd_list: hb_fwhm.append(get_fwhm_hb(each, each_day)) except ValueError as reason: continue except IOError as reason:
def hist_fit_all(): rmid_list = get_total_rmid_list() for each in rmid_list: hist_fit(each)
def rescale_all(): rmid_list = get_total_rmid_list() for each in rmid_list: error_scaling(each)
def bin_all(): rmid_list = get_total_rmid_list() for each in rmid_list: binning(each)
def fit_all(): rmid_list = get_total_rmid_list() for i in range(0, len(rmid_list)): fe_fitter(rmid_list[i]) print(str(i + 1) + "out of " + str(len(rmid_list))) print("\n\n")
mean_b = np.mean([a[x] * b[x] for x in res_date]) mean_c = np.mean([c[x] for x in res_date]) mean_d = np.mean([c[x] * d[x] for x in res_date]) mean_e = np.mean([e[x] for x in res_date]) mean_f = np.mean([e[x] * f[x] for x in res_date]) return [mean_a, mean_b, mean_c, mean_d, mean_e, mean_f] def get_fe_hb(rmid): fe, fe_e = get_flux(rmid, "Fe2") hb, hb_e = get_flux(rmid, "Hbetab") o3, o3_e = get_flux(rmid, "O3") return intersect(fe, fe_e, o3, o3_e, hb, hb_e) rmid_list = get_total_rmid_list() fe = list() fe_e = list() hb = list() hb_e = list() for each in rmid_list: a, b, c, d, e, f = get_fe_hb(each) fe.append(a / e) fe_e.append((e * b - f * a) / (e * e)) hb.append(c / e) hb_e.append((e * d - f * c) / (e * e)) fig = plt.figure() ax = fig.add_subplot(111) ax.set_xlabel("Fe / Hbeta") ax.set_ylabel("OIII / Hbeta") plt.scatter(fe, hb)