Skip to content

Commit

Permalink
Changing SynthDiag -> FusionSyntheticDiagnostics
Browse files Browse the repository at this point in the history
Also, falling back to using IMASdd since IMAS is not registered yet.

When IMAS gets registered, following changes will revert using IMAS.

src/FusionSyntheticDiagnostics.jl:3 using IMAS: IMAS
src/gas_injection.jl:30 Delete
src/gas_injection.jl:31 Uncomment
src/interferometer.jl:26 Delete
src/interferometer.jl:27 Uncomment
src/langmuir_probes.jl:23 Delete
src/langmuir_probes.jl:24 Uncomment
Some minor changes in runtests might be required.
  • Loading branch information
anchal-physics committed Oct 5, 2024
1 parent 52d3f73 commit b9f5472
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 55 deletions.
6 changes: 3 additions & 3 deletions NOTICE.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
GGDUtils.jl
FusionSyntheticDiagnostics.jl
=========

The purpose of this NOTICE file is to provide legal notices and acknowledgments that must be displayed to users in any derivative works or distributions. This file does not alter the terms of the Apache 2.0 license that governs the use and distribution of the SynthDiag.jl package.
The purpose of this NOTICE file is to provide legal notices and acknowledgments that must be displayed to users in any derivative works or distributions. This file does not alter the terms of the Apache 2.0 license that governs the use and distribution of the FusionSyntheticDiagnostics.jl package.

GGDUtils.jl was originally developed under the ProjectTorreyPines by the Magnetic Fusion Energy group at General Atomics.
FusionSyntheticDiagnostics.jl was originally developed under the ProjectTorreyPines by the Magnetic Fusion Energy group at General Atomics.

If this software contributes to an academic publication, please cite it as follows:
A. Gupta, D. Eldon, H. Anand, A. Dautt-Silva, S. De Pascuale, J. Lore, O. Meneghini, and J.S. Park, "Plasma boundary control development using a time-dependent scrape-off layer model in closed-loop simulations", Nucl. Mater. Energy, manuscript in preparation for PSI conference (2024).
Expand Down
12 changes: 6 additions & 6 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name = "SynthDiag"
name = "FusionSyntheticDiagnostics"
uuid = "c6e34158-aa22-49e4-bb12-15cbcb518ce6"
authors = ["Anchal Gupta <guptaa@fusion.gat.com>"]
version = "1.0.3"
Expand All @@ -7,8 +7,8 @@ version = "1.0.3"
ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63"
DSP = "717857b8-e6f2-59f4-9121-6e50c889abd2"
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
GGDUtils = "b7b5e640-9b39-4803-84eb-376048795def"
IMAS = "13ead8c1-b7d1-41bb-a6d0-5b8b65ed587a"
IMASdd = "c5a45a97-b3f9-491c-b9a7-aa88c3bc0067"
IMASggd = "b7b5e640-9b39-4803-84eb-376048795def"
Interpolations = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59"
LsqFit = "2fda8390-95c7-5789-9bda-21331edee243"
PhysicalConstants = "5ad8b20f-a522-5ce9-bfc9-ddf1d5bda6ab"
Expand All @@ -23,13 +23,13 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
ArgParse = "1"
DSP = "0.7.9"
DelimitedFiles = "1.9.1"
GGDUtils = "1.0.3"
IMAS = "1.2.2"
IMASdd = "2"
IMASggd = "2"
Interpolations = "0.15.1"
LsqFit = "0.15.0"
PhysicalConstants = "0.2.3"
Plots = "1.40.3"
QuadGK = "2.9.4"
StaticArrays = "1.9.2"
Statistics = "1.9.0"
julia = ">= 1.10"
julia = "1.10"
16 changes: 7 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
# SynthDiag.jl
# FusionSyntheticDiagnostics.jl

