diff --git a/Readme.rst b/Readme.rst index 36439fc..bfeda12 100644 --- a/Readme.rst +++ b/Readme.rst @@ -14,6 +14,14 @@ You can install igor2 via pip:: pip install igor2 +The commands `igorbinarywave` and `igorpackedexperiment` are currently +not properly implemented (see https://github.com/AFM-analysis/igor2/issues/6), +but it should be straight-forward to fix this. + +To install igor2 with the command-line interface (CLI), run:: + + pip install igor2[CLI] + Usage ----- diff --git a/igor2/script.py b/igor2/cli/script.py similarity index 86% rename from igor2/script.py rename to igor2/cli/script.py index 1c1c260..7ba183c 100644 --- a/igor2/script.py +++ b/igor2/cli/script.py @@ -5,13 +5,10 @@ import logging import sys as _sys -try: - import matplotlib as _matplotlib - import matplotlib.pyplot as _matplotlib_pyplot -except ImportError as _matplotlib_import_error: - _matplotlib = None +import matplotlib.pyplot as pyplot -from ._version import __version__ + +from .._version import __version__ logger = logging.getLogger(__name__) @@ -60,11 +57,9 @@ def _run(self, args): def plot_wave(self, args, wave, title=None): if not args.plot: return # no-op - if not _matplotlib: - raise _matplotlib_import_error if title is None: title = wave['wave']['wave_header']['bname'] - figure = _matplotlib_pyplot.figure() + figure = pyplot.figure() axes = figure.add_subplot(1, 1, 1) axes.set_title(title) try: @@ -76,4 +71,4 @@ def plot_wave(self, args, wave, title=None): def display_plots(self): if self._num_plots: - _matplotlib_pyplot.show() + pyplot.show() diff --git a/pyproject.toml b/pyproject.toml index dd00f93..b902b24 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,7 +28,7 @@ dependencies = [ dynamic = ["version"] [project.optional-dependencies] -cli = [ +CLI = [ "matplotlib", ]