4545_debug : bool
4646 Whether the object is set in debug mode.
4747 This should be controlled by using the `set_debug_mode` method.
48- _check_data : bool
49- Whether to check added data for NaN or Inf values, and fail out if present.
50- This should be controlled by using the `set_check_data_mode` method.
48+ _check_data, _check_freqs : bool
49+ Whether to check added inputs for incorrect inputs, failing if present.
50+ Frequency data is checked for linear spacing.
51+ Power values are checked for data for NaN or Inf values.
52+ These modes default to True, and can be controlled with the `set_check_modes` method.
5153
5254Code Notes
5355----------
7678from fooof .plts .fm import plot_fm
7779from fooof .utils .data import trim_spectrum
7880from fooof .utils .params import compute_gauss_std
79- from fooof .data import FOOOFResults , FOOOFSettings , FOOOFMetaData
81+ from fooof .data import FOOOFSettings , FOOOFRunModes , FOOOFMetaData , FOOOFResults
8082from fooof .data .conversions import model_to_dataframe
8183from fooof .sim .gen import gen_freqs , gen_aperiodic , gen_periodic , gen_model
8284
@@ -199,7 +201,7 @@ def __init__(self, peak_width_limits=(0.5, 12.0), max_n_peaks=np.inf, min_peak_h
199201 # Set default debug mode - controls if an error is raised if model fitting is unsuccessful
200202 self ._debug = False
201203 # Set default data checking modes - controls which checks get run on input data
202- # check_freqs: check the frequency values, and raises an error for uneven spacing
204+ # check_freqs: checks the frequency values, and raises an error for uneven spacing
203205 self ._check_freqs = True
204206 # check_data: checks the power values and raises an error for any NaN / Inf values
205207 self ._check_data = True
@@ -568,6 +570,19 @@ def get_settings(self):
568570 for key in OBJ_DESC ['settings' ]})
569571
570572
573+ def get_run_modes (self ):
574+ """Return run modes of the current object.
575+
576+ Returns
577+ -------
578+ FOOOFRunModes
579+ Object containing the run modes from the current object.
580+ """
581+
582+ return FOOOFRunModes (** {key .strip ('_' ) : getattr (self , key ) \
583+ for key in OBJ_DESC ['run_modes' ]})
584+
585+
571586 def get_meta_data (self ):
572587 """Return data information from the current object.
573588
@@ -723,6 +738,24 @@ def set_debug_mode(self, debug):
723738 self ._debug = debug
724739
725740
741+ def set_check_modes (self , check_freqs = None , check_data = None ):
742+ """Set check modes, which controls if an error is raised based on check on the inputs.
743+
744+ Parameters
745+ ----------
746+ check_freqs : bool, optional
747+ Whether to run in check freqs mode, which checks the frequency data.
748+ check_data : bool, optional
749+ Whether to run in check data mode, which checks the power spectrum values data.
750+ """
751+
752+ if check_freqs is not None :
753+ self ._check_freqs = check_freqs
754+ if check_data is not None :
755+ self ._check_data = check_data
756+
757+
758+ # This kept for backwards compatibility, but to be removed in 2.0 in favor of `set_check_modes`
726759 def set_check_data_mode (self , check_data ):
727760 """Set check data mode, which controls if an error is raised if NaN or Inf data are added.
728761
@@ -732,7 +765,24 @@ def set_check_data_mode(self, check_data):
732765 Whether to run in check data mode.
733766 """
734767
735- self ._check_data = check_data
768+ self .set_check_modes (check_data = check_data )
769+
770+
771+ def set_run_modes (self , debug , check_freqs , check_data ):
772+ """Simultaneously set all run modes.
773+
774+ Parameters
775+ ----------
776+ debug : bool
777+ Whether to run in debug mode.
778+ check_freqs : bool
779+ Whether to run in check freqs mode.
780+ check_data : bool
781+ Whether to run in check data mode.
782+ """
783+
784+ self .set_debug_mode (debug )
785+ self .set_check_modes (check_freqs , check_data )
736786
737787
738788 def to_df (self , peak_org ):
0 commit comments