Skip to content

Commit 3ab1c99

Browse files
authored
Merge pull request #302 from dmgav/debug-pyqt
Compatibility with PyQT 5.15
2 parents 1835ba5 + f5d5ec0 commit 3ab1c99

File tree

82 files changed

+583
-570
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+583
-570
lines changed

.github/workflows/isort.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Check Code Style - ISORT
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- uses: actions/setup-python@v2
11+
- name: Install Dependencies
12+
run: |
13+
# These packages are installed in the base environment but may be older
14+
# versions. Explicitly upgrade them because they often create
15+
# installation problems if out of date.
16+
python -m pip install --upgrade pip setuptools numpy
17+
18+
pip install isort
19+
- name: Run ISort
20+
run: |
21+
isort . -c

.github/workflows/testing.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
7575
- name: Install Conda packages
7676
run: |
77-
set -vxeuo pipefail
77+
set -vxeo pipefail
7878
7979
conda install -y \
8080
python=${{ matrix.python-version }} \
@@ -91,7 +91,7 @@ jobs:
9191
- name: Install Conda packages (Windows and OSX)
9292
if: runner.os != 'Linux'
9393
run: |
94-
set -vxeuo pipefail
94+
set -vxeo pipefail
9595
9696
# There are issues in building wheels for pystackreg>0.2.2 on OSX, so install pystackreg from CF
9797
conda install -y pystackreg -c conda-forge

.isort.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[settings]
2+
line_length = 115
3+
multi_line_output = 3
4+
include_trailing_comma = True
5+
profile = black

docs/source/installation.rst

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ The easiest way to install PyXRF is to load it into a Conda environment from
77
``conda-forge`` Anaconda channel. Installation instructions are
88
identical for all supported OS.
99

10-
PyXRF is currently not working properly with ``PyQt5`` v5.15, which is the latest available
11-
version. The instructions show how to install earlier version of ``PyQt5`` from PyPI.
12-
1310
.. note::
1411

1512
**Installation on Windows**: PyXRF can be installed from *conda-forge* only in the environments
@@ -36,15 +33,13 @@ version. The instructions show how to install earlier version of ``PyQt5`` from
3633
3734
$ conda install mamba -n base -c conda-forge
3835
39-
Then use `mamba` instead of `conda` in all commands. Mamba may not respect pinned versions of
40-
packages. Since PyXRF currently does not work with `pyqt` v5.15, explicitly specify the version
41-
`"pyqt<5.15"` during installation, for example
36+
Then use `mamba` instead of `conda` in all the following commands, for example
4237

4338
.. code:: bash
4439
4540
$ mamba create -n pyxrf-env python=3.9 pip -c conda-forge
4641
$ mamba activate pyxrf-env
47-
$ mamba install pyxrf "pyqt<5.15" -c conda-forge
42+
$ mamba install pyxrf -c conda-forge
4843
4944
You may still use `conda` where it works well, e.g. to activate an existing environment.
5045

@@ -119,14 +114,15 @@ version. The instructions show how to install earlier version of ``PyQt5`` from
119114

120115
.. code:: bash
121116
122-
$ pip install pyxrf 'PyQt5<5.15'
117+
$ pip install pyxrf PyQt5
118+
$ pip install pyxrf 'PyQt5<5.15' # Older version of PyQT
123119
124120
or from source (editable installation):
125121

126122
.. code:: bash
127123
128124
$ cd <root-directory-of-the-repository>
129-
$ pip install 'PyQt5<5.15'
125+
$ pip install PyQt5
130126
$ pip install -e .
131127
132128
Starting PyXRF

pyxrf/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import logging
22
from logging import NullHandler
3+
34
from ._version import get_versions
45

56
__version__ = get_versions()["version"]

pyxrf/api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
# Use 'pyxrf.api_dev' if you are importing PyXRF API into a custom script.
33

44

5-
from .api_dev import * # noqa: F401, F403
65
from pyxrf import __version__ as pyxrf_version
76

7+
from .api_dev import * # noqa: F401, F403
8+
89

