def dummy_legus(): return mass, mass_err_lo, mass_err_hi, r_eff, r_eff_err_lo, r_eff_err_hi funcs = [ dummy_legus, mru_d.get_mw_open_clusters, mru_d.get_mw_ymc_krumholz_19_clusters ] mass_total = np.concatenate([func()[0] for func in funcs]) mass_err_lo_total = np.concatenate([func()[1] for func in funcs]) mass_err_hi_total = np.concatenate([func()[2] for func in funcs]) r_eff_total = np.concatenate([func()[3] for func in funcs]) r_eff_err_lo_total = np.concatenate([func()[4] for func in funcs]) r_eff_err_hi_total = np.concatenate([func()[5] for func in funcs]) # Then we can do the fit fit, fit_history = mru_mle.fit_mass_size_relation( mass_total, mass_err_lo_total, mass_err_hi_total, r_eff_total, r_eff_err_lo_total, r_eff_err_hi_total, fit_mass_upper_limit=1e5, ) mru.write_fit_results(fit_out_file, "LEGUS + MW", fit, fit_history, mass_total) # finalize output file fit_out_file.close()
r_eff[age_mask], color, zorder=zorder, alpha=0.25, ) mru_p.add_percentile_lines( ax, mass[age_mask], r_eff[age_mask], color=color, percentiles=[50], label_percents=False, label_legend=f"{name.replace('--', '-')}, N={np.sum(age_mask)}", ) mru_p.plot_best_fit_line( ax, fit, 1, 1e5, color, fill=False, label="", ls=":", ) mru.write_fit_results(fit_out_file, name, fit, fit_history, mass[age_mask]) mru_p.format_mass_size_plot(ax, legend_fontsize=13) fig.savefig(plot_name) # finalize output file fit_out_file.close()
funcs = [ dummy_legus, mru_d.get_m31_open_clusters, mru_d.get_m83_clusters, ] mass_total = np.concatenate([func()[0] for func in funcs]) mass_err_lo_total = np.concatenate([func()[1] for func in funcs]) mass_err_hi_total = np.concatenate([func()[2] for func in funcs]) r_eff_total = np.concatenate([func()[3] for func in funcs]) r_eff_err_lo_total = np.concatenate([func()[4] for func in funcs]) r_eff_err_hi_total = np.concatenate([func()[5] for func in funcs]) # Then we can do the fit fit, fit_history = mru_mle.fit_mass_size_relation( mass_total, mass_err_lo_total, mass_err_hi_total, r_eff_total, r_eff_err_lo_total, r_eff_err_hi_total, fit_mass_upper_limit=1e5, ) mru.write_fit_results(fit_out_file, "LEGUS + External Galaxies", fit, fit_history, mass_total) # finalize output file fit_out_file.close()
fit, fit_history = mru_mle.fit_mass_size_relation( mass, mass_err_lo, mass_err_hi, r_eff, r_eff_err_lo, r_eff_err_hi, fit_mass_upper_limit=1e5, ) # then plot the dataset fig, ax = bpl.subplots() mru_p.plot_mass_size_dataset_scatter( ax, mass, mass_err_lo, mass_err_hi, r_eff, r_eff_err_lo, r_eff_err_hi, bpl.color_cycle[0], ) mru_p.add_percentile_lines(ax, mass, r_eff) mru_p.plot_best_fit_line(ax, fit, 1e2, 1e5, color=bpl.color_cycle[1]) mru_p.format_mass_size_plot(ax) fig.savefig(plot_name) mru.write_fit_results(fit_out_file, "1 Myr -- 1 Gyr", fit, fit_history, mass) # finalize output file fit_out_file.close()
mass_err_lo, mass_err_hi, r_eff, r_eff_err_lo, r_eff_err_hi, fit_mass_upper_limit=1e5, ) # then plot the dataset fig, ax = bpl.subplots() mru_p.plot_mass_size_dataset_scatter( ax, mass, mass_err_lo, mass_err_hi, r_eff, r_eff_err_lo, r_eff_err_hi, bpl.color_cycle[0], ) mru_p.add_percentile_lines(ax, mass, r_eff) mru_p.plot_best_fit_line(ax, fit, 1e2, 1e5, color=bpl.color_cycle[1]) mru_p.format_mass_size_plot(ax) fig.savefig(plot_name) mru.write_fit_results(fit_out_file, "Full LEGUS Sample", fit, fit_history, mass) # finalize output file fit_out_file.close()