{"id":26096448,"url":"https://github.com/projecttorreypines/eggo.jl","last_synced_at":"2026-03-07T09:32:02.801Z","repository":{"id":280888948,"uuid":"936953781","full_name":"ProjectTorreyPines/EGGO.jl","owner":"ProjectTorreyPines","description":"EGGO: Equilibrium Grad-Shafranov Green's-function Optimizer","archived":false,"fork":false,"pushed_at":"2026-03-06T23:31:53.000Z","size":124434,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":11,"default_branch":"master","last_synced_at":"2026-03-07T04:28:10.135Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Julia","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ProjectTorreyPines.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null,"notice":"NOTICE.md","maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-02-22T02:00:29.000Z","updated_at":"2026-03-06T23:21:51.000Z","dependencies_parsed_at":"2025-04-17T01:41:17.378Z","dependency_job_id":"c28c1592-edfe-419f-a017-74db00b59ccc","html_url":"https://github.com/ProjectTorreyPines/EGGO.jl","commit_stats":null,"previous_names":["projecttorreypines/eggo.jl"],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/ProjectTorreyPines/EGGO.jl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProjectTorreyPines%2FEGGO.jl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProjectTorreyPines%2FEGGO.jl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProjectTorreyPines%2FEGGO.jl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProjectTorreyPines%2FEGGO.jl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ProjectTorreyPines","download_url":"https://codeload.github.com/ProjectTorreyPines/EGGO.jl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProjectTorreyPines%2FEGGO.jl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30210840,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T09:02:10.694Z","status":"ssl_error","status_checked_at":"2026-03-07T09:02:08.429Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":"2025-03-09T14:56:01.342Z","updated_at":"2026-03-07T09:32:02.767Z","avatar_url":"https://github.com/ProjectTorreyPines.png","language":"Julia","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EGGO.jl\n\nEGGO.jl is a Julia package for equilibrium reconstruction and plasma physics analysis using neural networks. It provides functionality for predicting plasma equilibria from diagnostic measurements and boundary data.\n\n## Installation\n\n```julia\nusing Pkg\nPkg.add(\"EGGO\")\n```\n\n## Usage Examples\n\n### Basic Equilibrium Reconstruction from Boundary Data\n\n```julia\nusing EGGO\nusing EGGO.IMAS\n\n# Set up parameters\nnb = 101\nnw = 129\nb0 = 2.0\nr0 = 1.6955\npend = 0.1\n\n# Example boundary and profile data (from test_efit01)\nRb_target = [1.09559171, 1.0997446376, ...] # Boundary R coordinates\nZb_target = [-0.05000000074505806, 0.040000000596046456, ...] # Boundary Z coordinates\nffp_target = [...]  # F*F' profile data\npp_target = [...]   # Pressure profile data\n\n# Get model components\nmodel_name = :d3d_efit01\ngreen = EGGO.get_greens_function_tables(model_name)\nbasis_functions = EGGO.get_basis_functions(model_name)\nbasis_functions_1d, bf1d_itp = EGGO.get_basis_functions_1d(model_name)\nwall = EGGO.get_wall(model_name)\nNNmodel = EGGO.get_model(model_name)\n\n# Fit profiles\npp_fit, ffp_fit = EGGO.fit_ppffp(pp_target, ffp_target, basis_functions_1d)\n\n# Predict equilibrium\nJt, psirz, Ip = EGGO.predict_model_from_boundary(\n    Rb_target, Zb_target, pp_fit, ffp_fit, NNmodel, \n    green, basis_functions, nothing, 0.0, false\n)\n\n# Extract key quantities\nΨaxis, Raxis, Zaxis, Ψbnd, ffp, pp = EGGO.get_ΨaxisΨbndffppp(\n    psirz, green, basis_functions, basis_functions_1d, \n    bf1d_itp, wall, pp_fit, ffp_fit\n)\n\n# Create IMAS data structure\ndd = IMAS.dd()\neqt = resize!(dd.equilibrium.time_slice)\nEGGO.fill_eqt(eqt, psirz, green, wall, pp, ffp, b0, r0, pend, Ψbnd, Ψaxis, Raxis, Zaxis)\n```\n\n### Equilibrium Reconstruction from Coil Currents\n\n```julia\nusing EGGO\n\n# Example coil current data (from test_efit01_coils)\nffp_target = [-3.05929054, -2.99817803, ...]  # F*F' profile\npp_target = [-292086.832, -291584.589, ...]   # Pressure profile\nfcurrt_target = [...]  # F-coil currents\necurrt_target = zeros(6)  # E-coil currents\n\n# Get model for coil-based reconstruction\nmodel_name = :d3d_efit01efit02cake02_coils\ngreen = EGGO.get_greens_function_tables(model_name)\nbasis_functions = EGGO.get_basis_functions(model_name)\nbasis_functions_1d, bf1d_itp = EGGO.get_basis_functions_1d(model_name)\nwall = EGGO.get_wall(model_name)\nNNmodel = EGGO.get_model(model_name)\n\n# Fit profiles\npp_fit, ffp_fit = EGGO.fit_ppffp(pp_target, ffp_target, basis_functions_1d)\n\n# Predict from coil currents\nJt, psirz, Ip = EGGO.predict_model_from_coils(\n    pp_fit, ffp_fit, ecurrt_target, fcurrt_target, \n    NNmodel, green, basis_functions\n)\n```\n\n### Free-Boundary Reconstruction with Diagnostics\n\n```julia\nusing EGGO\n\n# Example diagnostic data\nshot = 168830\nfwtmp2 = [1.0, 1.0, 1.0, ...]  # Mirnov coil weights\nfwtsi = [1.0, 1.0, 1.0, ...]   # MSE weights\nexpsi = [-0.403, 0.061, ...]    # MSE measurements\nexpmp2 = [0.575, 0.578, ...]    # Mirnov measurements\nfcurrt = [-249457.5, -68876.1, ...]  # F-coil currents\necurrt = [-41790.4, -40929.4, ...]   # E-coil currents\nIp = 1.26e6  # Plasma current\n\n# Get free-boundary model\nmodel_name = :d3d_cakenn_free\ngreen = EGGO.get_greens_function_tables(model_name)\nbasis_functions = EGGO.get_basis_functions(model_name)\nbasis_functions_1d, bf1d_itp = EGGO.get_basis_functions_1d(model_name)\nwall = EGGO.get_wall(model_name)\nNNmodel = EGGO.get_model(model_name)\nNNmodel1D = EGGO.get_model1d(model_name)\n\n# Predict equilibrium and profiles\ny_psi, y_1d = EGGO.predict_psipla_free(\n    shot, expsi, fwtsi, expmp2, fwtmp2, fcurrt, ecurrt, Ip,\n    NNmodel, NNmodel1D, green, basis_functions\n)\n\n# Calculate boundary\nRb, Zb = EGGO.calculate_boundary(y_psi, fcurrt, ecurrt, green, basis_functions, wall)\n```\n\n### Kinetic Profile Prediction\n\n```julia\n# Thomson scattering data\nr_tom = [1.954, 1.924, 1.890, ...]  # Radial positions\nz_tom = [-0.067, -0.065, -0.061, ...]  # Vertical positions  \nne_tom = [5.24e19, 5.07e19, 4.99e19, ...]  # Electron density\nTe_tom = [2388.3, 2541.4, 2617.2, ...]     # Electron temperature\n\n# CER data\nr_cer = [1.9, 2.0, 2.1]  # CER radial positions\nz_cer = [0.0, 0.0, 0.0]  # CER vertical positions\nnc_cer = [1.e19, 0.5e19, 0.25e19]  # Carbon density\n\n# Predict kinetic profiles\ny_ne, y_Te, y_nc = EGGO.predict_kinetic(\n    y_psi[:,1], r_tom, z_tom, ne_tom, Te_tom,\n    r_cer, z_cer, nc_cer, fcurrt, ecurrt,\n    green, wall, basis_functions, bf1d_itp\n)\n```\n\n### Processing Time Series Data\n\n```julia\nusing EGGO\nusing EGGO.IMAS\n\n# Load IMAS data from HDF5\ndd = IMAS.hdf2imas(\"./dd_200000.h5\")\n\n# Set up model\nmodel_name = :d3d_cakenn_free\ngreen = EGGO.get_greens_function_tables(model_name)\nbasis_functions = EGGO.get_basis_functions(model_name)\nbasis_functions_1d, bf1d_itp = EGGO.get_basis_functions_1d(model_name)\nwall = EGGO.get_wall(model_name)\nNNmodel = EGGO.get_model(model_name)\nNNmodel1D = EGGO.get_model1d(model_name)\n\n# Process time series\ntimes = dd.magnetics.time\nfor t in times\n    # Extract vectors from IMAS data\n    shot, expsi, fwtsi, expmp2, fwtmp2, fcurrt, ecurrt, Ip = \n        EGGO.get_vectors_from_dd(dd, t, green)\n    \n    # Predict equilibrium\n    y_psi, y1d = EGGO.predict_psipla_free(\n        shot, expsi, fwtsi, expmp2, fwtmp2, fcurrt, ecurrt, Ip,\n        NNmodel, NNmodel1D, green, basis_functions\n    )\n    \n    # Fit profiles if needed\n    psirz, pp_fit, ffp_fit, ne, Te, nc, Ti, Vt = EGGO.fit_profiles(\n        y_psi, y1d, fcurrt, ecurrt, green, basis_functions, \n        basis_functions_1d, wall\n    )\n    \n    # Calculate boundary if needed\n    Rb, Zb = EGGO.calculate_boundary(y_psi, fcurrt, ecurrt, green, basis_functions, wall)\nend\n```\n\n## Available Models\n\nEGGO.jl includes several pre-trained models for different tokamaks and reconstruction scenarios:\n\n- `:d3d_efit01` - DIII-D fixed-boundary \n- `:d3d_efit01efit02cake02` - DIII-D fixed-boundary multi-model ensemble \n- `:d3d_efit01efit02cake02_coils` - DIII-D fix-boundary multi-model ensemble with coil currents\n- `:d3d_cakenn_free` :- DIII-D free-boundary reconstruction\n\n## Testing\n\nRun the test suite to verify installation:\n\n```julia\nusing Pkg\nPkg.test(\"EGGO\")\n```\n\nThe test suite includes examples for:\n- Fixed-boundary reconstruction (`test_efit01`)\n- Coil-based reconstruction (`test_efit01_coils`) \n- Multi-model reconstruction (`test_efit01efit02cake02`)\n- Free-boundary reconstruction with diagnostics (`test_cakenn_free`)\n\nSee `test/runtests.jl` for detailed examples and usage patterns.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprojecttorreypines%2Feggo.jl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprojecttorreypines%2Feggo.jl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprojecttorreypines%2Feggo.jl/lists"}