{"id":20520282,"url":"https://github.com/plasmacontrol/d3d_signals","last_synced_at":"2025-06-24T23:07:03.030Z","repository":{"id":91945053,"uuid":"540075604","full_name":"PlasmaControl/d3d_signals","owner":"PlasmaControl","description":"Defines mapping of D3D MDS/PTdata signals to local storage on PU systems as yaml files","archived":false,"fork":false,"pushed_at":"2023-03-29T19:06:21.000Z","size":87,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-06-20T01:48:03.888Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PlasmaControl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-22T16:39:59.000Z","updated_at":"2023-03-08T20:39:54.000Z","dependencies_parsed_at":"2023-07-22T05:16:33.718Z","dependency_job_id":null,"html_url":"https://github.com/PlasmaControl/d3d_signals","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/PlasmaControl/d3d_signals","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PlasmaControl%2Fd3d_signals","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PlasmaControl%2Fd3d_signals/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PlasmaControl%2Fd3d_signals/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PlasmaControl%2Fd3d_signals/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PlasmaControl","download_url":"https://codeload.github.com/PlasmaControl/d3d_signals/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PlasmaControl%2Fd3d_signals/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261771112,"owners_count":23207218,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T22:18:58.340Z","updated_at":"2025-06-24T23:07:03.004Z","avatar_url":"https://github.com/PlasmaControl.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# D3D signals\nDefines mapping of D3D MDS/PTdata signals to local storage on PU systems as yaml files\n\nThese definitions come in handy when workgin with D3D signals and provide \n* A handy way of accessing them, for example in a locally cached data file\n* Quickly pulling data from MDS or PTDATA without having to remember where data is stored\n\n## Installation and usage\n\nThis package is pip-installable. The workflow is to clone the git repository, activate your\nvirtual environment, and the install the package:\n\n```bash\n$ git clone git@github.com:PlasmaControl/d3d_signals.git\n$ cd d3d_signals\n$ source venv/bin/activate\n(venv)$ pip install .\n```\n\nHere `source venv/bin/activate` activates a pip virtual environment as described in the\n[python documentation](https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/). Other people may use conda instead.\n\n\nIf at any point the code was updated, pull the newest code and upgrade the package:\n```bash\n(venv)$ git pull\n(venv)$ pip install --upgrade .\n```\n\n\nNow the data files in this package can be accessed using `resourcelib`:\n\n```python\nfrom os.path import join\nimport importlib.resources\nimport yaml\nimport d3d_signals\n\nresource_path = importlib.resources.files(\"d3d_signals\")\n\nwith open(join(resource_path, \"signals_0d.yaml\"), \"r\") as fp:\n    signals_0d = yaml.safe_load(fp)\n\nwith open(join(resource_path, \"signals_1d.yaml\"), \"r\") as fp:\n    signals_1d = yaml.safe_load(fp)\n\n\n```\n\n\n## Example uses\nThe signals used in the repository can be used like this:\n```python\nimport importlib.resources\nimport yaml\nimport matplotlib.pyplot as plt\nimport MDSplus as mds\n\nimport d3d_signals\n\nresource_path = importlib.resources.files(\"d3d_signals\")\n\nwith open(join(resource_path, \"signals_0d.yaml\"), \"r\") as fp:\n    signals_0d = yaml.safe_load(fp)\n\nsig_pinj = signals_0d[\"pinj\"]\n\nc = mds.Connection(\"atlas.gat.com\")\nc.openTree(sig_pinj[\"tree\"], 142111)\n\nz = c.get(f\"_s={sig_pinj['node']}\").data()\nz_units = c.get(\"units_of(dim_of(_s))\")\n\nx = c.get(sig_pinj['node']).dim_of().data()\nx_units = c.get(f\"\"\"UNITS_OF({sig_pinj['node']})\"\"\").data()\nplt.plot(x, z)\nplt.xlabel(x_units)\nplt.ylabel(z_units)\nplt.title(\"pinj\")\nplt.savefig(\"pinj.png\")\n```\n\n![Result](pinj.png)\n\n\nSimilar for a profile:\n```python\nimport importlib.resources\nimport yaml\nimport matplotlib.pyplot as plt\nimport MDSplus as mds\n\nimport d3d_signals\n\nresource_path = importlib.resources.files(\"d3d_signals\")\n\nwith open(join(resource_path, \"signals_0d.yaml\"), \"r\") as fp:\n    signals_1d = yaml.safe_load(fp)\n\n\nsig_ne = signals_1d[\"edensfit\"]\n\nc = mds.Connection(\"atlas.gat.com\")\nc.openTree(sig_ne[\"tree\"], 142111)\n\nzdata = c.get(f\"_s={sig_ne['node']}\").data()\nzunits = c.get(\"units_of(_s)\")\n\nrank = zdata.ndim\n# time-base\nxdata = c.get(\"dim_of(_s)\")\nxunits = c.get(\"units_of(dim_of(_s))\")\nydata = c.get(\"dim_of(_s, 1)\")\nyunits = c.get(\"units_of(dim_of(_s, 1))\")\n# space-base\n\n#y = c.get(sig_ne['node']).data()\n#y_units = c.get(f\"\"\"UNITS_OF({sig_ne['node']})\"\"\").data()\nfig = plt.contourf(xdata, ydata, zdata)\nplt.xlabel(xunits)\nplt.ylabel(yunits)\nplt.colorbar(label=zunits)\nplt.title(\"edensfit (zipfit)\")\nplt.savefig(\"ne.png\")\n```\n\n![Result](ne.png)\n\n\nAn example of how the mapping are used in version-controlled datasets is \nhere [dataset_d3d_100](https://github.com/PPPLDeepLearning/dataset_D3D_100).\n\n\nThe [d3d_loader](https://github.com/PlasmaControl/d3d_loaders/tree/main/d3d_loaders) repository\nuses the signal nodes and `map_to` values to load the MDS signals in locally cached hdf5 files.\n\nTo create such a cache, use the `downloading.py` script provided in this repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplasmacontrol%2Fd3d_signals","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplasmacontrol%2Fd3d_signals","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplasmacontrol%2Fd3d_signals/lists"}