# Stellarator-Database
Includes the functions required to upload DESC or VMEC results to the stellarator database. You can access the database [here](https://ye2698.mycpanel.princeton.edu/).
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.
```bash
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
```bash
git clone https://github.com/PlasmaControl/Stellarator-Database.git
```
Once you get the files,
```bash
cd Stellarator-Database
```
### Building conda environment
```bash
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,
```bash
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](https://github.com/PlasmaControl/Stellarator-Database.git).
```python
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!
Raw data
{
"_id": null,
"home_page": "https://github.com/PlasmaControl/Stellarator-Database/",
"name": "stelladb",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "stellarator tokamak equilibrium perturbation mhd magnetohydrodynamics stability confinement plasma physics optimization design fusion data database",
"author": "Yigit Gunsur Elmacioglu, Rory Conlin, Dario Panici, Egemen Kolemen",
"author_email": "PlasmaControl@princeton.edu",
"download_url": "https://files.pythonhosted.org/packages/fb/9e/4d5b1ee523807671bae439ae7d27e84ec858111edb62f209be5a491fdac9/stelladb-0.2.13.tar.gz",
"platform": null,
"description": "# Stellarator-Database\nIncludes the functions required to upload DESC or VMEC results to the stellarator database. You can access the database [here](https://ye2698.mycpanel.princeton.edu/).\n\nThis is still a work in progress.\n\n## Install using pip\nIf you are on Linux, WSL or MacOS, you should be able to install `stelladb` directly from PyPi.\n```bash\npip install stelladb\n```\nYou 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.\n\n## Install using GIT\n\n### Clone GIT repo\n```bash\ngit clone https://github.com/PlasmaControl/Stellarator-Database.git\n```\nOnce you get the files,\n```bash\ncd Stellarator-Database\n```\n\n### Building conda environment\n```bash\nconda create --name db 'python>=3.9, <=3.12'\nconda activate db\npip install -r requirements.txt\n```\n\nIf you are on Windows, `simsopt` might need additional instructions. If you just want to upload DESC results, follow these steps for creating conda environment,\n```bash\nconda create --name db 'python>=3.9, <=3.12'\nconda activate db\npip install desc-opt selenium\n```\nThen, 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.\n\n## Sample usage\n\nFor more detailed explanation, refer to the notebooks in `tutorials` subfolder in the [repo](https://github.com/PlasmaControl/Stellarator-Database.git).\n\n```python\nfrom desc.examples import get\nfrom desc.equilibrium import Equilibrium\nfrom stelladb import save_to_db_desc, get_desc_by_id\n\neq = get(\"HELIOTRON\")\n\n# if you are using DESC, you can directly upload Equilibrium or \n# EquilibriumFamily objects. For EquilibriumFamily, only the last\n# Equilibrium will be uploaded.\nsave_to_db_desc(eq, config_name=\"test-HELIOTRON\", user=\"username\")\n\n# if you have an outfile, supply the name of it without extension\n# For DESC example, we need to save it first to get the .h5 file\neq.save(\"test_output_HELIOTRON.h5\")\nsave_to_db_desc(\"test_output_HELIOTRON\", config_name=\"another-HELIOTRON\", user=\"username\")\n\n# use copy parameter, if you want the local copy of the files that are uploaded\n# default value is False\nsave_to_db_desc(eq, config_name=\"HELIOTRON-test-name\", user=\"username\", copy=True)\n\n# You can download a specific simulation by ID from the database\n# This function will download the stored .zip file, extract it and return the file names\n# to future use ex. creating Equilibrium object\nnames = get_desc_by_id(id=321, delete_zip=True, return_names=True)\neq2 = Equilibrium.load(names[0])[-1] \n```\n\nYou 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,\n```\nConfiguration data already exists in the database with name: HELIOTRON.\n```\nThen, you should change your `config_name` to match that and try again.\n\n## VMEC Utilities are not tested yet!\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Includes functions to upload DESC and VMEC data to the stellarator database.",
"version": "0.2.13",
"project_urls": {
"Homepage": "https://github.com/PlasmaControl/Stellarator-Database/"
},
"split_keywords": [
"stellarator",
"tokamak",
"equilibrium",
"perturbation",
"mhd",
"magnetohydrodynamics",
"stability",
"confinement",
"plasma",
"physics",
"optimization",
"design",
"fusion",
"data",
"database"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5b3574e42742f0aeff66946785bc0bce793074f13a98d04f5f7ed49c08d4109e",
"md5": "e5cabfdd32d247ddd6468c86b02e4239",
"sha256": "c99a6e986df20a2e89c71ff7e8eeb3728d6dc23e9579203843218552ca53a115"
},
"downloads": -1,
"filename": "stelladb-0.2.13-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e5cabfdd32d247ddd6468c86b02e4239",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 17743,
"upload_time": "2024-08-28T04:57:53",
"upload_time_iso_8601": "2024-08-28T04:57:53.087225Z",
"url": "https://files.pythonhosted.org/packages/5b/35/74e42742f0aeff66946785bc0bce793074f13a98d04f5f7ed49c08d4109e/stelladb-0.2.13-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "fb9e4d5b1ee523807671bae439ae7d27e84ec858111edb62f209be5a491fdac9",
"md5": "67a96013f6aef0ec5eb7a90ea34c78e8",
"sha256": "80df808fbefd299995640fc3cbdfdf3f05737164db4444c7f27ead9b9fae5165"
},
"downloads": -1,
"filename": "stelladb-0.2.13.tar.gz",
"has_sig": false,
"md5_digest": "67a96013f6aef0ec5eb7a90ea34c78e8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 16331,
"upload_time": "2024-08-28T04:57:54",
"upload_time_iso_8601": "2024-08-28T04:57:54.041227Z",
"url": "https://files.pythonhosted.org/packages/fb/9e/4d5b1ee523807671bae439ae7d27e84ec858111edb62f209be5a491fdac9/stelladb-0.2.13.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-28 04:57:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "PlasmaControl",
"github_project": "Stellarator-Database",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "desc-opt",
"specs": []
},
{
"name": "selenium",
"specs": []
},
{
"name": "simsopt",
"specs": []
}
],
"lcname": "stelladb"
}