Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/RELEASE_next_patch' into check…
Browse files Browse the repository at this point in the history
…_init_spanROI

# Conflicts:
#	CHANGES.rst
  • Loading branch information
ericpre committed Feb 3, 2021
2 parents 32b04d4 + 511489b commit 55530ff
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 19 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Expand Up @@ -13,6 +13,8 @@ RELEASE_next_patch (Unreleased)
* Pass keyword argument to the image IO plugins (`#2627 <https://github.com/hyperspy/hyperspy/pull/2627>`_)
* Drop support for numpy<1.16, in line with NEP 29 and fix protochip reader for numpy 1.20 (`#2616 <https://github.com/hyperspy/hyperspy/pull/2616>`_)
* Run test suite against upstream dependencies (numpy, scipy, scikit-learn and scikit-image) (`#2616 <https://github.com/hyperspy/hyperspy/pull/2616>`_)
* Improve error message when file not found (`#2597 <https://github.com/hyperspy/hyperspy/pull/2597>`_)
* Add update instructions to user guide (`#2621 <https://github.com/hyperspy/hyperspy/pull/2621>`_)
* Improve error message when initialising SpanROI with left >= right (`#2604 <https://github.com/hyperspy/hyperspy/pull/2604>`_)


Expand Down
78 changes: 63 additions & 15 deletions doc/user_guide/install.rst
Expand Up @@ -33,7 +33,8 @@ read the :ref:`conda installation <anaconda-install>` and
HyperSpy Bundle
---------------

The HyperSpy bundle is very similar to the Anaconda distribution, and it includes:
The `HyperSpy <https://github.com/hyperspy/hyperspy-bundle>`_ bundle is very similar
to the Anaconda distribution, and it includes:

* HyperSpy
* HyperSpyUI
Expand All @@ -48,15 +49,16 @@ Portable distribution (Windows only)
A portable version of the `HyperSpy bundle <https://github.com/hyperspy/hyperspy-bundle>`_
based on the WinPython distribution is also available on Windows.


.. _anaconda-install:

Installation in an Anaconda/Miniconda distribution
--------------------------------------------------
Installation using conda
------------------------

HyperSpy is packaged in the `conda-forge <https://conda-forge.org/>`_ channel
and can be installed easily using the `conda <https://docs.conda.io/en/latest/>`_
package manager.
`Conda <https://docs.conda.io/en/latest/>`_ is a package manager for Anaconda-like
distributions, such as the `Miniforge <https://github.com/conda-forge/miniforge>`_
or the `HyperSpy-bundle <https://github.com/hyperspy/hyperspy-bundle>`_.
Since HyperSpy is packaged in the `conda-forge <https://conda-forge.org/>`_ channel,
it can easily be installed using conda.

To install hyperspy run the following from the Anaconda Prompt on Windows or
from a Terminal on Linux and Mac.
Expand Down Expand Up @@ -132,6 +134,7 @@ To learn more about the Anaconda eco-system:

- Choose between `Anaconda or Miniconda <https://docs.conda.io/projects/conda/en/latest/user-guide/install/download.html#anaconda-or-miniconda>`_?
- Understanding `conda and pip <https://www.anaconda.com/blog/understanding-conda-and-pip>`_.
- What is `conda-forge <https://conda-forge.org/#about>`_.

.. _install-with-pip:

Expand All @@ -145,16 +148,16 @@ install pip for the following commands to run.

To install all hyperspy functionalities, run:

.. code-block:: bash
.. code-block:: bash
$ pip install hyperspy[all]
$ pip install hyperspy[all]
To install only the strictly required dependencies and limited functionalities,
use:

.. code-block:: bash
.. code-block:: bash
$ pip install hyperspy
$ pip install hyperspy
See the following list of selectors to select the installation of optional
dependencies required by specific functionalities:
Expand Down Expand Up @@ -184,6 +187,51 @@ tools installed in the system. If the above does not work for you remember that
the easiest way to install HyperSpy is
:ref:`using the HyperSpy bundle <hyperspy-bundle>`.

