Skip to content

Commit 077d8de

Browse files
committed
add checks to get_model and get_data
1 parent 006c93a commit 077d8de

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

fooof/objs/fit.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,8 @@ def get_data(self, component='full', space='log'):
626626
With space set as 'linear', this combination holds in linear space.
627627
"""
628628

629+
if not self.has_data:
630+
raise NoDataError("No data available to fit, can not proceed.")
629631
assert space in ['linear', 'log'], "Input for 'space' invalid."
630632

631633
if component == 'full':
@@ -671,6 +673,8 @@ def get_model(self, component='full', space='log'):
671673
With space set as 'linear', this combination holds in linear space.
672674
"""
673675

676+
if not self.has_model:
677+
raise NoModelError("No model fit results are available, can not proceed.")
674678
assert space in ['linear', 'log'], "Input for 'space' invalid."
675679

676680
if component == 'full':

0 commit comments

Comments
 (0)