From 93fcc47b8bcc8ff12e08d0564f83af33b8a44c76 Mon Sep 17 00:00:00 2001 From: Riccardo Bertossa Date: Fri, 27 Dec 2024 12:46:57 +0000 Subject: [PATCH] removed idea editor files and added gitignore updated CI python versions, increased version number to 1.1 fixed matplotlib private method removed, removed outdated README in tests folder pre-commit run --all-files removed np.array on ckeys addressed ci message: Your workflow is using a version of actions/cache that is scheduled for deprecation, actions/cache@v1. Please update your workflow to use either v3 or v4 --- .github/workflows/ci.yml | 18 ++++++------- .github/workflows/publish.yml | 14 +++++------ .gitignore | 3 +++ .idea/.gitignore | 3 --- .../inspectionProfiles/profiles_settings.xml | 6 ----- .idea/misc.xml | 7 ------ .idea/modules.xml | 8 ------ .idea/sportran.iml | 15 ----------- .idea/vcs.xml | 6 ----- setup.json | 8 +++--- sportran/i_o/read_lammps_dump.py | 2 +- sportran/i_o/read_lammps_log.py | 2 +- sportran/i_o/read_tablefile.py | 2 +- sportran/plotter/plotter.py | 25 ++++++++----------- tests/README.md | 3 --- 15 files changed, 37 insertions(+), 85 deletions(-) delete mode 100644 .idea/.gitignore delete mode 100644 .idea/inspectionProfiles/profiles_settings.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/sportran.iml delete mode 100644 .idea/vcs.xml delete mode 100644 tests/README.md diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 20e0b44..a24f2ec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,21 +9,21 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Cache python dependencies id: cache-pip - uses: actions/cache@v1 + uses: actions/cache@v4 with: path: ~/.cache/pip key: pip-pre-commit-${{ hashFiles('**/setup.json') }} restore-keys: pip-pre-commit- - - name: Set up Python 3.8 - uses: actions/setup-python@v2 + - name: Set up Python 3.9 + uses: actions/setup-python@v5 with: - python-version: '3.8' + python-version: '3.9' - name: Install python dependencies run: @@ -39,15 +39,15 @@ jobs: strategy: matrix: - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Cache python dependencies id: cache-pip - uses: actions/cache@v1 + uses: actions/cache@v4 with: path: ~/.cache/pip key: pip-pre-commit-${{ hashFiles('**/setup.json') }} @@ -55,7 +55,7 @@ jobs: pip-pre-commit- - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1834f25..f329de5 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -18,10 +18,10 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set up Python 3.8 + - name: Set up Python 3.9 uses: actions/setup-python@v2 with: - python-version: '3.8' + python-version: '3.9' - run: python .github/workflows/check_release_tag.py $GITHUB_REF setup.json pre-commit: @@ -41,10 +41,10 @@ jobs: restore-keys: pip-pre-commit- - - name: Set up Python 3.8 + - name: Set up Python 3.9 uses: actions/setup-python@v2 with: - python-version: '3.8' + python-version: '3.9' - name: Install python dependencies run: @@ -60,7 +60,7 @@ jobs: strategy: matrix: - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] steps: - name: Checkout @@ -100,10 +100,10 @@ jobs: steps: - name: Checkout source uses: actions/checkout@v2 - - name: Set up Python 3.8 + - name: Set up Python 3.9 uses: actions/setup-python@v2 with: - python-version: '3.8' + python-version: '3.9' - name: Build package run: | pip install wheel diff --git a/.gitignore b/.gitignore index f922c29..81de26c 100644 --- a/.gitignore +++ b/.gitignore @@ -50,6 +50,9 @@ coverage.xml # Visual Studio Code .vscode/ +# idea editor +.idea + # Translations *.mo *.pot diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 26d3352..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index cc5462d..0000000 --- a/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index af1d6a3..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 63f5c80..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/.idea/sportran.iml b/.idea/sportran.iml deleted file mode 100644 index e9dbede..0000000 --- a/.idea/sportran.iml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 5ace414..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/setup.json b/setup.json index bc34e05..33d1217 100644 --- a/setup.json +++ b/setup.json @@ -1,21 +1,21 @@ { "name": "sportran", - "version": "1.0.0rc4", + "version": "1.1.0", "author": "Loris Ercole, Riccardo Bertossa, Sebastiano Bisacchi", "author_email": "loris.ercole@epfl.ch", "description": "Cepstral Data Analysis of current time series for Green-Kubo transport coefficients", "license": "GPL 3", "url": "https://github.com/sissaschool/sportran", "keywords": "cepstral data analysis thermal conductivity transport coefficients physics green-kubo", - "python_requires": ">=3.7, <4", + "python_requires": ">=3.9, <4", "classifiers": [ "Development Status :: 5 - Production/Stable", "Programming Language :: Python", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Operating System :: OS Independent", "Intended Audience :: Science/Research", diff --git a/sportran/i_o/read_lammps_dump.py b/sportran/i_o/read_lammps_dump.py index c3908d5..89d6807 100644 --- a/sportran/i_o/read_lammps_dump.py +++ b/sportran/i_o/read_lammps_dump.py @@ -144,7 +144,7 @@ def _read_ckeys(self, group_vectors=True, preload_timesteps=True): line = self.file.readline() if len(line) == 0: # EOF raise RuntimeError('Reached EOF, no ckeys found.') - values = np.array(line.split()) + values = line.split() if (values[0] == 'ITEM:'): if (values[1] == 'TIMESTEP'): self.current_timestep = int(self.file.readline()) diff --git a/sportran/i_o/read_lammps_log.py b/sportran/i_o/read_lammps_log.py index c58a7e6..ea79052 100755 --- a/sportran/i_o/read_lammps_log.py +++ b/sportran/i_o/read_lammps_log.py @@ -231,7 +231,7 @@ def _read_ckeys(self, run_keyword, group_vectors=True): nlines += 1 if len(line) == 0: # EOF raise RuntimeError('Reached EOF, no ckeys found.') - values = np.array(line.split()) + values = line.split() # find the column headers line if (len(values) and (is_string(values[0])) and (values[0] == 'Step')): log.write_log(' column headers found at line {:d}. Reading data...'.format(nlines)) diff --git a/sportran/i_o/read_tablefile.py b/sportran/i_o/read_tablefile.py index c58be04..ebf4ebd 100644 --- a/sportran/i_o/read_tablefile.py +++ b/sportran/i_o/read_tablefile.py @@ -191,7 +191,7 @@ def _read_ckeys(self, group_vectors=True): line = self.file.readline() if len(line) == 0: # EOF raise RuntimeError('Reached EOF, no ckeys found.') - values = np.array(line.split()) + values = line.split() # text line: read variables names and save indexes in ckey if (is_string(values[0]) and (values[0].find('#') < 0)): self.header += line[:-1] diff --git a/sportran/plotter/plotter.py b/sportran/plotter/plotter.py index ea7cd56..2960682 100644 --- a/sportran/plotter/plotter.py +++ b/sportran/plotter/plotter.py @@ -144,10 +144,8 @@ def plot_cospectrum_component(current, idx1, idx2, *, axis=None, FIGSIZE=None, f """ if axis is None: figure, axis = plt.subplots(1, figsize=FIGSIZE) - color1 = next(iter_colors) - color2 = next(iter_colors) - axis.plot(current.freqs_THz, np.real(current.fcospectrum[idx1][idx2]) * current.KAPPA_SCALE * 0.5, c=color1,) - axis.plot(current.freqs_THz, np.imag(current.fcospectrum[idx1][idx2]) * current.KAPPA_SCALE * 0.5, c=color2,) + axis.plot(current.freqs_THz, np.real(current.fcospectrum[idx1][idx2]) * current.KAPPA_SCALE * 0.5) + axis.plot(current.freqs_THz, np.imag(current.fcospectrum[idx1][idx2]) * current.KAPPA_SCALE * 0.5) if f_THz_max is None: f_THz_max = current.freqs_THz[_index_cumsum(np.abs(current.fcospectrum[idx1][idx2]), 0.95)] @@ -192,8 +190,8 @@ def plot_ck(current, *, axis=None, label=None, FIGSIZE=None): if axis is None: figure, axis = plt.subplots(1, figsize=FIGSIZE) - color = next(iter_colors) - axis.plot(current.cepf.logpsdK, 'o-', c=color, label=label) + l, = axis.plot(current.cepf.logpsdK, 'o-', label=label) + color = l.get_color() axis.plot(current.cepf.logpsdK + current.cepf.logpsdK_THEORY_std, '--', c=color) axis.plot(current.cepf.logpsdK - current.cepf.logpsdK_THEORY_std, '--', c=color) @@ -216,10 +214,10 @@ def plot_L0_Pstar(current, *, axis=None, label=None, FIGSIZE=None): """ if axis is None: figure, axis = plt.subplots(1, figsize=FIGSIZE) - color = next(iter_colors) # quick fix to avoid error with mlp>=3.8 - axis.plot(np.arange(current.NFREQS) + 1, current.cepf.logtau, '.-', c=color, label=label) - axis.plot(np.arange(current.NFREQS) + 1, current.cepf.logtau + current.cepf.logtau_THEORY_std, '--', c=color,) - axis.plot(np.arange(current.NFREQS) + 1, current.cepf.logtau - current.cepf.logtau_THEORY_std, '--', c=color,) + l, = axis.plot(np.arange(current.NFREQS) + 1, current.cepf.logtau, '.-', label=label) + color = l.get_color() + axis.plot(np.arange(current.NFREQS) + 1, current.cepf.logtau + current.cepf.logtau_THEORY_std, '--', c=color) + axis.plot(np.arange(current.NFREQS) + 1, current.cepf.logtau - current.cepf.logtau_THEORY_std, '--', c=color) axis.axvline(x=current.cepf.aic_Kmin + 1, ls=':', c=color) axis.axvline(x=current.cepf.cutoffK + 1, ls='--', c=color) axis.set_xlim([0, 3 * current.cepf.cutoffK]) @@ -246,12 +244,11 @@ def plot_kappa_Pstar(current, *, axis=None, label=None, FIGSIZE=None, pstar_max= """ if axis is None: figure, axis = plt.subplots(1, figsize=FIGSIZE) - color = next(iter_colors) + l, = axis.plot(np.arange(current.NFREQS) + 1, current.cepf.tau * current.KAPPA_SCALE * 0.5, 'o-', label=label) + color = l.get_color() axis.fill_between( np.arange(current.NFREQS) + 1, (current.cepf.tau - current.cepf.tau_THEORY_std) * current.KAPPA_SCALE * 0.5, - (current.cepf.tau + current.cepf.tau_THEORY_std) * current.KAPPA_SCALE * 0.5, alpha=0.3, color=color, - ) - axis.plot(np.arange(current.NFREQS) + 1, current.cepf.tau * current.KAPPA_SCALE * 0.5, 'o-', c=color, label=label,) + (current.cepf.tau + current.cepf.tau_THEORY_std) * current.KAPPA_SCALE * 0.5, alpha=0.3, color=color) axis.axvline(x=current.cepf.aic_Kmin + 1, ls=':', c=color) axis.axvline(x=current.cepf.cutoffK + 1, ls='--', c=color) axis.axhline(y=current.kappa, ls='--', c=color) diff --git a/tests/README.md b/tests/README.md deleted file mode 100644 index 919c1a0..0000000 --- a/tests/README.md +++ /dev/null @@ -1,3 +0,0 @@ -This folder contains various tests. -They are run by running 'tox' in the main folder of the project, where tox.ini is located. 'tox' is installed with 'pip install tox'. -If you have issues running the tests with errors such 'You are using pip version 8.1.1, however version 19.2.1 is available.', please consider upgrading virtualenv with 'pip install virtualenv --upgrade'. Simply upgrading pip in this case does not work.