Skip to content

Commit b496e8e

Browse files
committed
separate out makemodeID from runmodeID
1 parent 4306a42 commit b496e8e

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

pbjam/core.py

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,12 +326,11 @@ def __init__(self, name, f, s, obs, outpath=None, **kwargs):
326326
assert isinstance(val, Iterable), 'Entries in obs must be of the form (value, error)'
327327
assert len(val) == 2, 'Entries in obs must be of the form (value, error)'
328328

329-
def runModeID(self, modeID_kwargs={}):
329+
def makeModeID(self, **modeID_kwargs):
330330
""" Run the mode identification process using the provided or default keyword arguments.
331331
332-
This method creates a `modeID` instance and executes it with the arguments provided in
333-
`modeID_kwargs` or from the current object's attributes. If `priorpath` is not specified,
334-
it fetches the path to the prior file.
332+
This method creates a `modeID` instance ONLY. This function is for advanced usage only;
333+
it is automatically called when running star.runModeID().
335334
336335
Parameters
337336
----------
@@ -356,6 +355,26 @@ def runModeID(self, modeID_kwargs={}):
356355

357356
self.modeID = modeID(**_modeID_kwargs)
358357

358+
def runModeID(self, modeID_kwargs={}):
359+
""" Run the mode identification process using the provided or default keyword arguments.
360+
361+
This method creates a `modeID` instance and executes it with the arguments provided in
362+
`modeID_kwargs` or from the current object's attributes. If `priorpath` is not specified,
363+
it fetches the path to the prior file.
364+
365+
Parameters
366+
----------
367+
modeID_kwargs : dict, optional
368+
Dictionary of additional keyword arguments to update or override the current object's attributes
369+
when initializing the `modeID` instance. Default is an empty dictionary.
370+
371+
Raises
372+
------
373+
KeyError
374+
If required parameters for mode identification are missing.
375+
"""
376+
if not hasattr(self, "modeID"):
377+
self.makeModeID(**modeID_kwargs)
359378
self.modeID(**_modeID_kwargs)
360379

361380
def runPeakbag(self, peakbag_kwargs={}):

0 commit comments

Comments
 (0)