@@ -457,6 +457,7 @@ def __init__(self, config_path=None, config=None):
457457 config : pylossless.config.Config | None
458458 :class:`pylossless.config.Config` object for the pipeline.
459459 """
460+ self .bids_path = None
460461 self .flags = {
461462 "ch" : FlaggedChs (self ),
462463 "epoch" : FlaggedEpochs (self ),
@@ -1060,7 +1061,7 @@ def flag_noisy_ics(self):
10601061
10611062 # icsd_epoch_flags=padflags(raw, icsd_epoch_flags,1,'value',.5);
10621063
1063- def save (self , derivatives_path , overwrite = False , format = "EDF" , event_id = None ):
1064+ def save (self , derivatives_path = None , overwrite = False , format = "EDF" , event_id = None ):
10641065 """Save the file at the end of the pipeline.
10651066
10661067 Parameters
@@ -1075,6 +1076,10 @@ def save(self, derivatives_path, overwrite=False, format="EDF", event_id=None):
10751076 event_id : dict | None (default None)
10761077 Dictionary mapping annotation descriptions to event codes.
10771078 """
1079+
1080+ if derivatives_path is None :
1081+ derivatives_path = self .get_derivative_path (self .bids_path )
1082+
10781083 mne_bids .write_raw_bids (
10791084 self .raw ,
10801085 derivatives_path ,
@@ -1121,22 +1126,17 @@ def filter(self):
11211126 # 5.a. Filter lowpass/highpass
11221127 self .raw .filter (** self .config ["filtering" ]["filter_args" ])
11231128
1129+ # 5.b. Filter notch
11241130 if "notch_filter_args" in self .config ["filtering" ]:
11251131 notch_args = self .config ["filtering" ]["notch_filter_args" ]
1126- # in raw.notch_filter, freqs=None is ok if method=spectrum_fit
1127- if not notch_args ["freqs" ] and "method" not in notch_args :
1128- logger .info ("No notch filter arguments provided. Skipping" )
1129- else :
1132+ spectrum_fit_method = (
1133+ "method" in notch_args and notch_args ["method" ] == "spectrum_fit"
1134+ )
1135+ if notch_args ["freqs" ] or spectrum_fit_method :
1136+ # in raw.notch_filter, freqs=None is ok if method=='spectrum_fit'
11301137 self .raw .notch_filter (** notch_args )
1131-
1132- # 5.b. Filter notch
1133- notch_args = self .config ["filtering" ]["notch_filter_args" ]
1134- spectrum_fit_method = (
1135- "method" in notch_args and notch_args ["method" ] == "spectrum_fit"
1136- )
1137- if notch_args ["freqs" ] or spectrum_fit_method :
1138- # in raw.notch_filter, freqs=None is ok if method=='spectrum_fit'
1139- self .raw .notch_filter (** notch_args )
1138+ else :
1139+ logger .info ("No notch filter arguments provided. Skipping" )
11401140 else :
11411141 logger .info ("No notch filter arguments provided. Skipping" )
11421142
0 commit comments