Skip to content

Commit

Permalink
ref: combine all script-related code (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Feb 10, 2023
1 parent 334cc59 commit 7f9a259
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
8 changes: 8 additions & 0 deletions Readme.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----
Expand Down
15 changes: 5 additions & 10 deletions igor2/script.py → igor2/cli/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down Expand Up @@ -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:
Expand All @@ -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()
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dependencies = [
dynamic = ["version"]

[project.optional-dependencies]
cli = [
CLI = [
"matplotlib",
]

Expand Down

0 comments on commit 7f9a259

Please sign in to comment.