Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 17 additions & 33 deletions .github/workflows/generate_database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,50 +12,34 @@ jobs:
strategy:
fail-fast: false
matrix:
species: [Sr87, Sr88, Yb171, Yb173, Yb174]
species: [Sr87_mqdt, Sr88_mqdt, Yb171_mqdt, Yb173_mqdt, Yb174_mqdt]
include:
# use n_max=220 for tags and main, but only n_max=110 for PRs, etc.
- n_max: ${{ (startsWith(github.ref, 'refs/tags/') || contains(github.ref, 'main')) && 220 || 110 }}
# for isotopes with hyperfine structure, we only include high-l states up to n=110 (otherwise the database size gets too large)
- species: Sr87
extra_args: "--n-max-high-l 110"
- species: Yb171
extra_args: "--n-max-high-l 110"
- species: Yb173
extra_args: "--n-max-high-l 110"
- extra_args: "--max-delta-nu 10 --all-nu-up-to 30"
# use nu-max=220 for tags and main, but only nu-max=100 for PRs, etc.
- arg_max: ${{ (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main') && '--nu-max 220' || '--nu-max 100' }}
name: ${{ matrix.species }}
runs-on: ubuntu-latest
timeout-minutes: 300
permissions: # needed to allow julia-actions/cache to proactively delete old caches that it has created
actions: write
contents: read
steps:
- uses: actions/checkout@v6
with:
submodules: 'true'

- uses: julia-actions/setup-julia@v2
with:
version: 1.12
arch: x64
- uses: julia-actions/cache@v2

- name: Instantiate julia environment and link local MQDT.jl
run: julia --project=. -e 'import Pkg; Pkg.develop(path="MQDT.jl"); Pkg.instantiate()'

- name: Install and link local rydstate python package
run: julia --project=. -e 'using CondaPkg; CondaPkg.withenv() do; run(`python -m pip install -e rydstate`); end'

- name: Run generate_database
run: julia --project=. generate_database.jl ${{ matrix.species }} --directory database --n-max ${{ matrix.n_max }} ${{ matrix.extra_args }}

- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Run generate_database.py
run: uv run py-spy record -o profile_${{ matrix.species }}.svg -- generate_database ${{ matrix.species }} --directory database/${{ matrix.species }}_v$(uv version --short) ${{ matrix.arg_max }} ${{ matrix.extra_args }}
- name: Upload artifacts
uses: actions/upload-artifact@v6
uses: actions/upload-artifact@v7
with:
name: database-${{ matrix.species }}
path: |
database/*/*.parquet

- name: Upload profile
if: always()
uses: actions/upload-artifact@v7
with:
name: profile-${{ matrix.species }}
path: profile*.svg

github-release:
name: Release database files to github releases
Expand All @@ -69,7 +53,7 @@ jobs:

steps:
- name: Download all the database files
uses: actions/download-artifact@v7
uses: actions/download-artifact@v8
with:
path: database
pattern: database-*
Expand All @@ -88,7 +72,7 @@ jobs:
done

- name: Release zipped database folders
uses: softprops/action-gh-release@v2
uses: softprops/action-gh-release@v3
with:
files: database/*.zip
draft: true
9 changes: 1 addition & 8 deletions .github/workflows/pre_commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,10 @@ jobs:
- uses: actions/setup-python@v6
with:
python-version: "3.11"
- uses: julia-actions/setup-julia@v2
with:
version: '1'
- uses: julia-actions/cache@v2
- name: Install JuliaFormatter
run: |
julia -e 'import Pkg; Pkg.add("JuliaFormatter")'
- uses: pre-commit/action@v3.0.1
- run: git diff --output=format.patch --exit-code || { cat format.patch; false; }
if: failure()
- uses: actions/upload-artifact@v6
- uses: actions/upload-artifact@v7
if: failure()
with:
name: format.patch
Expand Down
14 changes: 11 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
# Ignore julia specific files
Manifest*.toml
.CondaPkg/
# Ignore build and cache directories
__pycache__/
.ruff_cache/
.mypy_cache/
.venv/
*.egg-info/
wheelhouse/
build/
dist/
.pytest_cache/

# Ignore local development files
playground/

# Ignore the generated databases
database/
profiling/
profiling*.svg
7 changes: 2 additions & 5 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "MQDT.jl"]
path = MQDT.jl
url = git@github.com:pairinteraction/MQDT.jl.git
[submodule "rydstate"]
path = rydstate
[submodule "RydState"]
path = RydState
url = git@github.com:pairinteraction/rydstate.git
14 changes: 11 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@ repos:
hooks:
- id: remove-tabs

- repo: "https://github.com/domluna/JuliaFormatter.jl"
rev: "v2.1.2"
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.2
hooks:
- id: "julia-formatter"
- id: ruff
args: ["--fix", "--exit-non-zero-on-fix"]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.15.0
hooks:
- id: mypy
additional_dependencies: ["rydstate == 0.9"]
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.13.1
3 changes: 0 additions & 3 deletions CondaPkg.toml

This file was deleted.

1 change: 0 additions & 1 deletion MQDT.jl
Submodule MQDT.jl deleted from 2a9324
12 changes: 0 additions & 12 deletions Project.toml

This file was deleted.

33 changes: 16 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
# Tool for generating the MQDT database tables in the cloud

Database of states and matrix elements calculated with multichannel quantum defect theory.
Create the database including tables of states and matrix elements calculated with single-channel quantum defect theory.
Database tables are available through [GitHub Releases](https://github.com/pairinteraction/database-mqdt/releases).

## Generate new tables locally
To generate the database tables locally, first make sure you also downloaded MQDT.jl and rydstate as submodules (e.g. run `git submodule update --init`).

Then, initialize the julia environment and link against the MQDT.jl package
```bash
julia --project=. -e 'import Pkg; Pkg.develop(path="MQDT.jl"); Pkg.instantiate()'
```
Also link against the python rydstate package via
```bash
julia --project=. -e 'using CondaPkg; CondaPkg.withenv() do; run(`python -m pip install -e rydstate`); end'
```

Finally, you can run the script to generate the tables via
Run the script to generate the tables via
```bash
julia --project=. generate_database.jl Yb174
uv run generate_database <species_mqdt> --nu-max <nu-max> --directory <directory>
```

## Generate a new release
To generate a new release with all the important tables, simply create and push a new annotated tag with a tag name of the form `v*.*` .
This will run the `generate_database.yml` workflow, where first all tables are created (this happens for all commits, not only tags),
and then in addition uploads the zipped versions of the tables to a new release with name `v*.*` .
To generate a new release with all the important tables, simply create and push a new annotated tag with a tag name of the form `v*.*`.
This will run the `generate_database.yml` workflow, where first all tables are created,
and then in addition the zipped versions of the tables are uploaded to a new release with name `v*.*`.
The release is created in draft mode, so you can double-check, that all database tables are included and optionally add a release text.
Once you are happy with the release draft, don't forget to publish the release.

## Misc

### Profiling / Benchmarking
To check the performance of this tool and to look for bottlenecks in the code, you can use [py-spy](https://github.com/benfred/py-spy) to profile the code.
To do so simply run the following command:

```bash
uv run py-spy record -o profiling.svg -- generate_database <species_mqdt> --nu-max <nu-max>
```
1 change: 1 addition & 0 deletions RydState
Submodule RydState added at dfeca0
96 changes: 0 additions & 96 deletions angular.jl

This file was deleted.

Loading
Loading