-
Notifications
You must be signed in to change notification settings - Fork 77
Add functions to get 3D krypton maps #948
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 47 commits
be202ce
f5e80e7
639c67c
196bb7d
0ee5db0
27c2632
7e66555
7ae012e
b4ee6fb
4ee1dd5
bf7c147
3984730
5f9baea
a79497b
b4b0895
0023370
846c8be
405d528
5c0f4c0
c4e94ea
a86acf4
068f521
ee5480c
27065c5
45f640c
80eec15
d3095fe
fffafe1
de04df5
9b9fcf6
e9b9e6f
e9e53d2
e62aab7
fdee97e
1a485fe
9d6d21a
68ed946
3efa220
6f9a9e5
2d43137
2185eca
92023cb
f5eed65
627315e
91432d5
02a4991
23319f7
9cee111
7dbcb49
9d210dd
cb216df
c547809
b8f494e
75679e9
47af789
5368c9a
f3b15bf
71a963e
d389b96
032a630
56eb4b9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| import pandas as pd | ||
| import numpy as np | ||
| from scipy.interpolate import griddata | ||
|
|
||
|
|
||
| def normalization(krmap, method, xy_params = None): | ||
|
|
||
| mu_values = krmap.mu.dropna() | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| if method == 'max': | ||
| E_reference_max = mu_values.max() | ||
| return E_reference_max | ||
|
|
||
| if method == 'mean chamber': | ||
| E_reference_chamber = mu_values.mean() | ||
| return E_reference_chamber | ||
|
|
||
| if method == 'mean anode': | ||
| mu_values_anode = krmap[krmap.k == 0].mu | ||
| E_reference_anode = mu_values_anode.mean() | ||
| return E_reference_anode | ||
|
|
||
| mask_region = (krmap['x'] <= xy_params['x_high']) & (krmap['x'] >= xy_params['x_low']) & (krmap['y'] <= xy_params['y_high']) & (krmap['y'] >= xy_params['y_low']) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use |
||
|
|
||
| if method == 'mean region anode': | ||
| region = krmap[krmap.k == 0][mask_region] | ||
| E_reference_slice_anode = region.mu.mean() | ||
| return E_reference_slice_anode | ||
|
|
||
| if method == 'mean region chamber': | ||
| region = krmap[mask_region] | ||
| E_reference_region = region.mu.mean() | ||
| return E_reference_region | ||
|
|
||
|
|
||
| def apply_3Dmap(krmap, norm_method, dt, x, y, E, xy_params = None, keV = False): | ||
|
|
||
| map_points = krmap['dt x y'.split()].values | ||
| norm = normalization(krmap, norm_method, xy_params) | ||
|
|
||
| data_points = np.stack([dt, x, y], axis = 1) | ||
| E_interpolated_data = griddata(map_points, krmap.mu.values, data_points, method = 'nearest') | ||
|
|
||
| correction_factor = norm/E_interpolated_data | ||
| Ec = E * correction_factor | ||
|
|
||
| if keV: | ||
| Ec = Ec * (41.55 / norm) | ||
|
|
||
| return Ec | ||
|
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,43 @@ | ||||||||||||||
| import numpy as np | ||||||||||||||
| import matplotlib.pyplot as plt | ||||||||||||||
| import pandas as pd | ||||||||||||||
| from correction_functions import normalization | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| def test_method_norm(): | ||||||||||||||
|
|
||||||||||||||
| k_vals = np.arange(10) | ||||||||||||||
| i_vals = np.arange(12) | ||||||||||||||
| j_vals = np.arange(12) | ||||||||||||||
|
|
||||||||||||||
| 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 = 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')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in_range
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will discuss how to do this with symbols