diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 17f5320..dc87590 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -2,31 +2,44 @@ name: install-and-test-workflow on: [push] +permissions: + contents: read + +env: + # using uv pip requires an existing venv by default + # allows installating packages in the system + UV_SYSTEM_PYTHON: true + jobs: install-and-test: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python_version: ["3.12", "3.11", "3.10", "3.9"] steps: - uses: actions/checkout@v4 - - name: Set up Python 3.9 + - name: Set up Python ${{matrix.python_version}} uses: actions/setup-python@v5 with: - python-version: 3.9 + python-version: ${{matrix.python_version}} + - name: Install uv + run: | + curl -LsSf https://astral.sh/uv/install.sh | sh + # uses: astral-sh/setup-uv@v3 - name: Install dependencies run: | - pip install --upgrade pip - # we need the latest nomad version for testing - pip install nomad-lab[infrastructure]@git+https://github.com/nomad-coe/nomad.git@develop - pip install '.[dev]' --index-url https://gitlab.mpcdf.mpg.de/api/v4/projects/2187/packages/pypi/simple - pip install coverage coveralls + uv pip install -e '.[dev]' - name: Test with pytest run: | - python -m coverage run -m pytest -sv - - name: Submit to coveralls - continue-on-error: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - coveralls --service=github + pytest + # python -m coverage run -m pytest -sv + # - name: Submit to coveralls + # continue-on-error: true + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # run: | + # coveralls --service=github # - name: Test with nomad # run: | # python -m nomad.cli parse tests/data/example.archive.json @@ -39,14 +52,14 @@ jobs: uses: actions/setup-python@v5 with: python-version: 3.9 + - name: Install uv + uses: astral-sh/setup-uv@v3 - name: Build the package run: | - pip install --upgrade pip - pip install build - python -m build --sdist + uv build --sdist - name: Install the package run: | - pip install dist/*.tar.gz --index-url https://gitlab.mpcdf.mpg.de/api/v4/projects/2187/packages/pypi/simple + uv pip install dist/*.tar.gz --index-url https://gitlab.mpcdf.mpg.de/api/v4/projects/2187/packages/pypi/simple # - name: Test with nomad # run: | # python -m nomad.cli parse tests/data/example.archive.json diff --git a/pyproject.toml b/pyproject.toml index a982b32..5ac88f3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,6 +30,9 @@ maintainers = [ ] requires-python = ">=3.9" dependencies = [ + "nomad-lab>=1.3.0", + "nomad-schema-plugin-run>=1.0.1", + "nomad-schema-plugin-simulation-workflow>=1.0.1", "rdkit", "openpyxl", "lxml_html_clean" @@ -40,6 +43,9 @@ license = { file = "LICENSE" } "Homepage" = "https://github.com/FAIRmat-NFDI/nomad-perovskite-solar-cells-database" Repository = "https://github.com/FAIRmat-NFDI/nomad-perovskite-solar-cells-database" +[tool.uv] +index-url = "https://gitlab.mpcdf.mpg.de/api/v4/projects/2187/packages/pypi/simple" + [project.optional-dependencies] dev = ["ruff", "pytest", "structlog"] diff --git a/src/perovskite_solar_cell_database/data_tools/eqe_parser.py b/src/perovskite_solar_cell_database/data_tools/eqe_parser.py index e9e8c02..fb8bcf5 100644 --- a/src/perovskite_solar_cell_database/data_tools/eqe_parser.py +++ b/src/perovskite_solar_cell_database/data_tools/eqe_parser.py @@ -266,7 +266,7 @@ def calculate_jsc(self): energy_AM15 = np.array(df_am15[df_am15.columns[1]]) spectrum_AM15 = np.array(df_am15[df_am15.columns[2]]) spectrum_AM15G_interp = np.interp(x, energy_AM15, spectrum_AM15) - jsc_calc = integrate.cumtrapz(y * spectrum_AM15G_interp, x) + jsc_calc = integrate.cumulative_trapezoid(y * spectrum_AM15G_interp, x) jsc = max(jsc_calc * q * 1e4) return jsc diff --git a/tests/data/example.archive.json b/tests/data/example.archive.json index 99b94fe..a4a340a 100644 --- a/tests/data/example.archive.json +++ b/tests/data/example.archive.json @@ -73,7 +73,7 @@ "composition_leadfree": false, "additives_compounds": "Cl", "band_gap": 1.6, - "band_gap_graded": false, + "band_gap_graded": "false", "band_gap_estimation_basis": "Composition", "storage_time_until_next_deposition_step": "Unknown", "storage_atmosphere": "Unknown" @@ -255,4 +255,4 @@ "irradiance_measured": false } } -} \ No newline at end of file +}