Skip to content
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
name: CI

# Controls when the action will run.
on:
- push
- pull_request
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
pull_request:
branches: [ master ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
env:
PYTHON: ""
strategy:
fail-fast: false
matrix:
version:
- '1.3'
- '1.5'
- '1.6'
- 'nightly'
os:
- ubuntu-latest
Expand All @@ -25,6 +36,10 @@ jobs:
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- run: |
using Pkg
Pkg.Registry.add(RegistrySpec(url="https://github.com/ctp-fpub/JuliaRegistry"))
shell: julia --color=yes --project=. {0}
- uses: actions/cache@v1
env:
cache-name: cache-artifacts
Expand All @@ -44,11 +59,17 @@ jobs:
docs:
name: Documentation
runs-on: ubuntu-latest
env:
PYTHON: ""
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: '1'
- run: |
julia -e '
using Pkg
Pkg.Registry.add(RegistrySpec(url="https://github.com/ctp-fpub/JuliaRegistry"))'
- run: |
julia --project=docs -e '
using Pkg
Expand Down
45 changes: 33 additions & 12 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,37 @@ using Unitful
using Test

@testset "SDFResultViewer.jl" begin
λ = 800u"nm"
dir = pwd()
file = "0002.sdf"
times = get_times(dir, λ)
@test length(times) == 1

m_Lx = mean_Lx(dir, λ)
@test length(m_Lx) == 1

Lx, y, z = Lx_slice(joinpath(dir, file), λ, 0)
@test length(Lx) > 0
@test length(Lx) == length(y) == length(z)
if isempty(ENV["CI"])
dir = "/mnt/storage/epoch/Wang-Arefiev2020mod/12mtt_0.8w0_l0_MDO"
else
dir = pwd()
end
sim = read_simulation(dir)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to add using SDFResults for this to work


test_plot1 = SDFResultViewer.photon_energy_spectrum(sim; mark_max = true)

test_plot21 = SDFResultViewer.photon_dens_integrated(sim; direction = :y)
test_plot22 = SDFResultViewer.photon_dens_integrated(sim; direction = :z)

test_plot31 = SDFResultViewer.photon_en_dens_integrated(sim; direction = :y, endens_scale = 10^3)
test_plot32 = SDFResultViewer.photon_en_dens_integrated(sim; direction = :z, endens_scale = 10^3)

test_plot4 = SDFResultViewer.energy_spectrum(sim)

test_plot5 = SDFResultViewer.photon_solid_angle_emission(sim; angle = pi/4)

@test typeof(test_plot1) == Plots.Plot{Plots.GRBackend}
@test typeof(test_plot21) == Plots.Plot{Plots.GRBackend}
@test typeof(test_plot22) == Plots.Plot{Plots.GRBackend}
@test typeof(test_plot32) == Plots.Plot{Plots.GRBackend}
@test typeof(test_plot31) == Plots.Plot{Plots.GRBackend}
@test typeof(test_plot4) == Plots.Plot{Plots.GRBackend}

@test typeof(test_plot5) == PyPlot.Figure

@test SDFResultViewer.powertostring(2, 2^BigInt(1345)) == "2¹³⁴⁵"
@test SDFResultViewer.powertostring(10, 1000) == "10³"

@test SDFResultViewer.cell_length(sim, :x) == 15u"μm"/450

end