4
4
from copy import copy
5
5
6
6
from ..__about__ import __version__
7
- from ..detail .utilities import replace_key_aliases
7
+ from ..detail .utilities import find_stack_level , replace_key_aliases
8
8
from .detail .peakfinding import _sum_track_signal
9
9
from ..population .dwelltime import DwelltimeModel
10
10
from .detail .msd_estimation import *
@@ -191,7 +191,7 @@ def import_kymotrackgroup_from_csv(filename, kymo, channel, delimiter=";"):
191
191
"File contains non-integer time indices; round-off errors may have occurred "
192
192
"when loading the data"
193
193
),
194
- stacklevel = 2 ,
194
+ stacklevel = find_stack_level () ,
195
195
)
196
196
197
197
def create_track (time , coord , min_length = None ):
@@ -551,7 +551,7 @@ def sample_from_image(self, num_pixels, reduce=np.sum, *, correct_origin=None):
551
551
"ensure backward compatibility. To silence this warning use "
552
552
"`correct_origin=False`."
553
553
),
554
- stacklevel = 2 ,
554
+ stacklevel = find_stack_level () ,
555
555
)
556
556
557
557
# Time and coordinates are being cast to an integer since we use them to index into a data
@@ -863,7 +863,8 @@ def estimate_diffusion(
863
863
RuntimeWarning (
864
864
"Motion blur cannot be taken into account for this type of Kymo. As a "
865
865
"consequence, not all estimates will be available."
866
- )
866
+ ),
867
+ stacklevel = find_stack_level (),
867
868
)
868
869
blur = np .nan
869
870
@@ -1574,7 +1575,8 @@ def fit_binding_times(
1574
1575
"warning, but use the deprecated behavior use `observed_minimum=True`. To "
1575
1576
"enable the recommended method of estimating the minimum observable dwell "
1576
1577
"time use `observed_minimum=False`."
1577
- )
1578
+ ),
1579
+ stacklevel = find_stack_level (),
1578
1580
)
1579
1581
observed_minimum = True
1580
1582
@@ -1589,7 +1591,8 @@ def fit_binding_times(
1589
1591
"version of Pylake (`2.0.0`), using the discrete model will become the "
1590
1592
"default. Until then, the continuous model is still used for backward "
1591
1593
"compatibility."
1592
- )
1594
+ ),
1595
+ stack_level = find_stack_level (),
1593
1596
)
1594
1597
discrete_model = False
1595
1598
@@ -1618,7 +1621,7 @@ def fit_binding_times(
1618
1621
"dropped from the analysis. If you wish to not see this warning, filter the "
1619
1622
"tracks with `lk.filter_tracks` with a minimum length of 2 samples."
1620
1623
),
1621
- stacklevel = 2 ,
1624
+ stacklevel = find_stack_level () ,
1622
1625
)
1623
1626
1624
1627
if dwelltimes .size == 0 :
@@ -1802,10 +1805,11 @@ def estimate_diffusion(self, method, *args, min_length=None, **kwargs):
1802
1805
1803
1806
if n_discarded and min_length is None :
1804
1807
warnings .warn (
1805
- f"{ n_discarded } tracks were shorter than the specified min_length "
1806
- "and discarded from the analysis." ,
1807
- RuntimeWarning ,
1808
- stacklevel = 2 ,
1808
+ RuntimeWarning (
1809
+ f"{ n_discarded } tracks were shorter than the specified min_length and "
1810
+ f"discarded from the analysis." ,
1811
+ ),
1812
+ stacklevel = find_stack_level (),
1809
1813
)
1810
1814
1811
1815
return [k .estimate_diffusion (method , * args , ** kwargs ) for k in filtered_tracks ]
@@ -1866,6 +1870,7 @@ def ensemble_diffusion(self, method, *, max_lag=None):
1866
1870
"Localization variances cannot be reliably calculated for an ensemble of "
1867
1871
"tracks from kymographs with different line times or pixel sizes."
1868
1872
),
1873
+ stacklevel = find_stack_level (),
1869
1874
)
1870
1875
is_valid = False
1871
1876
return ensemble_cve (self , calculate_localization_var = is_valid )
0 commit comments