for i in range(len(overhead)): print i, overhead[i] name = pf.read_column(filename, 0, dtype=str, stripper='|', splitter = '|') # T90 T90 = pf.read_column(filename, 1, stripper='|', splitter = '|') T90_mask = np.isfinite(T90) # pflx peak_flux_1024 = pf.read_column(filename, 34, stripper='|', splitter = '|' ) peak_flux_1024_err = pf.read_column(filename, 35, stripper='|', splitter = '|' ) peak_flux_1024_mask = np.isfinite(peak_flux_1024) # Band spectrum at pflx nd_pflx_band_ampl = pf.read_data(filename, 79, stripper='|', splitter = '|') nd_pflx_band_epeak = pf.read_data(filename, 82, stripper='|', splitter = '|') nd_pflx_band_alpha = pf.read_data(filename, 85, stripper='|', splitter = '|') nd_pflx_band_beta = pf.read_data(filename, 88, stripper='|', splitter = '|') pflx_band_redchisq = pf.read_column(filename, 99, stripper='|', splitter = '|') pflx_band_dof = pf.read_column(filename, 101, stripper='|', splitter = '|') pflx_best_fitting_model = pf.read_column(filename, 21, dtype=str, stripper='|', splitter = '|') # Band spectrum time integrated nd_flnc_band_ampl = pf.read_data(filename, 9, stripper='|', splitter = '|') nd_flnc_band_epeak = pf.read_data(filename, 12, stripper='|', splitter = '|') nd_flnc_band_alpha = pf.read_data(filename, 15, stripper='|', splitter = '|') nd_flnc_band_beta = pf.read_data(filename, 18, stripper='|', splitter = '|') flnc_best_fitting_model = pf.read_column(filename, 23, dtype=str, stripper='|', splitter = '|')
############################################################################### # Settings: what to plot beamf_type = 'dics' # can be lcmv or dics # plot_type can be "corr" for correlation, "foc" for focality or "ori" for # orientation error plot_type = 'foc' ############################################################################### # Read in the data and plot settings data = read_data(beamf_type, plot_type, exclude_deep_vertices=False, radius=0.055, plot_deep_vertices=True) title, kwargs = get_plotting_specs(beamf_type, plot_type) ############################################################################### # Plot the different NORMALIZATIONS contrasted with each other options = [ 'weight_norm=="unit-noise-gain" and normalize_fwd==False', 'weight_norm=="none" and normalize_fwd==True', 'weight_norm=="none" and normalize_fwd==False' ] labels = [ 'Weight normalization', 'Lead field normalization', 'No normalization' ]
# Create original BAT6 filename_og = root_dir + 'catalogs/BAT6_cat/BAT6_2012.txt' name_og = pf.read_column(filename_og, 0, dtype=str, splitter='\t|') redshift_og = pf.read_column(filename_og, 1, dtype=float, splitter='\t|') redshift_og_mask = np.isfinite(redshift_og) obs_redshift_og_masked = np.zeros(len(redshift_og)) # Extended BAT6 : eBAT6 file_eBAT6_obs = root_dir + 'catalogs/BAT6_cat/eBAT6_cat.txt' obs_name = pf.read_column(file_eBAT6_obs, 0, stripper='|', splitter='|', dtype=str) obs_redshift = pf.read_column(file_eBAT6_obs, 1, stripper='|', splitter='|') obs_redshift2 = pf.read_data(file_eBAT6_obs, 1, stripper='|', splitter='|') obs_redshift_mask = np.isfinite(obs_redshift) obs_redshift_masked = np.zeros(len(obs_redshift)) obs_redshift_masked = obs_redshift[obs_redshift_mask] file_Swift_obs = root_dir + 'catalogs/Swift_cat/Swift_pflx_cat.txt' obs_name_S2 = pf.read_column(file_Swift_obs, 0, dtype=str) obs_name_S = [] for i in range(len(obs_name_S2)): if int(obs_name_S2[i][:2]) <= 14: obs_name_S.append(obs_name_S2[i]) obs_name_S = np.asarray(obs_name_S).astype(str) file_Swift_obsb = root_dir + 'catalogs/Swift_cat/Swift_cat.txt' obs_name_S2b = pf.read_column(file_Swift_obsb, 0, dtype=str) obs_name_Sb = []
import config from plotting_functions import get_plotting_specs, scatter_plot, read_data ############################################################################### # Settings: what to plot beamf_type = 'dics' # can be lcmv or dics # plot_type can be "corr" for correlation, "foc" for focality or "ori" for # orientation error plot_type = 'foc' ############################################################################### # Read in the data and plotting settings data = read_data(beamf_type, plot_type) title, kwargs = get_plotting_specs(beamf_type, plot_type) ############################################################################### # WEIGHT NORMALIZATION base = 'weight_norm=="unit-noise-gain" and normalize_fwd==False and %s' if beamf_type == 'lcmv': options = [ base % 'inversion=="matrix" and reduce_rank==False', base % 'inversion=="matrix" and reduce_rank==True', base % 'inversion=="single"', base % 'inversion=="matrix" and reduce_rank==False and \ pick_ori=="none"' ]
import config from plotting_functions import get_plotting_specs, scatter_plot, read_data ############################################################################### # Settings: what to plot beamf_type = 'dics' # can be lcmv or dics # plot_type can be "corr" for correlation, "foc" for focality or "ori" for # orientation error plot_type = 'foc' ############################################################################### # Read in the data and plotting settings select_vertices = 'shallow' # 'deep', 'shallow', or None data = read_data(beamf_type, plot_type, select_vertices) title, kwargs = get_plotting_specs(beamf_type, plot_type, select_vertices) ############################################################################### # WEIGHT vs. LEAD FIELD vs. NO NORMALIZATION options = [ 'weight_norm=="unit-noise-gain" and normalize_fwd==False', 'weight_norm=="none" and normalize_fwd==True', 'weight_norm=="none" and normalize_fwd==False' ] labels = [ 'Weight normalization', 'Lead field normalization', 'No normalization' ]
from plotting_functions import (get_plotting_specs, scatter_plot, read_data, scatter_plot_hover) ############################################################################### # Settings: what to plot beamf_type = 'dics' # can be lcmv or dics # plot_type can be "corr" for correlation, "foc" for focality or "ori" for # orientation error plot_type = 'foc' ############################################################################### # Read in the data and plot settings data = read_data(beamf_type, plot_type, select_vertices='shallow') title, kwargs = get_plotting_specs(beamf_type, plot_type) ############################################################################### # Plot the different NORMALIZATIONS contrasted with each other options = [ 'weight_norm=="unit-noise-gain" and normalize_fwd==False', 'weight_norm=="none" and normalize_fwd==True', 'weight_norm=="none" and normalize_fwd==False' ] labels = [ 'Weight normalization', 'Lead field normalization', 'No normalization' ] colors = [config.cols['orchid'], config.cols['sky'], config.cols['spring']] full_title = (title % 'Normalization')
import plotting_functions as pf #from astroML.plotting import hist from scipy.stats import chi2 from scipy import interpolate # plt.style.use('ggplot') #plt.style.use('presentation') matplotlib.rc('font', **{'family': 'serif', 'serif': ['Palatino']}) matplotlib.rc('text', usetex=False) filename = 'GBM_cat_complete.txt' verbose = False peak_flux_1024_nd = pf.read_data(filename, 34, stripper='|', splitter='|', single_err=True) # Batse flux (50-300 keV) pflx_band_alpha_nd = pf.read_data(filename, 85, stripper='|', splitter='|') pflx_band_beta_nd = pf.read_data(filename, 88, stripper='|', splitter='|') fig = plt.figure(figsize=(12, 10), tight_layout=True) axa = fig.add_subplot(211) axb = fig.add_subplot(212, sharex=axa) pflx_band_alpha_nd[0] = -pflx_band_alpha_nd[0] pflx_band_beta_nd[0] = -pflx_band_beta_nd[0] pf.scatter_incomplete_ndarray(axa, peak_flux_1024_nd, pflx_band_alpha_nd, color='k', alpha=0.9,
import numpy as np import matplotlib import matplotlib.pyplot as plt import plotting_functions as pf from matplotlib.transforms import blended_transform_factory plt.style.use('ggplot') fig = plt.figure() ax = fig.add_subplot(111) root_dir = '/nethome/palmerio/1ere_annee/Frederic/GRB_population_code/Model_outputs/' filename = root_dir +'run_LIA/EpGBM_constraint.dat' Ep_bins = pf.read_data(filename, 0) Ep_hist_mod = pf.read_data(filename, 1) Ep_hist_obs = pf.read_data(filename, 2) x=np.linspace(1.,4., 500) y = max(Ep_hist_obs) * pf.gaussian(x, 2.25, 0.35) y2 = max(Ep_hist_obs) * pf.gaussian(x, 2.25, 0.375) ep = np.linspace(1,4, 100) ep_gauss = pf.gaussian(ep, 2.2, 0.4)*max(Ep_hist_obs) ax.plot(Ep_bins, Ep_hist_obs, label = 'Observations') #ax.plot(Ep_bins, Ep_hist_mod, label = 'MC simulation') #ax.plot(ep, ep_gauss, ls=':', lw=2) ax.plot(x,y, label='gaussian') ax.plot(x,y2, label='gaussian2') ax.legend(loc='best')