From b4f682837a9dded1f08c3a37a0522346f6ed479f Mon Sep 17 00:00:00 2001 From: Nico Neureiter Date: Fri, 12 May 2023 13:40:41 +0200 Subject: [PATCH 01/15] stopped using of np.int --- sbayes/sampling/loggers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sbayes/sampling/loggers.py b/sbayes/sampling/loggers.py index a4eddbd6..c0543816 100644 --- a/sbayes/sampling/loggers.py +++ b/sbayes/sampling/loggers.py @@ -86,7 +86,7 @@ def write_header(self, sample: Sample): self.match_clusters = False # Initialize cluster_sum array for matching - self.cluster_sum = np.zeros((sample.n_clusters, sample.n_objects), dtype=np.int) + self.cluster_sum = np.zeros((sample.n_clusters, sample.n_objects), dtype=int) # Cluster sizes for i in range(sample.n_clusters): @@ -233,7 +233,7 @@ def write_header(self, sample: Sample): # Nothing to match self.match_clusters = False - self.cluster_sum = np.zeros((sample.n_clusters, sample.n_objects), dtype=np.int) + self.cluster_sum = np.zeros((sample.n_clusters, sample.n_objects), dtype=int) def _write_sample(self, sample): if self.match_clusters: From d5b855ec248efa76e52bfb713642e2ba9bbb4435 Mon Sep 17 00:00:00 2001 From: Nico Neureiter Date: Fri, 12 May 2023 13:43:15 +0200 Subject: [PATCH 02/15] replaced np.float by float --- sbayes/results.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sbayes/results.py b/sbayes/results.py index a6b3284f..709c6715 100644 --- a/sbayes/results.py +++ b/sbayes/results.py @@ -192,9 +192,7 @@ def read_dictionary(dataframe, search_key): param_dict = {} for column_name in dataframe.columns: if column_name.startswith(search_key): - param_dict[column_name] = dataframe[column_name].to_numpy( - dtype=np.float - ) + param_dict[column_name] = dataframe[column_name].to_numpy(dtype=float) return param_dict @@ -218,7 +216,7 @@ def parse_weights(self, parameters: pd.DataFrame) -> dict[str, NDArray]: weights = {} for f in self.feature_names: weights[f] = np.column_stack( - [parameters[f"w_{c}_{f}"].to_numpy(dtype=np.float) for c in components] + [parameters[f"w_{c}_{f}"].to_numpy(dtype=float) for c in components] ) return weights From c4e65cafa6e5cb28bd1fb14a5d5e4b51d7e9b96f Mon Sep 17 00:00:00 2001 From: Nico Neureiter Date: Fri, 12 May 2023 13:44:12 +0200 Subject: [PATCH 03/15] replaced np.bool by bool --- test/test_model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_model.py b/test/test_model.py index b3c1b8b8..7892c94a 100644 --- a/test/test_model.py +++ b/test/test_model.py @@ -140,7 +140,7 @@ def test_minimal_example(self): p_global = np.full(shape=(1, n_features, n_states), fill_value=0.5) source = np.zeros((n_objects, n_features, 2), dtype=bool) sample = Sample.from_numpy_arrays( - clusters=np.ones((1, n_objects), dtype=np.bool), + clusters=np.ones((1, n_objects), dtype=bool), weights=broadcast_weights([0.5, 0.5], n_features), cluster_effect=p_cluster, confounding_effects={"universal": p_global}, From 7fa7e231aaa050b134d2681e245c92c08a8b1139 Mon Sep 17 00:00:00 2001 From: Nico Neureiter Date: Sat, 13 May 2023 14:14:38 +0200 Subject: [PATCH 04/15] Update python-package.yml --- .github/workflows/python-package.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 7e870c24..bc8e6038 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -18,26 +18,45 @@ jobs: python-version: [3.7, 3.8, 3.9] steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} + - name: Install system dependencies run: | sudo apt-get update && sudo apt-get install -y libproj-dev proj-data proj-bin libgeos-dev + + - name: Install Miniconda + run: | + wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh + bash Miniconda3-latest-Linux-x86_64.sh -b -p $HOME/miniconda + source $HOME/miniconda/etc/profile.d/conda.sh + conda activate base + conda config --set always_yes yes --set changeps1 no + conda update -q conda + + - name: Install Python dependencies with Conda + run: | + conda install cartopy + - name: Install python dependencies run: | python -m pip install --upgrade pip python -m pip install flake8 pytest python -m pip install cython numpy if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest run: | pytest From 82535285ad4000b1ce98917fdd8f45829e53627c Mon Sep 17 00:00:00 2001 From: Nico Neureiter Date: Sat, 13 May 2023 14:21:12 +0200 Subject: [PATCH 05/15] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 2dc19bb9..d0c9d155 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,7 +9,7 @@ scipy Shapely seaborn setuptools -cartopy<0.20.0 +cartopy typing_extensions tables pydantic From 0a0a70649c3e7122840307d65330fb11296378c3 Mon Sep 17 00:00:00 2001 From: Nico Neureiter Date: Sat, 13 May 2023 14:23:02 +0200 Subject: [PATCH 06/15] Update python-package.yml --- .github/workflows/python-package.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index bc8e6038..31bfa7e3 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.7, 3.8, 3.9] + python-version: [3.9] steps: @@ -35,7 +35,8 @@ jobs: wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh bash Miniconda3-latest-Linux-x86_64.sh -b -p $HOME/miniconda source $HOME/miniconda/etc/profile.d/conda.sh - conda activate base + conda create -n myenv python=${{ matrix.python-version }} + conda activate myenv conda config --set always_yes yes --set changeps1 no conda update -q conda From ec25c35690db5f1da5788febcb26e3372721fef2 Mon Sep 17 00:00:00 2001 From: Nico Neureiter Date: Sat, 13 May 2023 14:32:12 +0200 Subject: [PATCH 07/15] Update python-package.yml --- .github/workflows/python-package.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 31bfa7e3..9c3c34e0 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -35,8 +35,17 @@ jobs: wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh bash Miniconda3-latest-Linux-x86_64.sh -b -p $HOME/miniconda source $HOME/miniconda/etc/profile.d/conda.sh + + - name: Create conda environment + run: | conda create -n myenv python=${{ matrix.python-version }} + + - name: Activate conda environment + run: | conda activate myenv + + - name: Config and update conda environment + run: | conda config --set always_yes yes --set changeps1 no conda update -q conda From 77e6e02991b7595a140e18bc762db5eb0cb32b67 Mon Sep 17 00:00:00 2001 From: Nico Neureiter Date: Sat, 13 May 2023 14:47:57 +0200 Subject: [PATCH 08/15] Update python-package.yml --- .github/workflows/python-package.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 9c3c34e0..15fcf42a 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -20,12 +20,7 @@ jobs: steps: - uses: actions/checkout@v2 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - + - name: Install system dependencies run: | sudo apt-get update && sudo apt-get install -y libproj-dev proj-data proj-bin libgeos-dev @@ -38,6 +33,7 @@ jobs: - name: Create conda environment run: | + conda init bash conda create -n myenv python=${{ matrix.python-version }} - name: Activate conda environment From d0ae75e5476841d06115a03070de738cfef378ca Mon Sep 17 00:00:00 2001 From: Nico Neureiter Date: Sat, 13 May 2023 14:53:53 +0200 Subject: [PATCH 09/15] Update python-package.yml --- .github/workflows/python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 15fcf42a..e23343b0 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -33,11 +33,11 @@ jobs: - name: Create conda environment run: | - conda init bash conda create -n myenv python=${{ matrix.python-version }} - name: Activate conda environment run: | + conda init bash conda activate myenv - name: Config and update conda environment From 8634103933e6e3e60de1052d8234d68cc0be801d Mon Sep 17 00:00:00 2001 From: Nico Neureiter Date: Sat, 13 May 2023 15:08:58 +0200 Subject: [PATCH 10/15] Update python-package.yml --- .github/workflows/python-package.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index e23343b0..bd023afb 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -33,11 +33,12 @@ jobs: - name: Create conda environment run: | + conda init bash conda create -n myenv python=${{ matrix.python-version }} + source $HOME/miniconda/etc/profile.d/conda.sh - name: Activate conda environment run: | - conda init bash conda activate myenv - name: Config and update conda environment From 9189de3155dcefa7b1f51a48e72cc0c5004f9b7c Mon Sep 17 00:00:00 2001 From: Nico Neureiter Date: Sat, 13 May 2023 15:13:59 +0200 Subject: [PATCH 11/15] Update python-package.yml --- .github/workflows/python-package.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index bd023afb..a156b12c 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -13,6 +13,11 @@ jobs: build: runs-on: ubuntu-latest + + defaults: + run: + shell: bash -l {0} + strategy: matrix: python-version: [3.9] From 4832c937e8011020e6989ebe73845642e6745431 Mon Sep 17 00:00:00 2001 From: Nico Neureiter Date: Sat, 13 May 2023 15:27:05 +0200 Subject: [PATCH 12/15] Update python-package.yml --- .github/workflows/python-package.yml | 92 ++++++++++++++-------------- 1 file changed, 47 insertions(+), 45 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index a156b12c..b6bd9b82 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -24,51 +24,53 @@ jobs: steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2 - - name: Install system dependencies - run: | - sudo apt-get update && sudo apt-get install -y libproj-dev proj-data proj-bin libgeos-dev - - - name: Install Miniconda - run: | - wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh - bash Miniconda3-latest-Linux-x86_64.sh -b -p $HOME/miniconda - source $HOME/miniconda/etc/profile.d/conda.sh + - uses: conda-incubator/setup-miniconda@v2 + with: + miniconda-version: "latest" + channels: bioconda, conda-forge, defaults + use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! + auto-update-conda: true + auto-activate-base: true - - name: Create conda environment - run: | - conda init bash - conda create -n myenv python=${{ matrix.python-version }} - source $HOME/miniconda/etc/profile.d/conda.sh - - - name: Activate conda environment - run: | - conda activate myenv - - - name: Config and update conda environment - run: | - conda config --set always_yes yes --set changeps1 no - conda update -q conda + - name: Install system dependencies + run: | + sudo apt-get update && sudo apt-get install -y libproj-dev proj-data proj-bin libgeos-dev - - name: Install Python dependencies with Conda - run: | - conda install cartopy - - - name: Install python dependencies - run: | - python -m pip install --upgrade pip - python -m pip install flake8 pytest - python -m pip install cython numpy - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - - name: Lint with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - - name: Test with pytest - run: | - pytest + - name: Create conda environment + run: | + conda init bash + conda create -n myenv python=${{ matrix.python-version }} + source $HOME/miniconda/etc/profile.d/conda.sh + + - name: Activate conda environment + run: | + conda activate myenv + + - name: Config and update conda environment + run: | + conda config --set always_yes yes --set changeps1 no + conda update -q conda + + - name: Install Python dependencies with Conda + run: | + conda install cartopy + + - name: Install python dependencies + run: | + python -m pip install --upgrade pip + python -m pip install flake8 pytest + python -m pip install cython numpy + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + + - name: Test with pytest + run: | + pytest From 074e6931457506320421142b8e7137e17271955a Mon Sep 17 00:00:00 2001 From: Nico Neureiter Date: Sat, 13 May 2023 15:43:58 +0200 Subject: [PATCH 13/15] Update python-package.yml --- .github/workflows/python-package.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index b6bd9b82..f4127699 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -42,7 +42,6 @@ jobs: run: | conda init bash conda create -n myenv python=${{ matrix.python-version }} - source $HOME/miniconda/etc/profile.d/conda.sh - name: Activate conda environment run: | From 6a1e52a7442574f205982005e5f33a6a3a376c06 Mon Sep 17 00:00:00 2001 From: Nico Neureiter Date: Sat, 13 May 2023 16:15:24 +0200 Subject: [PATCH 14/15] Update python-package.yml --- .github/workflows/python-package.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index f4127699..351a63fa 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -43,12 +43,9 @@ jobs: conda init bash conda create -n myenv python=${{ matrix.python-version }} - - name: Activate conda environment + - name: Activate and update conda environment run: | conda activate myenv - - - name: Config and update conda environment - run: | conda config --set always_yes yes --set changeps1 no conda update -q conda From bbb200a86011f12df733674f30afb294640c61c8 Mon Sep 17 00:00:00 2001 From: Nico Neureiter Date: Sat, 13 May 2023 16:20:37 +0200 Subject: [PATCH 15/15] Update python-package.yml --- .github/workflows/python-package.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 351a63fa..dfbcda4d 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -43,11 +43,14 @@ jobs: conda init bash conda create -n myenv python=${{ matrix.python-version }} - - name: Activate and update conda environment + - name: Activate conda environment run: | conda activate myenv conda config --set always_yes yes --set changeps1 no - conda update -q conda + + - name: Update conda environment + run: | + conda update --name base -q conda - name: Install Python dependencies with Conda run: |