Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
be202ce
Add krmap functions
mcidlaso Dec 18, 2025
f5e80e7
Add correction functions
mcidlaso Dec 18, 2025
639c67c
Add selection functions
mcidlaso Dec 18, 2025
196bb7d
Add test functions for correction functions
mcidlaso Dec 18, 2025
0ee5db0
Add lifetime fit and drift velocity functions
mcidlaso Dec 18, 2025
27c2632
Add tests functions for the krmap functions
mcidlaso Dec 19, 2025
7e66555
Add tests functions for the krmap functions
mcidlaso Dec 19, 2025
7ae012e
correct error
mcidlaso Dec 22, 2025
b4ee6fb
Correct error
mcidlaso Dec 22, 2025
4ee1dd5
Correct error again
mcidlaso Dec 22, 2025
bf7c147
correct all errors
mcidlaso Dec 22, 2025
3984730
correct error
mcidlaso Dec 22, 2025
5f9baea
Drop dropna() from normalization function
mcidlaso Jan 16, 2026
a79497b
Add optional parameters in a single argument
mcidlaso Jan 16, 2026
b4b0895
Import functions for creating krmaps and t_evol in the same file
mcidlaso Jan 16, 2026
0023370
Change description and correct create_empty_map function
mcidlaso Jan 16, 2026
846c8be
Change name and add explanation comment in get_median() function
mcidlaso Jan 16, 2026
405d528
Change function and variables names in gaussian_fit function
mcidlaso Jan 16, 2026
5c0f4c0
Change function name from map_3D_fits to fit_map
mcidlaso Jan 16, 2026
c4e94ea
Changes in fit_map function
mcidlaso Jan 16, 2026
a86acf4
Add description for merge_maps function
mcidlaso Jan 16, 2026
068f521
Change variable name for krmap in include_coordinates function
mcidlaso Jan 16, 2026
ee5480c
Change variable and function names in compute_3D_map function
mcidlaso Jan 16, 2026
27065c5
Add function to get map info (metadata)
mcidlaso Jan 16, 2026
45f640c
Add functions (from icaros/krcal/core/fit_functions.py) to do fits
mcidlaso Jan 16, 2026
80eec15
Add function to divide dataframe into time slices
mcidlaso Jan 16, 2026
d3095fe
Add function to calculate time evolution parameters
mcidlaso Jan 16, 2026
fffafe1
Add function to save map
mcidlaso Jan 16, 2026
de04df5
Simplify select_lifetime_region function
mcidlaso Jan 16, 2026
9b9fcf6
Change LT_fit function to use fit function from IC
mcidlaso Jan 16, 2026
e9b9e6f
Comment print
mcidlaso Jan 16, 2026
e9e53d2
Change and move eff_of_sel function
mcidlaso Jan 16, 2026
e62aab7
Change load_files to be more straightforward
mcidlaso Jan 16, 2026
fdee97e
Move and change line in eff_of_selection function
mcidlaso Jan 16, 2026
1a485fe
Add line in apply_correctionmap function so the corrected kdst ends u…
mcidlaso Jan 16, 2026
9d6d21a
Use in_range function from IC
mcidlaso Jan 16, 2026
68ed946
Add comment explaining the function and change variable name
mcidlaso Jan 16, 2026
3efa220
Remove range_S2t variable
mcidlaso Jan 16, 2026
6f9a9e5
Use in_range function from IC
mcidlaso Jan 16, 2026
2d43137
Change order on selections and correct typo
mcidlaso Jan 16, 2026
2185eca
Change column names so we don't get a warning when using df_writer
mcidlaso Jan 16, 2026
92023cb
Create test for lifetime and drift velocity
mcidlaso Jan 19, 2026
f5eed65
Change test names to be more explicit
mcidlaso Jan 19, 2026
627315e
Change function names, remove one line and remove dtype = int
mcidlaso Jan 19, 2026
91432d5
Remove comment
mcidlaso Jan 19, 2026
02a4991
Change function that computes metadata
mcidlaso Jan 19, 2026
23319f7
Change function that saves maps so it doesn't raise an error when ope…
mcidlaso Jan 19, 2026
9cee111
Monitoring function to plot time evolution parameters
mcidlaso Jan 19, 2026
7dbcb49
Change function so the yranges of the plots depend on the values of t…
mcidlaso Jan 19, 2026
9d210dd
Import functions with the right name
mcidlaso Jan 20, 2026
cb216df
Import functions to make tests and change one line in test_method_norm()
mcidlaso Jan 20, 2026
c547809
Add test for apply_3Dmap function
mcidlaso Jan 20, 2026
b8f494e
Add one comment
mcidlaso Jan 20, 2026
75679e9
Add control plots functions
mcidlaso Jan 20, 2026
47af789
Added run numbers, bins for each variable and put ylimits in one plot
mcidlaso Jan 20, 2026
5368c9a
Added normalization methods to calculate the median values of mu
mcidlaso Jan 20, 2026
f3b15bf
Corrected name error in get_time_evol function and now the resolution…
mcidlaso Jan 20, 2026
71a963e
Added functions to append multiple time evolutions from different run…
mcidlaso Jan 20, 2026
d389b96
Removed run_number variable because it wasnt being used
mcidlaso Jan 20, 2026
032a630
Correct typo
mcidlaso Jan 20, 2026
56eb4b9
Include median in normalization function test
mcidlaso Jan 20, 2026
b4c71bc
Remove monitoring functions
mcidlaso Jan 23, 2026
f90f08d
Fix usage of dropna in normalization function
mcidlaso Jan 23, 2026
47a16b0
Use in_range to define xy region
mcidlaso Jan 23, 2026
8658595
Add NormMethod class to symbols.py
mcidlaso Jan 23, 2026
e3eba95
Import and use NormMethod class in normalization function
mcidlaso Jan 23, 2026
512ef7f
Correct error in gaussian_fit function
mcidlaso Jan 23, 2026
c5c9cc2
Use in_range function
mcidlaso Jan 23, 2026
cf4de44
Import new functions and create test for gauss seed
mcidlaso Jan 28, 2026
3c356f9
Create test for gauss seed
mcidlaso Jan 28, 2026
e642ad1
Redefined kr_map in normalization function so it doesn't contain nan …
mcidlaso Jan 30, 2026
001cd33
Move apply_correctionmap function from selection_functions to correct…
mcidlaso Jan 30, 2026
b7d5d24
Import functions and change test_method_norm to match the changes in …
mcidlaso Jan 30, 2026
f7edf5e
Fix mu value so it doesn't raise a warning when j = 0 (mu = 0) in tes…
mcidlaso Jan 30, 2026
85b85f4
Create test to check correction factor in apply_3Dmap function and to…
mcidlaso Jan 30, 2026
4b8edd3
Import more functions and change name in get_median() function from m…
mcidlaso Jan 30, 2026
48c6e8f
Change include_coordinates function so dt, x, y values are actually t…
mcidlaso Jan 30, 2026
939f0e9
Change way of defining dtbins, xbins and ybins in compute_metadata
mcidlaso Jan 30, 2026
1a5a171
Change definitions of x_max, sigma and amp (area) in gauss_seed becau…
mcidlaso Jan 30, 2026
846d335
Rewrote conditions for using poisson_sigma() in quick_gauss_fit()
mcidlaso Jan 30, 2026
bb7ec9f
Use in_range in create_time_slices (are we going to move this functio…
mcidlaso Jan 30, 2026
3939155
Added tests for create_empty_map function and corrected get_median fu…
mcidlaso Jan 30, 2026
5dd849d
More corrections on get_median functions tests to match the changes d…
mcidlaso Jan 30, 2026
1003ae3
Added more tests for get_median and gaussian_fit functions (+ some co…
mcidlaso Jan 30, 2026
c46b50c
Added test for fit_map function
mcidlaso Jan 30, 2026
4afecd2
Test for merge_maps() function
mcidlaso Jan 30, 2026
7e0745b
Tests for include_coordinates function
mcidlaso Jan 30, 2026
bd28fd4
Test for checking the columns of the output of compute_metadata
mcidlaso Jan 30, 2026
c72a63c
Test to check that quick_gauss_fit does the right fit
mcidlaso Jan 30, 2026
0386487
Test for create_time_slices function
mcidlaso Jan 30, 2026
dbe8445
More tests for get_time_evol and append_time_evol functions
mcidlaso Jan 30, 2026
9e30114
Rewrote select_lifetime_region to use symbols. Removed LT_fit functio…
mcidlaso Jan 30, 2026
150ef70
Changed compute_drift_v function to include nbins and dtrange in a si…
mcidlaso Jan 30, 2026
22cefef
Added functions to test select_lifetime_region for circle and square …
mcidlaso Jan 30, 2026
4e7b66d
Moved apply_correctionmap to correction_functions.py, removed functio…
mcidlaso Jan 30, 2026
ef5a3c4
Added class function to select region where to calculate lifetime
mcidlaso Jan 30, 2026
82882c9
Redefine old variables df2 and df1 since there was no need to define …
mcidlaso Jan 30, 2026
1acf315
Use df2 and df1 instead of df
mcidlaso Jan 30, 2026
c86b815
Change selection mask in monitor_kr_distribution to include DT and S2…
mcidlaso Jan 30, 2026
54e6e36
Rewrite plot_Ec function so the inputs are the column names that you …
mcidlaso Jan 30, 2026
b56fb5f
Defined a new function to make selections in general, removed load_fi…
mcidlaso Jan 30, 2026
74e61fe
Move sigmoid function from lifetime_vdrift_functions to invisible_cit…
mcidlaso Jan 30, 2026
6b3b44e
Correct errors in select_var_inrange
mcidlaso Jan 30, 2026
c94afb0
Move sigmoid function from lifetime_vdrift_functions to invisible_cit…
mcidlaso Jan 30, 2026
4cd0ee1
Moved gauss_seed function to appear before in krmap_functions, modifi…
mcidlaso Feb 2, 2026
2b6125e
Modified comments in merge_maps, change name of arguments in compute_…
mcidlaso Feb 2, 2026
c50a67a
Removed norm_method from metadata. Added xy_range, dt_range
mcidlaso Feb 2, 2026
18e3876
Changed name of arguments in get_time_evol, removed p0 from args and …
mcidlaso Feb 2, 2026
1d2c5be
Now this assertion is not true because we changed sigma in get_median…
mcidlaso Feb 2, 2026
a041374
Change args names to match the changes done in gaussian_fit()
mcidlaso Feb 2, 2026
1a2ab63
Removed norm_method and added xy_range, dt_range in test_metadata_column
mcidlaso Feb 2, 2026
b494ad3
Change tests for get_time_evol and append_time_evol to match the chan…
mcidlaso Feb 2, 2026
90cc3f3
Add test for save_map function
mcidlaso Feb 2, 2026
4582edf
Remove some comments and import sigmoid function from fit_functions i…
mcidlaso Feb 2, 2026
597eb9f
Add more tests to check the values inside the selected lifetime regio…
mcidlaso Feb 2, 2026
bddeda7
Added tests for sigmoid function in invisible_cities/core/fit_functio…
mcidlaso Feb 2, 2026
4459fff
Changed comment in select_1S1_1S2
mcidlaso Feb 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions invisible_cities/core/fit_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,36 @@ def power(x, const, pow_):
return const * np.power(x, pow_)


def sigmoid(x : np.array,
scale : float,
inflection : float,
slope : float,
offset : float)->np.array:
'''
Sigmoid function, it computes the sigmoid of the input array x using the specified
parameters for scaling, inflection point, slope, and offset.
Parameters
----------
x : np.array
The input array.
scale : float
The scaling factor determining the maximum value of the sigmoid function.
inflection : float
The x-value of the sigmoid's inflection point (where the function value is half of the scale).
slope : float
The slope parameter that controls the steepness of the sigmoid curve.
offset : float
The vertical offset added to the sigmoid function.
Returns
-------
np.array
Array of computed sigmoid values for x array.
'''
sigmoid = scale / (1 + np.exp(-slope * (x - inflection))) + offset
return sigmoid



# ###########################################################
# Tools
def fit(func, x, y, seed=(), fit_range=None, **kwargs):
Expand Down
28 changes: 28 additions & 0 deletions invisible_cities/core/fit_functions_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,34 @@ def test_power_at_zero(a, b):
0.)


def test_sigmoid_inflection_point(): #en x = inflection, sigm(x) = scale/2 + offset
x = np.array(10)
scale = 2
inflection = 10
slope = 2
offset = 1.5

y = fitf.sigmoid(x, scale, inflection, slope, offset)

expected_sigm = 0.5*scale + offset

assert np.isclose(y, expected_sigm)


def test_sigmoid_monotonically_increasing(): #todos los incrementos en y > 0
x = np.linspace(-10, 10, 100)
y = fitf.sigmoid(x, scale = 1, inflection = 0, slope = 1, offset = 0)

assert np.all(np.diff(y) >= 0)


def test_sigmoid_shape(): ##input shape = output shape
x = np.linspace(-10, 10, 100)
y = fitf.sigmoid(x, scale = 1, inflection = 0, slope = 1, offset = 0)

assert y.shape == x.shape


@mark.parametrize(" fn pars ".split(),
((fitf.gauss , (3.0, 2.0, 0.50)),
(fitf.expo , (6.0, 1.5)),
Expand Down
Loading
Loading