.. _update-with-conda:

Update HyperSpy
---------------

Using conda
^^^^^^^^^^^

To update hyperspy to the latest release using conda:

.. code-block:: bash
$ conda update hyperspy -c conda-forge
Using pip
^^^^^^^^^

To update hyperspy to the latest release using pip:

.. code-block:: bash
$ pip install hyperspy --upgrade
Install specific version
------------------------

Using conda
^^^^^^^^^^^

To install a specific version of hyperspy (for example ``1.6.1``) using conda:

.. code-block:: bash
$ conda install hyperspy=1.6.1 -c conda-forge
Using pip
^^^^^^^^^

To install a specific version of hyperspy (for example ``1.6.1``) using pip:

.. code-block:: bash
$ pip install hyperspy==1.6.1
.. _install-dev:

Rolling release Linux distributions
Expand All @@ -196,11 +244,11 @@ or :ref:`Pip <install-with-pip>` is recommended.

However, packages of the latest HyperSpy release and the related
GUI packages are maintained for the rolling release distributions
**Arch-Linux** (in the `Arch User Repository
*Arch-Linux* (in the `Arch User Repository
<https://aur.archlinux.org/packages/python-hyperspy/>`_) (AUR) and
**openSUSE** (`Community Package <https://software.opensuse.org/package/python-hyperspy>`_)
as ``python-hyperspy`` and ``python-hyperspy-gui-traitsui`` /
``python-hyperspy-gui-ipywidgets``.
*openSUSE* (`Community Package <https://software.opensuse.org/package/python-hyperspy>`_)
as ``python-hyperspy`` and ``python-hyperspy-gui-traitsui``,
``python-hyperspy-gui-ipywidgets`` for the GUIs packages.

A more up-to-date package that contains all updates to be included
in the next minor version release (likely including new features compared to
Expand Down
3 changes: 2 additions & 1 deletion hyperspy/io.py
Expand Up @@ -314,14 +314,15 @@ def load(filenames=None,
raise ValueError("No file provided to reader")

if isinstance(filenames, str):
pattern = filenames
if escape_square_brackets:
filenames = _escape_square_brackets(filenames)

filenames = natsorted([f for f in glob.glob(filenames)
if os.path.isfile(f)])

if not filenames:
raise ValueError('No filename matches this pattern')
raise ValueError(f'No filename matches the pattern "{pattern}"')

elif isinstance(filenames, Path):
# Just convert to list for now, pathlib.Path not
Expand Down
6 changes: 3 additions & 3 deletions hyperspy/tests/io/test_io.py
Expand Up @@ -98,7 +98,7 @@ def test_glob_wildcards():
for f in fnames:
s.save(f)

with pytest.raises(ValueError, match="No filename matches this pattern"):
with pytest.raises(ValueError, match="No filename matches the pattern"):
_ = hs.load(fnames[0])

t = hs.load([fnames[0]])
Expand All @@ -113,7 +113,7 @@ def test_glob_wildcards():
t = hs.load(os.path.join(dirpath, "temp[*].hspy"), escape_square_brackets=True,)
assert len(t) == 2

with pytest.raises(ValueError, match="No filename matches this pattern"):
with pytest.raises(ValueError, match="No filename matches the pattern"):
_ = hs.load(os.path.join(dirpath, "temp[*].hspy"))

# Test pathlib.Path
Expand All @@ -137,7 +137,7 @@ def test_file_not_found_error():
if os.path.exists(temp_fname):
os.remove(temp_fname)

with pytest.raises(ValueError, match="No filename matches this pattern"):
with pytest.raises(ValueError, match='No filename matches the pattern'):
_ = hs.load(temp_fname)

with pytest.raises(FileNotFoundError):
Expand Down

0 comments on commit 55530ff

Please sign in to comment.