Skip to content

Commit

Permalink
add instruments_dict function in cellreader.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jepegit committed Jan 26, 2025
1 parent b591ac5 commit 0dac315
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion cellpy/readers/cellreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -6525,7 +6525,12 @@ def get(
summary_kwargs = summary_kwargs or {}
load_cellpy_file = False
logging_mode = "DEBUG" if testing else logging_mode
log.setup_logging(default_level=logging_mode, testing=testing, custom_log_dir=custom_log_dir, default_json_path=custom_log_config_path)
log.setup_logging(
default_level=logging_mode,
testing=testing,
custom_log_dir=custom_log_dir,
default_json_path=custom_log_config_path,
)
logging.debug("-------running-get--------")
cellpy_instance = CellpyCell(debug=debug, initialize=initialize)
logging.debug(f"created CellpyCell instance")
Expand Down Expand Up @@ -6701,6 +6706,28 @@ def _update_meta(
return cellpy_instance


def instruments_dict():
"""
Create a dictionary with the available instrument loaders.
The dictionary keys are the instrument names and the values are lists of the available models.
If no models are available, the list will be empty.
Returns:
dict: dictionary with the available instrument loaders.
"""
instruments = dict()
with warnings.catch_warnings():
warnings.simplefilter("ignore")
for name, value in core.instrument_configurations().items():
instruments[name] = []
instrument_models = value["__all__"].copy()
instrument_models.remove("default")
if len(instrument_models) > 0:
instruments[name].extend(instrument_models)
return instruments


def print_instruments():
"""Prints out the available instrument loaders and their models."""
print(80 * "=")
Expand Down

0 comments on commit 0dac315

Please sign in to comment.