Add functions to get 3D krypton maps#948
Conversation
|
|
||
|
|
||
|
|
||
| def normalization(krmap, method, x_low, x_high, y_low, y_high): |
There was a problem hiding this comment.
The last 4 parameters need to be optional, since they are only relevant for method == "region". I also think it would be interesting to gather them in a dictionary to simplify the logic.
|
|
||
| def normalization(krmap, method, x_low, x_high, y_low, y_high): | ||
|
|
||
| mu_values = krmap.mu |
There was a problem hiding this comment.
since you are doing .dropna() everywhere, you can do it here already
| k, i, j = np.meshgrid(k_vals, i_vals, j_vals, indexing='ij') | ||
| k = k.ravel() | ||
| i = i.ravel() | ||
| j = j.ravel() |
There was a problem hiding this comment.
| k, i, j = np.meshgrid(k_vals, i_vals, j_vals, indexing='ij') | |
| k = k.ravel() | |
| i = i.ravel() | |
| j = j.ravel() | |
| k, i, j = map(np.ravel, | |
| np.meshgrid(k_vals, i_vals, j_vals, indexing='ij')) |
|
|
||
| """ | ||
|
|
||
| def create_NaN_map(xy_range, dt_range, xy_nbins, dt_nbins): |
There was a problem hiding this comment.
| def create_NaN_map(xy_range, dt_range, xy_nbins, dt_nbins): | |
| def create_empty_map(xy_range, dt_range, xy_nbins, dt_nbins): |
| xy_bins = np.linspace(xy_range[0], xy_range[1], xy_nbins + 1) | ||
| dt_bins = np.linspace(dt_range[0], dt_range[1], dt_nbins + 1) | ||
|
|
||
| #shift to bin centers invisible_cities.core.core_functions | ||
|
|
||
| i_range = np.arange(0, len(xy_bins)-1) | ||
| j_range = np.arange(0, len(xy_bins)-1) | ||
| k_range = np.arange(0, len(dt_bins)-1) |
There was a problem hiding this comment.
xy_bins and dt_bins are only used to compute their length, which are given by the variables xy_nbins and dt_nbins
| range_S2t = (low_S2t, high_S2t) | ||
| sel_S2t = in_range(kdst.S2t, *range_S2t) |
There was a problem hiding this comment.
| range_S2t = (low_S2t, high_S2t) | |
| sel_S2t = in_range(kdst.S2t, *range_S2t) | |
| sel_S2t = in_range(kdst.S2t, low_S2t, high_S2t) |
|
|
||
|
|
||
| def select_DTrange(kdst, low_DT, high_DT): | ||
| df_DTrange = kdst[(kdst.DT >= low_DT) & (kdst.DT <= high_DT)] |
|
|
||
|
|
||
| def select_nsipm(kdst, low_nsipm, high_nsipm): | ||
| sel_nsipm = (kdst.Nsipm >= low_nsipm) & (kdst.Nsipm <= high_nsipm) |
| d = {'eff diffusion band': [eff_DT], 'eff X rays': [eff_Xrays], 'eff 1S1 & 1S2': [eff_1S1_1S2], | ||
| 'eff S2 trigger time': [eff_S2t], 'eff Rmax': [eff_Rmax], 'eff range DT': [eff_DTrange], | ||
| 'eff number of SiPMS': [eff_nsipm], 'total efficiency': [total_eff]} | ||
|
|
||
| df_efficiencies = pd.DataFrame(data = d) |
There was a problem hiding this comment.
You can also have numbers in the dictionary (instead of lists of 1 element) and then add index=[0] when creating the dataframe
…tests and some corrections
… time evol at once
…ol because the respective functions were removed or changed
…y with S2e. Had to change the respective tests
These scripts contain functions to: