def get_data(name, plot=0): analysis_mgr = jspec.dssd_analysis_manager(name, '../../storage/', (32, 32), [1, 1, 1]) data = analysis_mgr.load_dill('dl_estimates') num_sources = len(data) num_dets = len(data[0][0]) ret = meas.empty((num_sources, num_dets)) for i in range(num_sources): for d in range(num_dets): tmp = data[i][0][d] ret[i, d] = meas.meas(np.nanmean(tmp.x), np.nanstd(tmp.x)) if plot: f, axarr = plt.subplots(num_sources, num_dets, squeeze=0) for d in range(num_dets): for i in range(num_sources): tmp = data[i][0][d] print(d, i) print(ret[i, d]) axarr[i, d].errorbar(range(32), tmp.x, tmp.dx, ls='none') axarr[i, d].axhline(ret[i, d].x, c='r') plt.show() plt.close('all') return ret
num_peaks_to_detect = 6 if cut_strips: hitmap_label = None else: hitmap_label = 'no_cuts' exp1_secant_matrices = exp1_geometry.get_secant_matrices() peak_group_ranges = [[-np.inf, 2700], [2700, 2900], [2900, np.inf]] thresholds = [20, 20, 20] # for name in [ 'centered', 'moved', 'flat', 'angled' ] : # , 'det3_moved', 'det3_cent' ] : analysis_mgr = spec.dssd_analysis_manager(name, '../../../storage/', (32, 32), [1, 1, 1]) # primary_peaks = spec.write_peakdetect( analysis_mgr, primary_peak_detector, data_retriever, # num_peaks_to_detect ) primary_peaks = analysis_mgr.compute_primary_peaks( group_ranges, primary_peak_detector, num_peaks_to_detect=num_peaks_to_detect, primary_peak_detector=primary_peak_detector, plot=0, load=1) # primary_peaks = analysis_mgr.compute_primary_peaks( peak_group_ranges, thresholds, # load = 0, plot = 1 )
import numpy as np import matplotlib.pyplot as plt import scipy.stats as st from sklearn.neighbors.kde import KernelDensity import statsmodels.api as sm # data_name = 'full_bkgd_tot_cut' data_name = 'full_bkgd_tot' coords = (0, 16, 16) y_bottom = 1e-6 hist_bin_size = 10 kde_bandwidth = 1 mgr = spec.dssd_analysis_manager(data_name, '../../../storage', (32, 32), [1, 1, 1]) # coords = (0, 27, 16 ) data = mgr.get_data(*coords) print(data) x = np.arange(0, 3000, hist_bin_size) y, bin_edges = np.histogram(data, x) x = x[0:-1] # ax = plt.axes() f = plt.figure(figsize=(6, 7))
import jspectroscopy as spec import numpy as np import matplotlib.pyplot as plt import colorcet from mpl_toolkits.axes_grid1 import make_axes_locatable plt.rcParams["font.family"] = "Arial" plt.rcParams['mathtext.default'] = 'regular' savepath = '../../../../plots_important/sample_hitmaps.eps' analysis_mgr = spec.dssd_analysis_manager('full_bkgd_tot', '../../../../storage', (32, 32), [1, 1, 1]) hitmaps = analysis_mgr.load_dill('hitmaps') source_names = [r'$^{148}Gd$', r'$^{264}Cm$'] f, axarr = plt.subplots(2, 1, figsize=(4, 8)) f.suptitle('Source Hitmaps', fontsize=20) f.subplots_adjust(hspace=0.5) for i in range(2): idx = i + 1 axarr[i].set_title(source_names[i], fontsize=15) im = axarr[i].imshow(hitmaps[idx][0][3], cmap=colorcet.m_rainbow) divider = make_axes_locatable(axarr[i]) cax = divider.append_axes("right", size="5%", pad=0.05) f.colorbar(im, cax=cax)
for coords in data_to_remove : # print( coords ) dssd[ i,j,0, coords ] = meas.nan # np.set_printoptions(threshold=np.nan) # print( det_sectheta[0][0] ) # sys.exit(0) analysis_mgr = spec.dssd_analysis_manager( data_name, storage_path, (1,1), [1,1,1] ) cf249_energies = np.array( [ 5704, 5759.5, 5783.3, 5813.3, 5849.3 ] ) cf249_probs = np.array( [ 0.0003, 0.0469, 0.0026, 0.822, 0.01430 ] ) cf249_probs /= np.sum( cf249_probs ) # pu238_energies = np.array( [ 5704, 5759.5, 5783.3, 5813.3, 5849.3 ] ) # pu238_probs = np.array( [ 0.0003, 0.0469, 0.0026, 0.822, 0.01430 ] ) # pu238_probs /= np.sum( pu238_probs ) pu240_energies = np.array( [ 5123.68, 5168.17 ] ) pu240_probs = np.array( [ 0.2710, 0.7280 ] )
import jspectroscopy as spec import numpy as np import matplotlib.pyplot as plt import scipy.stats as st from sklearn.neighbors.kde import KernelDensity import statsmodels.api as sm use_kde = 0 y_bottom = 1e-6 hist_bin_size = 20 highres_bin_size = 2 kde_bandwidth = 1 db = spec.dssd_analysis_manager('full_bkgd_tot_cuts', '../../../storage', [1, 1, 1], (32, 32)) coords = (0, 16, 16) if not use_kde: data = db.get_data(*coords) x = np.arange(0, 3000, hist_bin_size) y, bin_edges = np.histogram(data, x) x = x[0:-1] x_fine = np.arange(0, 3000, highres_bin_size) y_fine, bin_edges_fine = np.histogram(data, x_fine) x_fine = x_fine[0:-1] # ax = plt.axes()
det_stopping_power_interp = None model_params = dl_estimator.deadlayer_model_params( disable_sources=0, vary_det_deadlayer=1, interp_det_stopping_power=1, interp_source_stopping_powers=0, fstrips_requested=np.arange(1, 31), bstrips=np.arange(15, 28), fix_source_deadlayers=None, one_source_constant=0, det_thickness=0, vary_source_thickness=0, constant_energy_offset=0) analysis_mgr = spec.dssd_analysis_manager('full_bkgd_tot', storage_path, (32, 32), [1, 1, 1]) # channels = analysis_mgr.load_dill( 'peaks' ) # peak_indices = [ [1], [0,1] ] # num_peaks_per_source = [ len( x ) for x in peak_indices ] channels = analysis_mgr.load_dill('means')[1:] # peak_indices = [ [0], [0] ] peak_indices = None det_sectheta = exp2_geometry.get_secant_matrices()[1:] source_sectheta = det_sectheta if peak_indices is not None: