@@ -417,7 +417,7 @@ class LosslessPipeline:
417417
418418 Parameters
419419 ----------
420- config_fname : pathlib.Path
420+ config_path : pathlib.Path
421421 path to config file specifying the parameters to be used
422422 in the pipeline.
423423
@@ -429,7 +429,7 @@ class LosslessPipeline:
429429 :class:`~pylossless.flagging.FlaggedChs`,
430430 :class:`~pylossless.flagging.FlaggedEpochs`, and
431431 :class:`~pylossless.flagging.FlaggedICs`, respectively.
432- config_fname : pathlib.Path
432+ config_path : pathlib.Path
433433 path to the config file specifying the parameters to be used in the
434434 in the pipeline.
435435 config : dict
@@ -445,23 +445,31 @@ class LosslessPipeline:
445445 during the pipeline.
446446 """
447447
448- def __init__ (self , config_fname = None ):
448+ def __init__ (self , config_path = None , config = None ):
449449 """Initialize class.
450450
451451 Parameters
452452 ----------
453- config_fname : pathlib.Path
454- path to config file specifying the parameters to be used
455- in the pipeline.
453+ config_path : pathlib.Path | str | None
454+ Path to config file specifying the parameters to be used in the pipeline.
455+
456+ config : pylossless.config.Config | None
457+ :class:`pylossless.config.Config` object for the pipeline.
456458 """
457459 self .flags = {
458460 "ch" : FlaggedChs (self ),
459461 "epoch" : FlaggedEpochs (self ),
460462 "ic" : FlaggedICs (),
461463 }
462- self .config_fname = config_fname
463- if config_fname :
464+ if config :
465+ self .config = config
466+ if config_path is None :
467+ self .config_path = "._tmp_pylossless.yaml"
468+ elif config_path :
469+ self .config_path = Path (config_path )
464470 self .load_config ()
471+ else :
472+ self .config_path = None
465473 self .raw = None
466474 self .ica1 = None
467475 self .ica2 = None
@@ -483,13 +491,13 @@ def _repr_html_(self):
483491 ]
484492 flagged_times = _sum_flagged_times (self .raw , lossless_flags )
485493
486- config_fname = self .config_fname
494+ config_path = self .config_path
487495 raw = self .raw .filenames if self .raw else "Not specified"
488496
489497 html = "<h3>LosslessPipeline</h3>"
490498 html += "<table>"
491499 html += f"<tr><td><strong>Raw</strong></td><td>{ raw } </td></tr>"
492- html += f"<tr><td><strong>Config</strong></td><td>{ config_fname } </td></tr>"
500+ html += f"<tr><td><strong>Config</strong></td><td>{ config_path } </td></tr>"
493501 html += "</table>"
494502
495503 # Flagged Channels
@@ -518,9 +526,21 @@ def _repr_html_(self):
518526
519527 return html
520528
529+ @property
530+ def config_fname (self ):
531+ warn ('config_fname is deprecated and will be removed from future versions.' ,
532+ DeprecationWarning )
533+ return self .config_path
534+
535+ @config_fname .setter
536+ def config_fname (self , config_path ):
537+ warn ('config_fname is deprecated and will be removed from future versions.' ,
538+ DeprecationWarning )
539+ self .config_path = config_path
540+
521541 def load_config (self ):
522542 """Load the config file."""
523- self .config = Config ().read (self .config_fname )
543+ self .config = Config ().read (self .config_path )
524544
525545 def _check_sfreq (self ):
526546 """Make sure sampling frequency is an integer.
@@ -1215,7 +1235,7 @@ def load_ll_derivative(self, derivatives_path):
12151235 )
12161236 self .flags ["ic" ].load_tsv (iclabels_bidspath .fpath )
12171237
1218- self .config_fname = bpath .update (
1238+ self .config_path = bpath .update (
12191239 extension = ".yaml" , suffix = "ll_config" , check = False
12201240 )
12211241 self .load_config ()
0 commit comments