Skip to main content

Includes functions to upload DESC and VMEC data to the stellarator database.

Project description

Stellarator-Database

Includes the functions required to upload DESC or VMEC results to the stellarator database. You can access the database here.

This is still a work in progress.

Install using pip

If you are on Linux, WSL or MacOS, you should be able to install stelladb directly from PyPi.

pip install stelladb

You may have difficulty installing on Windows due to simsopt dependency. More detailed instructions will come for that. For now, you can use the repo on Windows with slight difference on building the environment.

Install using GIT

Clone GIT repo

git clone https://github.com/PlasmaControl/Stellarator-Database.git

Once you get the files,

cd Stellarator-Database

Building conda environment

conda create --name db 'python>=3.9, <=3.12'
conda activate db
pip install -r requirements.txt

If you are on Windows, simsopt might need additional instructions. If you just want to upload DESC results, follow these steps for creating conda environment,

conda create --name db 'python>=3.9, <=3.12'
conda activate db
pip install desc-opt selenium

Then, you can upload to database inside the repo, or anywhere where you can access the module stelladb. You can either git clone the whole repository or you can just get the stelladb folder of the repo and copy it to where you want to call the functions from.

Sample usage

For more detailed explanation, refer to the notebooks in tutorials subfolder in the repo.

from desc.examples import get
from desc.equilibrium import Equilibrium
from stelladb import save_to_db_desc, get_desc_by_id

eq = get("HELIOTRON")

# if you are using DESC, you can directly upload Equilibrium or 
# EquilibriumFamily objects. For EquilibriumFamily, only the last
# Equilibrium will be uploaded.
save_to_db_desc(eq, config_name="test-HELIOTRON", user="username")

# if you have an outfile, supply the name of it without extension
# For DESC example, we need to save it first to get the .h5 file
eq.save("test_output_HELIOTRON.h5")
save_to_db_desc("test_output_HELIOTRON", config_name="another-HELIOTRON", user="username")

# use copy parameter, if you want the local copy of the files that are uploaded
# default value is False
save_to_db_desc(eq, config_name="HELIOTRON-test-name", user="username", copy=True)

# You can download a specific simulation by ID from the database
# This function will download the stored .zip file, extract it and return the file names
# to future use ex. creating Equilibrium object
names = get_desc_by_id(id=321, delete_zip=True, return_names=True)
eq2 = Equilibrium.load(names[0])[-1]  

You can give config_name as you wish. However, if there is an existing configuration with same parameters in the database, you will get following error,

Configuration data already exists in the database with name: HELIOTRON.

Then, you should change your config_name to match that and try again.

VMEC Utilities are not tested yet!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stelladb-0.2.12.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stelladb-0.2.12-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

Details for the file stelladb-0.2.12.tar.gz.

File metadata

  • Download URL: stelladb-0.2.12.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for stelladb-0.2.12.tar.gz
Algorithm Hash digest
SHA256 37f426ee9bed46a169c0e15e58c9c91c001ef73da0a05a7b06648e8143a61cf8
MD5 5a39e278fadc4bfa3bd005ac93eabffc
BLAKE2b-256 220cb76b6f61ce09955087d7329809d1e295db161f58971a5dd71f0157440582

See more details on using hashes here.

File details

Details for the file stelladb-0.2.12-py3-none-any.whl.

File metadata

  • Download URL: stelladb-0.2.12-py3-none-any.whl
  • Upload date:
  • Size: 16.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for stelladb-0.2.12-py3-none-any.whl
Algorithm Hash digest
SHA256 9df26a3a673cf4a3c949c61f9d9390b6dc9cb655a513186afa2047085cc3c1ec
MD5 9e17b5afa2e184655e2d5a316d832dc2
BLAKE2b-256 526e91427dd8867fffccbc43d7f026166b45398fc9160df78586024f66f70438

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page