# 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 `tutorial.ipynb` notebook in the [repo](https://github.com/PlasmaControl/Stellarator-Database.git).
```python
from desc.examples import get
from stelladb import save_to_db_desc
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 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/14/57/4170fcdeade819dab3624d081cd770748e2dbaa56c1c72533c6dc34e2c56/stelladb-0.2.11.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 `tutorial.ipynb` notebook in the [repo](https://github.com/PlasmaControl/Stellarator-Database.git).\n\n```python\nfrom desc.examples import get\nfrom stelladb import save_to_db_desc\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\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.11",
"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": "8b8d43c9bc426fa0b994f3773f67d99682480361d877d68a1eab064ef4953b18",
"md5": "2e7caac22c127b88c29f2fd6098fca49",
"sha256": "8916374cceba8f85f5529a1e36c6396d44a03122fc2a0a37f396d6e0162f2009"
},
"downloads": -1,
"filename": "stelladb-0.2.11-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2e7caac22c127b88c29f2fd6098fca49",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 15136,
"upload_time": "2024-04-29T17:24:11",
"upload_time_iso_8601": "2024-04-29T17:24:11.790475Z",
"url": "https://files.pythonhosted.org/packages/8b/8d/43c9bc426fa0b994f3773f67d99682480361d877d68a1eab064ef4953b18/stelladb-0.2.11-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "14574170fcdeade819dab3624d081cd770748e2dbaa56c1c72533c6dc34e2c56",
"md5": "7d72797bb9d48d70dcfbe806ca757e0f",
"sha256": "5d713015b2d15644b7d75931bc4f785cb1494f8da33f28bf86b4a1a0d73cb612"
},
"downloads": -1,
"filename": "stelladb-0.2.11.tar.gz",
"has_sig": false,
"md5_digest": "7d72797bb9d48d70dcfbe806ca757e0f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 13522,
"upload_time": "2024-04-29T17:24:13",
"upload_time_iso_8601": "2024-04-29T17:24:13.420498Z",
"url": "https://files.pythonhosted.org/packages/14/57/4170fcdeade819dab3624d081cd770748e2dbaa56c1c72533c6dc34e2c56/stelladb-0.2.11.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-29 17:24:13",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "PlasmaControl",
"github_project": "Stellarator-Database",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "stelladb"
}