![Format Check](https://github.com/ProjectTorreyPines/SynthDiag.jl/actions/workflows/format_check.yml/badge.svg)
![Docs](https://github.com/ProjectTorreyPines/SynthDiag.jl/actions/workflows/make_docs.yml/badge.svg)
![Tests](https://github.com/ProjectTorreyPines/SynthDiag.jl/actions/workflows/test.yml/badge.svg)
![Format Check](https://github.com/ProjectTorreyPines/FusionSyntheticDiagnostics.jl/actions/workflows/format_check.yml/badge.svg)
![Docs](https://github.com/ProjectTorreyPines/FusionSyntheticDiagnostics.jl/actions/workflows/make_docs.yml/badge.svg)
![Tests](https://github.com/ProjectTorreyPines/FusionSyntheticDiagnostics.jl/actions/workflows/test.yml/badge.svg)

Package that defines synthetic diagnostics to generate sensor data based on plasma profile and syntehtic actuators. For installation and usage instructions, see the [online documentation](https://projecttorreypines.github.io/SynthDiag.jl/stable). For documentation on under development branch, see [dev online documentation](https://projecttorreypines.github.io/SynthDiag.jl/dev).
Package that defines synthetic diagnostics to generate sensor data based on plasma profile and synthetic actuators for fusion devices. For installation and usage instructions, see the [online documentation](https://projecttorreypines.github.io/FusionSyntheticDiagnostics.jl/stable). For documentation on under development branch, see [dev online documentation](https://projecttorreypines.github.io/FusionSyntheticDiagnostics.jl/dev).

## Installation

SynthDiag is registered with public repository [FuseRegistry](https://github.com/ProjectTorreyPines/FuseRegistry.jl/). First [install Julia](https://github.com/JuliaLang/juliaup?tab=readme-ov-file#juliaup---julia-version-manager), then:
First [install Julia](https://github.com/JuliaLang/juliaup?tab=readme-ov-file#juliaup---julia-version-manager), then:

```julia
using Pkg
Pkg.Registry.add(RegistrySpec(url="https://github.com/ProjectTorreyPines/FuseRegistry.jl.git"))
Pkg.Registry.add("General")
Pkg.add("SynthDiag")
Pkg.add("FusionSyntheticDiagnostics")
```
8 changes: 4 additions & 4 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
using Documenter
using SynthDiag
using FusionSyntheticDiagnostics

makedocs(;
modules=[SynthDiag],
modules=[FusionSyntheticDiagnostics],
format=Documenter.HTML(),
sitename="SynthDiag",
sitename="FusionSyntheticDiagnostics",
checkdocs=:none,
)

deploydocs(;
repo="github.com/ProjectTorreyPines/SynthDiag.jl.git",
repo="github.com/ProjectTorreyPines/FusionSyntheticDiagnostics.jl.git",
target="build",
branch="gh-pages",
devbranch="master",
Expand Down
20 changes: 9 additions & 11 deletions docs/src/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# SynthDiag.jl
# FusionSyntheticDiagnostics.jl

```@contents
Pages = ["index.md"]
Expand All @@ -8,13 +8,11 @@ Depth = 5

## Installation

SynthDiag is registered with public repository [FuseRegistry](https://github.com/ProjectTorreyPines/FuseRegistry.jl/). First [install Julia](https://github.com/JuliaLang/juliaup?tab=readme-ov-file#juliaup---julia-version-manager), then:
First [install Julia](https://github.com/JuliaLang/juliaup?tab=readme-ov-file#juliaup---julia-version-manager), then:

```julia
using Pkg
Pkg.Registry.add(RegistrySpec(url="https://github.com/ProjectTorreyPines/FuseRegistry.jl.git"))
Pkg.Registry.add("General")
Pkg.add("SynthDiag")
Pkg.add("FusionSyntheticDiagnostics")
```

## Synthetic Diagnostics
Expand Down Expand Up @@ -48,13 +46,13 @@ Gas valves can be added using IMAS compatible `JSON` file that describes the met
add_gas_injection!
compute_gas_injection
compute_gas_injection!
SynthDiag.get_lpf
SynthDiag.dribble
SynthDiag.downsample_smooth
SynthDiag.find_delay
FusionSyntheticDiagnostics.get_lpf
FusionSyntheticDiagnostics.dribble
FusionSyntheticDiagnostics.downsample_smooth
FusionSyntheticDiagnostics.find_delay
get_gas_injection_response
SynthDiag.gi_model
SynthDiag.int_gi_model
FusionSyntheticDiagnostics.gi_model
FusionSyntheticDiagnostics.int_gi_model
get_required_gas_cmd
```

Expand Down
9 changes: 4 additions & 5 deletions examples/plotting_interferometer.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Plotting interferometer using GGDUtils\n",
"# Plotting interferometer using IMASggd\n",
" \n",
" For running this notebook, you need to install package IJulia in your home environment (that is messy, but that is the only way I know right now). So in your terminal:\n",
" ```\n",
Expand All @@ -25,8 +25,7 @@
"using Pkg\n",
"Pkg.activate(\"./\")\n",
"Pkg.add(\"IMASdd\")\n",
"Pkg.Registry.add(RegistrySpec(url=\"https://github.com/ProjectTorreyPines/FuseRegistry.jl.git\"))\n",
"Pkg.add(\"GGDUtils\")\n",
"Pkg.add(\"IMASggd\")\n",
"Pkg.add(\"Plots\")"
]
},
Expand All @@ -37,7 +36,7 @@
"outputs": [],
"source": [
"using IMASdd\n",
"using GGDUtils\n",
"using IMASggd\n",
"using Plots"
]
},
Expand Down Expand Up @@ -218,7 +217,7 @@
"source": [
"gr()\n",
"\n",
"n_e = GGDUtils.get_prop_with_grid_subset_index(ids.edge_profiles.ggd[1].electrons.density, -5)\n",
"n_e = IMASggd.get_prop_with_grid_subset_index(ids.edge_profiles.ggd[1].electrons.density, -5)\n",
"plot(ids.edge_profiles.grid_ggd, n_e, colorbar_title=\"Electrons density / m^(-3)\", left_margin=10Plots.pt)\n",
"plot!(space)\n",
"plot!(ids.interferometer, legend=true, size=[635, 900]) # Adding a size comment to make plot aspect ratio better"
Expand Down
6 changes: 3 additions & 3 deletions src/SynthDiag.jl → src/FusionSyntheticDiagnostics.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module SynthDiag
module FusionSyntheticDiagnostics

using IMAS: IMAS
import IMASdd as IMAS

include("$(@__DIR__)/noise.jl")

Expand All @@ -12,4 +12,4 @@ include("$(@__DIR__)/langmuir_probes.jl")

include("$(@__DIR__)/gas_injection.jl")

end # module SynthDiag
end # module FusionSyntheticDiagnostics
7 changes: 4 additions & 3 deletions src/gas_injection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ function add_gas_injection!(
verbose::Bool=false,
)::IMAS.dd
if endswith(config, ".json")
config_dict = convert_strings_to_symbols(IMAS.IMASdd.JSON.parsefile(config))
config_dict = convert_strings_to_symbols(IMAS.JSON.parsefile(config)) # Use with import IMASdd as IMAS
# config_dict = convert_strings_to_symbols(IMAS.IMASdd.JSON.parsefile(config)) # Use with using IMAS: IMAS
add_gas_injection!(config_dict, ids; overwrite=overwrite, verbose=verbose)
else
error("Only JSON files are supported.")
Expand Down Expand Up @@ -106,9 +107,9 @@ end
Compute the gas flow rate based on the command signal in the all gas valves.
"""
function compute_gas_injection!(
ids::IMAS.dd;
ids::IMAS.dd{T};
valves::Dict{String, Dict{Symbol, Any}}=Dict{String, Dict{Symbol, Any}}(),
)::Array{Vector{Float64}}
)::Array{Vector{Float64}} where {T}
if IMAS.ismissing(ids.gas_injection, :latency)
global_latency = 0.0
elseif IMAS.isempty(ids.gas_injection.latency)
Expand Down
5 changes: 3 additions & 2 deletions src/interferometer.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using StaticArrays
import PhysicalConstants.CODATA2018: c_0, ε_0, m_e, m_u, e
import QuadGK: quadgk, BatchIntegrand
import GGDUtils: interp, get_grid_subset, get_subset_boundary, subset_do, get_TPS_mats
import IMASggd: interp, get_grid_subset, get_subset_boundary, subset_do, get_TPS_mats

export add_interferometer!, compute_interferometer!, compute_interferometer

Expand All @@ -23,7 +23,8 @@ function add_interferometer!(
overwrite::Bool=false, verbose::Bool=false, rtol::Float64=1e-3, n_e_gsi::Int=5,
)::IMAS.dd
if endswith(config, ".json")
config_dict = convert_strings_to_symbols(IMAS.IMASdd.JSON.parsefile(config))
config_dict = convert_strings_to_symbols(IMAS.JSON.parsefile(config)) # Use with import IMASdd as IMAS
# config_dict = convert_strings_to_symbols(IMAS.IMASdd.JSON.parsefile(config)) # Use with using IMAS as IMAS
add_interferometer!(
config_dict,
ids;
Expand Down
5 changes: 3 additions & 2 deletions src/langmuir_probes.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import GGDUtils: interp, get_types_with
import IMASggd: interp, get_types_with
import PhysicalConstants.CODATA2018: m_e, m_u, e

export add_langmuir_probes!, compute_langmuir_probes!, langmuir_probe_current
Expand All @@ -20,7 +20,8 @@ function add_langmuir_probes!(
overwrite=false, verbose=false, kwargs...,
)::IMAS.dd
if endswith(config, ".json")
config_dict = convert_strings_to_symbols(IMAS.IMASdd.JSON.parsefile(config))
config_dict = convert_strings_to_symbols(IMAS.JSON.parsefile(config)) # Use with import IMASdd as IMAS
# config_dict = convert_strings_to_symbols(IMAS.IMASdd.JSON.parsefile(config)) # Use with using IMAS: IMAS
add_langmuir_probes!(
config_dict,
ids;
Expand Down
5 changes: 3 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
using SynthDiag: IMAS, add_interferometer!, add_langmuir_probes!, add_gas_injection!,
using FusionSyntheticDiagnostics: IMAS, add_interferometer!, add_langmuir_probes!,
add_gas_injection!,
compute_gas_injection!, get_gas_injection_response, Noise, OverwriteAttemptError,
langmuir_probe_current
using IMAS: json2imas
using IMASdd: json2imas
using Test
using Printf
using Plots
Expand Down
12 changes: 7 additions & 5 deletions test/speedtest.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
using SynthDiag: add_interferometer!, add_langmuir_probes!, Noise,
using FusionSyntheticDiagnostics: IMAS, add_interferometer!, add_langmuir_probes!,
Noise,
OverwriteAttemptError, add_gas_injection!, compute_gas_injection,
get_gas_injection_response
using SynthDiag.IMAS: json2imas, dd
import IMASdd: json2imas
using DelimitedFiles: readdlm

println("-----------------------------------------------------------------------------")
Expand Down Expand Up @@ -45,7 +46,7 @@ print("add_langmuir_probes!() time (true runtime): ")
println("-----------------------------------------------------------------------------")
config = "$(@__DIR__)/../src/default_gas_injection.json"
excitation(t) = 0.6
ids = dd();
ids = IMAS.dd();
add_gas_injection!(config, ids)
ttotal = 5
nt = Int(ttotal * 1000) + 1
Expand Down Expand Up @@ -89,8 +90,9 @@ ids.gas_injection.valve[1].response_curve = gasd_resp_curve
gasd_model[:time_constant] = 0.3
gasd_model[:damping] = 0.8

valves = Dict("GASD" => gasd_model)

valves = Dict{String, Dict{Symbol, Any}}("GASD" => gasd_model)
println(typeof(ids))
println(typeof(valves))
print("compute_gas_injection() time with compilation: ")
@time compute_gas_injection(ids; valves=valves)

Expand Down

0 comments on commit b9f5472

Please sign in to comment.