Skip to content

Commit

Permalink
refactor(accessors): split submodule
Browse files Browse the repository at this point in the history
Accessors in `utils.py` has been moved to `general.py`, so that `utils.py` only contains utilities for creating accessors.
  • Loading branch information
kmnhan committed Jul 12, 2024
1 parent 8265b90 commit 6ed5c03
Show file tree
Hide file tree
Showing 7 changed files with 462 additions and 475 deletions.
6 changes: 3 additions & 3 deletions docs/source/user-guide/imagetool.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ create a new ImageTool instance and handle the event loop execution: ::
eri.itool(data)

Another way is to use the :class:`qshow
<erlab.accessors.utils.InteractiveDataArrayAccessor>` accessor: ::
<erlab.accessors.general.InteractiveDataArrayAccessor>` accessor: ::

data.qshow()

Expand Down Expand Up @@ -94,7 +94,7 @@ running. To get around this, you can use the :class:`ImageToolManager
In the environment where ERLabPy installed, run ``itool-manager`` in a shell to start
the manager application. Subsequent invocations with :func:`itool
<erlab.interactive.imagetool.itool>` and :class:`qshow
<erlab.accessors.utils.InteractiveDataArrayAccessor>` will be handled by the manager.
<erlab.accessors.general.InteractiveDataArrayAccessor>` will be handled by the manager.

.. note::

Expand All @@ -106,4 +106,4 @@ the manager application. Subsequent invocations with :func:`itool
notebook. The delay is bigger for larger data. You can still open directly while the
manager is running by providing the `use_manager=False` argument to :func:`itool
<erlab.interactive.imagetool.itool>` or :class:`qshow
<erlab.accessors.utils.InteractiveDataArrayAccessor>`.
<erlab.accessors.general.InteractiveDataArrayAccessor>`.
10 changes: 5 additions & 5 deletions docs/source/user-guide/indexing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@
"\n",
"The ``qsel`` accessor\n",
"---------------------\n",
"ERLabPy provides a callable accessor :class:`qsel <erlab.accessors.utils.SelectionAccessor>` to streamline the slicing and averaging process. It can be used just like other DataArray methods:"
"ERLabPy provides a callable accessor :class:`qsel <erlab.accessors.general.SelectionAccessor>` to streamline the slicing and averaging process. It can be used just like other DataArray methods:"
]
},
{
Expand Down Expand Up @@ -250,7 +250,7 @@
"Note that the averaged coordinate is automatically added to the data array. This is\n",
"useful for plotting and further analysis.\n",
"\n",
"With :class:`qsel <erlab.accessors.utils.SelectionAccessor>`, position along a dimension\n",
"With :class:`qsel <erlab.accessors.general.SelectionAccessor>`, position along a dimension\n",
"can be specified in three ways:\n",
"\n",
"- As a value and width: ``eV=-0.1, eV_width=0.05``\n",
Expand Down Expand Up @@ -298,14 +298,14 @@
},
"source": [
"In practice, you can generate the arguments for :class:`qsel\n",
"<erlab.accessors.utils.SelectionAccessor>` that reproduce a certain slice within\n",
"<erlab.accessors.general.SelectionAccessor>` that reproduce a certain slice within\n",
"`ImageTool <./imagetool.rst>`_ from the right-click menu of each plot.\n",
"\n",
"Averaging data within a distance\n",
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n",
"\n",
"The :class:`qsel <erlab.accessors.utils.SelectionAccessor>` accessor also provides a\n",
"method :meth:`qsel.around <erlab.accessors.utils.SelectionAccessor.around>` to average\n",
"The :class:`qsel <erlab.accessors.general.SelectionAccessor>` accessor also provides a\n",
"method :meth:`qsel.around <erlab.accessors.general.SelectionAccessor.around>` to average\n",
"over points within a certain distance of a given point.\n",
"\n",
"The following plot shows the integrated EDCs near the K point for different radii."
Expand Down
2 changes: 1 addition & 1 deletion docs/source/user-guide/plotting.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@
}
},
"source": [
":func:`plot_array <erlab.plotting.general.plot_array>` can also be accessed (for 2D data) through the :class:`qplot <erlab.accessors.utils.PlotAccessor>` accessor."
":func:`plot_array <erlab.plotting.general.plot_array>` can also be accessed (for 2D data) through the :class:`qplot <erlab.accessors.general.PlotAccessor>` accessor."
]
},
{
Expand Down
4 changes: 3 additions & 1 deletion src/erlab/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
__version__ = "2.8.3"

import erlab.accessors # noqa: F401
import erlab.accessors.fit
import erlab.accessors.general
import erlab.accessors.kspace # noqa: F401
25 changes: 0 additions & 25 deletions src/erlab/accessors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,3 @@
fit
""" # noqa: D205

__all__ = [
"InteractiveDataArrayAccessor",
"InteractiveDatasetAccessor",
"ModelFitDataArrayAccessor",
"ModelFitDatasetAccessor",
"MomentumAccessor",
"OffsetView",
"ParallelFitDataArrayAccessor",
"PlotAccessor",
"SelectionAccessor",
]

from erlab.accessors.fit import (
ModelFitDataArrayAccessor,
ModelFitDatasetAccessor,
ParallelFitDataArrayAccessor,
)
from erlab.accessors.kspace import MomentumAccessor, OffsetView
from erlab.accessors.utils import (
InteractiveDataArrayAccessor,
InteractiveDatasetAccessor,
PlotAccessor,
SelectionAccessor,
)
Loading

0 comments on commit 6ed5c03

Please sign in to comment.