From 2806fbe59aea0dbd639043c818e2f80e5db5fe78 Mon Sep 17 00:00:00 2001 From: adrianaghiozzi <67669644+adrianaghiozzi@users.noreply.github.com> Date: Thu, 24 Oct 2024 14:17:25 -0700 Subject: [PATCH 1/2] Read neutron rate output file in read_outputs --- src/outputs.jl | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/src/outputs.jl b/src/outputs.jl index d2b10c9..1175635 100644 --- a/src/outputs.jl +++ b/src/outputs.jl @@ -6,14 +6,21 @@ Base.@kwdef mutable struct RABBIToutput torqdepo_data::Union{Array{<:Real},Missing} = missing rho_data::Union{Vector{<:Real},Missing} = missing time_data::Union{Vector{<:Real},Missing} = missing + nrate_data::Union{Array{<:Real}, Missing} = missing end function read_outputs(path::String; filename::String ="run") struct_len = 4 result_path = abspath(joinpath(path, "$filename/beam1/rtfi_result_oav.bin")) + nrate_path = abspath(joinpath(path, "$filename/rtfi_nrate_oav.bin")) output = RABBIToutput() + + function read_and_reshape(f, element_count; dims) + data = Float64[struct_unpack(read(f, struct_len)) for _ in 1:element_count] + return reshape(data, dims) + end open(string(result_path), "r") do f seekend(f) @@ -28,11 +35,6 @@ function read_outputs(path::String; filename::String ="run") output.time_data = Float64[struct_unpack(read(f, struct_len)) for _ in 1:ntime] output.rho_data = Float64[struct_unpack(read(f, struct_len)) for _ in 1:nrho] - function read_and_reshape(f, element_count; dims) - data = Float64[struct_unpack(read(f, struct_len)) for _ in 1:element_count] - return reshape(data, dims) - end - bdens_data = read_and_reshape(f, nrho * ntime, dims=(nrho, ntime)) press_data = read_and_reshape(f, nrho * ntime, dims=(nrho, ntime)) output.powe_data = read_and_reshape(f, nrho * ntime, dims=(nrho, ntime)) @@ -61,11 +63,22 @@ function read_outputs(path::String; filename::String ="run") dArea = read_and_reshape(f, nrho * ntime, dims=(nrho, ntime)) output.torqdepo_data = read_and_reshape(f, nrho * nv * ntime, dims=(nrho, ntime, nv)) torqjxb_data = read_and_reshape(f, nrho * nv * ntime, dims=(nrho, ntime, nv)) - - return output - + break end end - end + end + + open(string(nrate_path), "r") do f + seekstart(f) + + nrho = length(output.rho_data) + ntime = length(output.time_data) + while !eof(f) + output.nrate_data = read_and_reshape(f, nrho * ntime, dims = (nrho, ntime)) + end + end + + return output + end \ No newline at end of file From c7253a21fa19cce52fbf256bd52128c74a3adcd3 Mon Sep 17 00:00:00 2001 From: adrianaghiozzi <67669644+adrianaghiozzi@users.noreply.github.com> Date: Mon, 28 Oct 2024 13:29:48 -0700 Subject: [PATCH 2/2] Add runtests for RABBIT --- .github/workflows/runtests.yml | 49 +++++++++++++++++++++++++++++ test/Project.toml | 2 ++ test/run/beam1/rtfi_result_oav.bin | Bin 0 -> 5134 bytes test/run/rtfi_nrate_oav.bin | Bin 0 -> 800 bytes test/runtests.jl | 17 ++++++++++ 5 files changed, 68 insertions(+) create mode 100644 .github/workflows/runtests.yml create mode 100644 test/Project.toml create mode 100644 test/run/beam1/rtfi_result_oav.bin create mode 100644 test/run/rtfi_nrate_oav.bin create mode 100644 test/runtests.jl diff --git a/.github/workflows/runtests.yml b/.github/workflows/runtests.yml new file mode 100644 index 0000000..192e0d6 --- /dev/null +++ b/.github/workflows/runtests.yml @@ -0,0 +1,49 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + +jobs: + test: + name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + version: + - "1.x" + os: + - ubuntu-latest + arch: + - x64 + + steps: + - uses: actions/checkout@v4 + + - uses: julia-actions/setup-julia@latest + + - uses: julia-actions/cache@v1 + + - name: Add FuseRegistry + run: | + rm -rf ~/.julia/registries/FuseRegistry + julia -e 'using Pkg; Pkg.Registry.add(RegistrySpec(url="https://github.com/ProjectTorreyPines/FuseRegistry.jl.git")); Pkg.Registry.add("General"); Pkg.Registry.update()' + + - name: Replace git@github.com with https in Package.toml files + run: | + find ~/.julia/registries/FuseRegistry -type f -name 'Package.toml' -exec sed -i 's|git@github.com:|https://project-torrey-pines:${{secrets.PTP_READ_TOKEN}}@github.com/|g' {} + + + - name: Install dependencies + run: | + julia -e ' + using Pkg + Pkg.develop(PackageSpec(path=pwd())) + Pkg.instantiate() + ' + + - uses: julia-actions/julia-buildpkg@v1 + + - uses: julia-actions/julia-runtest@v1 diff --git a/test/Project.toml b/test/Project.toml new file mode 100644 index 0000000..0c36332 --- /dev/null +++ b/test/Project.toml @@ -0,0 +1,2 @@ +[deps] +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" diff --git a/test/run/beam1/rtfi_result_oav.bin b/test/run/beam1/rtfi_result_oav.bin new file mode 100644 index 0000000000000000000000000000000000000000..21c839b8fa9a0767ddbd514ced8a64c6e6f4d715 GIT binary patch literal 5134 zcmeHJ`8$$!ipuV>vq+-nI530VsXU1HBQYoX=- z4}|8>+0g;g)6(GF5t*8rA}=p5)Y%a;*Yl8&PyFheg$uq*QD3S+jhU4 z7twx&XOPsvvkkn(OYu+VRdj{$F4>d3%JnmD?#h{Nb(Ji)#K;m?7c}3srhc41^zA!e zwzH9c)SJ!ceK+LCA5rF`{j)p`g?=9Mv683edyRJ_y`87Dyp%_gX*^@65FSz_c$=ku zxE;Nk<_4$C-2MHDYAxid$TreE z@H%pDEO;8*s!bx12;QE(w zj_IxAY+e4srZR=Ji4BftFYH{$^?kOLyF!cL4qX!A?g|m%Htd|HHB~>;QlT&DE#95< z_nocuWffQY#egOK&Tc6k=O;?PtnQ>fUOq?dIR>Z&%g4!-lR>0^M=z22b3ONJm?L+r zo#1}?_8Zss_ushZmrm0ov17Dl@f-TmKsRl@w2OAl+D2b0v7ocNHRxp<#c12eM^yK^ zSnAzzj4B-bMBev0NT&BcAf#G8a&OQ3le=weDR)S085b2PatG>v&~B_=I=HHYZthB= z%hV6kxmlI;M#&u7Aw7n^#2lbi*I3bJ-#$}5SxJBOhmbZgUDTH1Uc9iwhRFPr$2 zYMDr&wrw$>;2jzm!n)1pOI6MDP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`$N&i|Xdvxr5meOL506+D!;9-q!_WIUFac38ZbA>v z-k1iF3kyJXSp;~N6AbKQc)(CiA2h$I#N;$&u_w4VVrR#oG=&TlsId|)GGBzs9||GC z*FGq=uNc}*pMjNt4Mo+t@Nlv&R7jlyKJtZNKsO2u1crhQ0d63SSOJ!}+{A1$ez1O< zOKYz(9g^^}Aw5J*$SCq9ajd?ch%8Da8U(&X{fIGfzfF`lkk!u7_^M27-#g8D1v@w^ zcVuwFJ)Agu_6c!vS0vh0NE+CrT)n~G%vNFdtkfmly=};@d?PX_WPmUdyF+-VClSGQ z-o(k9Mnr0~81Z4Gi{r1VLezfwiz6BNfHTvO!P#`znWJ-9h=X*`+k6*UY4c7$mpxoL ZkNy9?-#@S3zxdaIe;xSOf&YaA{{g{~yJ-Lb literal 0 HcmV?d00001 diff --git a/test/run/rtfi_nrate_oav.bin b/test/run/rtfi_nrate_oav.bin new file mode 100644 index 0000000000000000000000000000000000000000..2eb68f4e46f15f516548336274de82814fc75054 GIT binary patch literal 800 zcmV+*1K<4N--cETl7v?MrEpdS^d(jc@(NZJklIyaLZns4hjdkm7CBYvbM;gY61G(c zNt;zvplMan$Q@O<*1c4xgh*5ej=)oGR4-GvVwX|{=IBwRE{0ZjdV^LJ2yIr9<{?%e zCI?nW57ku)_n}o{q;yrK&N)>$>f=WBJlABIy@or5i0tif8)Pz*yqjyw(B_>oM zLR3?{z${Zx1N>41kg!r)k9AVuU@cPm%>`1!GlfzOlRi?~i33t@;-OJpyB$%pVOmgy z0EJKRNRduj)LBj5`{GN0?|@WQi&s?om?cyd{^?W7fRR&SZ6s4T5UW!CPAgIYPq$Io zX{S&R;AvE#uWD4twKG)CP5D#snVeJhb}~~Qrn*vBpgK~Qr^HbJXe&`=O@36mSyEId z9w1cyBH&Yw|A|wXfErWMsGm~d^dC~FzO7M@t3pt#evVWEbY)Z=11?mC|L#)&q?A+E z&?i$)O|DW}I4)A|A-YktXTnena;-v$d#Xb2yP86FX;nf$t};T2hzvr}JJUh!I-Nn* z1a3jX(j7r_BkDnTvByCUIF>;;=t@D+AoM^??tnn}p7%dfcws-Ot-?M-z!g3pj;ule z6sba$XqZA%Gf+Zc%q>E({s=;VNYFu2O`SoQ@oquzixNS6K>9%*Q^Y}CXOltb7)U{o z*6=`)!+b!HwC_LlJXb$Kt+zf-gxNhi*yus?-Q+>3xz9nyKaW9X-)})gsXRe=$qhk% z6VpH+#GgP?-%~(TDIGy+3I;*&smVaAGKfIy-6KHL6|FxSHYPvFSC>AmtO7nC2}wOa zrsqLQ`{F@un#@5$z>7hBQE5Rm={G@n&I>^=EYm;>W1v9XyF@@S`X@n>#{)rc;>AGM ePliB}s3Abusi{Be