Skip to content

Commit

Permalink
- list all available task / method settings
Browse files Browse the repository at this point in the history
  • Loading branch information
fbergmann committed Oct 11, 2024
1 parent cf7e244 commit 14359d7
Show file tree
Hide file tree
Showing 3 changed files with 3,298 additions and 0 deletions.
31 changes: 31 additions & 0 deletions basico/model_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -4927,6 +4927,37 @@ def _set_group_from_dict(group, values, dm=None):
logger.error('could not set value {0} for parameter {1}'.format(values[key], key))


def get_valid_methods(task, **kwargs):
"""Returns the valid methods for the given task
:param task: the task to get the valid methods for
:type task: COPASI.CCopasiTask or str
:param kwargs: optional parameters
- | `model`: to specify the data model to be used (if not specified
| the one from :func:`.get_current_model` will be taken)
:return: list of valid method names
:rtype: [str]
"""
dm = model_io.get_model_from_dict_or_default(kwargs)
assert (isinstance(dm, COPASI.CDataModel))
if not isinstance(task, COPASI.CCopasiTask):
name = task
task = dm.getTask(name)

if not isinstance(task, COPASI.CCopasiTask):
return []

methods = task.getValidMethods()
result = []
for i in range(len(methods)):
method = COPASI.CCopasiMethod.getSubTypeName(methods[i])
if method:
result.append(method)
return result

def get_task_settings(task, basic_only=True, **kwargs):
"""Returns the settings of the given task
Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ complexity of the underlying SWIG generated language bindings.
notebooks/Profile_likelihood
notebooks/MCA
notebooks/Working_with_Widgets
notebooks/AllTaskSettings

.. toctree::
:maxdepth: 2
Expand Down
Loading

0 comments on commit 14359d7

Please sign in to comment.