910
def pyxrf_api():
1011
r"""

pyxrf/api_dev.py

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
11
# Use this file if you need to import PyXRF APIs into a custom script.
22
# Use 'pyxrf.api' if you are interactively importing APIs into an IPython session.
33

4-
from .model.fileio import stitch_fitted_results # noqa: F401
5-
from .model.fileio import spec_to_hdf # noqa: F401
6-
from .model.fileio import create_movie # noqa: F401
4+
import logging
5+
6+
from .core.map_processing import dask_client_create # noqa: F401
7+
from .gui_support.gpc_class import autofind_emission_lines # noqa: F401, E402
8+
from .model.command_tools import fit_pixel_data_and_save, pyxrf_batch # noqa: F401
79
from .model.fileio import combine_data_to_recon # noqa: F401
8-
from .model.fileio import h5file_for_recon # noqa: F401
10+
from .model.fileio import create_movie # noqa: F401
911
from .model.fileio import export_to_view # noqa: F401
12+
from .model.fileio import h5file_for_recon # noqa: F401
1013
from .model.fileio import make_hdf_stitched # noqa: F401
11-
12-
from .model.load_data_from_db import make_hdf, export1d # noqa: F401
13-
from .model.command_tools import fit_pixel_data_and_save, pyxrf_batch # noqa: F401
14-
from .xanes_maps.xanes_maps_api import build_xanes_map # noqa: F401
15-
from .simulation.sim_xrf_scan_data import gen_hdf5_qa_dataset, gen_hdf5_qa_dataset_preset_1 # noqa: F401
16-
from .core.map_processing import dask_client_create # noqa: F401
17-
18-
from .model.load_data_from_db import save_data_to_hdf5 # noqa: F401, E402
1914
from .model.fileio import read_data_from_hdf5 # noqa: F401, E402
20-
21-
from .gui_support.gpc_class import autofind_emission_lines # noqa: F401, E402
15+
from .model.fileio import spec_to_hdf # noqa: F401
16+
from .model.fileio import stitch_fitted_results # noqa: F401
17+
from .model.load_data_from_db import save_data_to_hdf5 # noqa: F401, E402
18+
from .model.load_data_from_db import export1d, make_hdf # noqa: F401
19+
from .simulation.sim_xrf_scan_data import gen_hdf5_qa_dataset, gen_hdf5_qa_dataset_preset_1 # noqa: F401
20+
from .xanes_maps.xanes_maps_api import build_xanes_map # noqa: F401
2221

2322
# Note: the statement '# noqa: F401' is telling flake8 to ignore violation F401 at the given line
2423
# Violation F401 - the package is imported but unused
2524

26-
import logging
2725

2826
logger = logging.getLogger("pyxrf")
2927

pyxrf/core/map_processing.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
import numpy as np
1+
import getpass
2+
import logging
23
import math
34
import os
4-
import h5py
5-
import dask
6-
import dask.array as da
7-
import tempfile
85
import platform
9-
import getpass
6+
import tempfile
107
import time as ttime
11-
from numba import jit
8+
9+
import dask
10+
import dask.array as da
11+
import h5py
12+
import numpy as np
1213
from dask.distributed import Client, wait
14+
from numba import jit
1315
from progress.bar import Bar
14-
from .fitting import fit_spectrum
1516

16-
import logging
17+
from .fitting import fit_spectrum
1718

1819
logger = logging.getLogger(__name__)
1920

pyxrf/core/quant_analysis.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1+
import copy
2+
import json
3+
import logging
4+
import math
15
import os
2-
import yaml
6+
import time as ttime
7+
38
import jsonschema
49
import numpy as np
5-
import math
6-
import json
7-
import copy
8-
import time as ttime
10+
import yaml
11+
12+
from .utils import convert_time_to_nexus_string, normalize_data_by_scaler
913
from .xrf_utils import (
10-
split_compound_mass,
11-
generate_eline_list,
12-
compute_atomic_scaling_factor,
1314
check_if_eline_supported,
15+
compute_atomic_scaling_factor,
16+
generate_eline_list,
17+
split_compound_mass,
1418
)
15-
from .utils import normalize_data_by_scaler, convert_time_to_nexus_string
16-
import logging
1719

1820
logger = logging.getLogger(__name__)
1921

pyxrf/core/tests/test_fitting.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import pytest
21
import numpy as np
32
import numpy.testing as npt
3+
import pytest
44

5-
from pyxrf.core.fitting import rfactor_compute, _fitting_nnls, _fitting_admm, fit_spectrum
5+
from pyxrf.core.fitting import _fitting_admm, _fitting_nnls, fit_spectrum, rfactor_compute
66

77
# ------------------------------------------------------------------------------
88
# useful functions for generating of datasets for testing of fitting algorithms

0 commit comments

Comments
 (0)