@@ -63,6 +63,9 @@ class Extractor:
6363 Ex axis (particle detector resolution). Defaults to 150 keV
6464 rel_err_missing (float): Relative error used for points that cannot be
6565 estimated by error_estimator object.
66+ suppress_warning (bool): Suppress warnings. The warnings are usually
67+ expected. Set this attribute to `True` in order to avoid enourmous
68+ amounts of warnings in your notebooks.
6669
6770
6871 TODO:
@@ -105,6 +108,7 @@ def __init__(self, ensemble: Optional[Ensemble] = None,
105108 self .resolution_Ex = 150 # keV
106109
107110 self .rel_err_missing = 0.3
111+ self .suppress_warning = False
108112
109113 def __call__ (self , ensemble : Optional [Ensemble ] = None ,
110114 trapezoid : Optional [Action ] = None ):
@@ -572,18 +576,20 @@ def check_unconstrained_results(self) -> bool:
572576 for i , vec in enumerate (self .nld ):
573577 if np .isnan (vec .values ).any ():
574578 contains_nan = True
575- LOG .warning (f"nld #{ i } contains nan's.\n "
576- "Consider removing them e.g. with:\n "
577- "# for nld in extractor.nld:\n "
578- "# nld.cut_nan()\n " )
579+ if not self .suppress_warning :
580+ LOG .warning (f"nld #{ i } contains nan's.\n "
581+ "Consider removing them e.g. with:\n "
582+ "# for nld in extractor.nld:\n "
583+ "# nld.cut_nan()\n " )
579584
580585 for i , vec in enumerate (self .nld ):
581586 if np .isnan (vec .values ).any ():
582587 contains_nan = True
583- LOG .warning (f"gsf #{ i } contains nan's.\n "
584- "Consider removing them e.g. with:\n "
585- "# for gsf in extractor.gsf:\n "
586- "# gsf.cut_nan()\n " )
588+ if not self .suppress_warning :
589+ LOG .warning (f"gsf #{ i } contains nan's.\n "
590+ "Consider removing them e.g. with:\n "
591+ "# for gsf in extractor.gsf:\n "
592+ "# gsf.cut_nan()\n " )
587593
588594 return contains_nan
589595
0 commit comments