Skip to content

Commit

Permalink
Fixed most code issues with deps update
Browse files Browse the repository at this point in the history
  • Loading branch information
dhhagan committed Oct 4, 2024
1 parent f2c5057 commit 35ff58c
Show file tree
Hide file tree
Showing 7 changed files with 3,003 additions and 1,103 deletions.
25 changes: 13 additions & 12 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
name: docs/gh-pages
on:
create:
tags:
- v*
on: [workflow_dispatch]

jobs:
build-docs:
name: Build docs and push to gh-pages
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v2
Expand All @@ -18,26 +15,30 @@ jobs:
python-version: 3.8

- name: Install poetry
uses: snok/[email protected]

uses: snok/install-poetry@v1
with:
virtualenvs-create: true

- name: Install dependencies
run: poetry install
run: poetry install --no-interaction

- name: Install pandoc
run: sudo apt-get install pandoc

- name: build docs
run: |
source $(poetry env info --path)/activate
cd docs
make clean
make tutorials
make html
cd ..
- name: deploy to gh-pages
uses: Cecilapp/GitHub-Pages-deploy@master
uses: Cecilapp/GitHub-Pages-deploy@v3
env:
EMAIL: [email protected]
GH_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BUILD_DIR: docs/_build/html
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
email: [email protected]
build_dir: docs/_build/html

17 changes: 9 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
name: build & release
on:
create:
tags:
- v*
release:
types: [published]

jobs:
build-n-publish:
name: Build and publish to PyPI
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- name: Checkout branch
uses: actions/checkout@v2
Expand All @@ -18,19 +17,21 @@ jobs:
python-version: 3.8

- name: Install poetry
uses: snok/[email protected]
uses: snok/install-poetry@v1
with:
virtualenvs-create: true

- name: Install dependencies
run: poetry install
run: poetry install --no-interaction

- name: Build and publish to PyPI
run: |
poetry build
poetry publish -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }}
poetry publish -u __token__ -p ${{ secrets.PYPI_TOKEN }}
publish-to-docker:
name: Build Docker image and push to DockerHub
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- name: Checkout branch
uses: actions/checkout@v2
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/test-and-verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python: [3.6, 3.7, 3.8]
python: ["3.8", "3.9", "3.10", "3.11"]
name: Python ${{ matrix.python }} tests
steps:
- name: Checkout branch
Expand All @@ -17,14 +17,16 @@ jobs:
python-version: ${{ matrix.python }}

- name: Install poetry
uses: snok/[email protected]
uses: snok/install-poetry@v1
with:
virtualenvs-create: true

- name: Install dependencies
run: poetry install
run: poetry install --no-interaction

- name: Run tests and generate coverage report
run: |
poetry run pytest --cov=./ --cov-report=xml
poetry run pytest tests/ --cov=./ --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
Expand Down
4 changes: 2 additions & 2 deletions opcsim/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pkg_resources import get_distribution
from importlib.metadata import version

import warnings
import pandas as pd
Expand All @@ -16,4 +16,4 @@

set()

__version__ = get_distribution("opcsim").version
__version__ = version("opcsim")
8 changes: 5 additions & 3 deletions opcsim/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def compute_bin_assessment(opc, refr, kappa, rh_values=[0., 35., 95.]):
assert(isinstance(opc, OPC)), "opc must be an instance of the opcsim.OPC class"

# init the dataframe to hold our results
rv = pd.DataFrame()
rv = list()

for rh in rh_values:
for i, _bins in enumerate(opc.bins):
Expand Down Expand Up @@ -63,15 +63,17 @@ def compute_bin_assessment(opc, refr, kappa, rh_values=[0., 35., 95.]):
bin_assign_hi = opc.calibration_function(values=[cscat_hi])

# add results to the dataframe
rv = rv.append({
rv.append({
"bin_true": i,
"bin_lo": bin_assign_lo[0] if len(bin_assign_lo) > 0 else -99,
"bin_hi": bin_assign_hi[0] if len(bin_assign_hi) > 0 else -99,
"refr_eff": ri,
"rh": rh,
"cscat_hi_ratio": cscat_hi / cscat_hi_exp,
"cscat_lo_ratio": cscat_lo / cscat_lo_exp,
}, ignore_index=True)
})

rv = pd.DataFrame(rv)

# force datatypes to be correct
rv["bin_true"] = rv["bin_true"].astype(int)
Expand Down
Loading

0 comments on commit 35ff58c

Please sign in to comment.