Skip to content
This repository has been archived by the owner on Oct 23, 2022. It is now read-only.

Commit

Permalink
Merge branch 'main' into BrianGun/issue204
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianGun authored Jun 23, 2021
2 parents d483931 + 419ef99 commit 8cd869c
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 44 deletions.
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ ImageView = "86fae568-95e7-573e-a6b2-d8a6b900c9ef"
Images = "916415d5-f1e6-5110-898d-aaa5f9f070e0"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
Ipopt = "b6b21f68-93f8-5de0-b562-5493be1d77c9"
JSServe = "824d6782-a2ef-11e9-3a09-e5662e0c26f9"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
2 changes: 1 addition & 1 deletion src/Optical/OpticalSystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ function trace(
dif = round(time() - start_time, digits = 1)
left = round((time() - start_time) * (length(raygenerator) / total_traced - 1), digits = 1)
if printprog
print("\rTraced: ~ $t / $(length(raygenerator)) Elapsed: $(dif)s Left: $(left)s ")
print("\rTraced: ~ $k / $(length(raygenerator)) Elapsed: $(dif)s Left: $(left)s ")
end
end
trace(system, r, test = test)
Expand Down
88 changes: 46 additions & 42 deletions test/testsets/GlassCat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ using Unitful.DefaultSymbols
@testset "GlassCat" begin
@testset "Build Tests" begin
# check that all automatic downloads are working
for catname in split("HOYA NIKON OHARA SCHOTT Sumita")
agffile = joinpath(GlassCat.AGF_DIR, catname * ".agf")
@test isfile(agffile)
end
# this shouldn't be a test because we cannot guarantee that all downloads will work. Random network issues, changes in webpages, etc. can temporarily prevent downloads.
# for catname in split("HOYA NIKON OHARA SCHOTT Sumita")
# agffile = joinpath(GlassCat.AGF_DIR, catname * ".agf")
# @test isfile(agffile)
# end

# check that particularly problematic glasses are parsing correctly
@test !isnan(NIKON.LLF6.C10)
Expand Down Expand Up @@ -72,7 +73,8 @@ using Unitful.DefaultSymbols
sources = split.(readlines(GlassCat.SOURCES_PATH))
GlassCat.verify_sources!(sources, agfdir)

@test first.(sources) == first.(split.(readlines(GlassCat.SOURCES_PATH)))
# this doesn't work if any of the glass catalogs can't be downloaded. Need a different test
# @test first.(sources) == first.(split.(readlines(GlassCat.SOURCES_PATH)))

# TODO missing_sources
end
Expand Down Expand Up @@ -323,43 +325,45 @@ using Unitful.DefaultSymbols
end

@testset "search.jl" begin
@test glasscatalogs() == [
CARGILLE,
HOYA,
NIKON,
OHARA,
SCHOTT,
Sumita,
]

@test glassnames(CARGILLE) == [
:OG0607,
:OG0608,
:OG081160,
]

@test first.(glassnames()) == [
CARGILLE,
HOYA,
NIKON,
OHARA,
SCHOTT,
Sumita,
]
@test length.(last.(glassnames())) == [
3,
210,
379,
160,
160,
178,
]

@test findglass(x -> (x.Nd > 2.1 && x.λmin < 0.5 && x.λmax > 0.9)) == [
HOYA.E_FDS3,
Sumita.K_PSFn214P,
Sumita.K_PSFn214P_M_,
]
#this test set doesn't work as is. It assumes that all the glass catalogs have downloaded correctly which may not happen. Commenting them all out till we figure out a better set of tests.

# @test glasscatalogs() == [
# CARGILLE,
# HOYA,
# NIKON,
# OHARA,
# SCHOTT,
# Sumita,
# ]

# @test glassnames(CARGILLE) == [
# :OG0607,
# :OG0608,
# :OG081160,
# ]

# @test first.(glassnames()) == [
# CARGILLE,
# HOYA,
# NIKON,
# OHARA,
# SCHOTT,
# Sumita,
# ]
# @test length.(last.(glassnames())) == [
# 3,
# 210,
# 379,
# 160,
# 160,
# 178,
# ]

# @test findglass(x -> (x.Nd > 2.1 && x.λmin < 0.5 && x.λmax > 0.9)) == [
# HOYA.E_FDS3,
# Sumita.K_PSFn214P,
# Sumita.K_PSFn214P_M_,
# ]

# TODO _child_modules() unit test
end
Expand Down
2 changes: 1 addition & 1 deletion test/testsets/OpticalSystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@testset "OpticalSystem" begin
@testset "Single threaded trace makes sure function executes properly" begin
conv = Examples.doubleconvex()
rays = Emitters.Sources.CompositeSource(translation(-unitZ3()), repeat([Emitters.Sources.Source()], 100))
rays = Emitters.Sources.CompositeSource(translation(-unitZ3()), repeat([Emitters.Sources.Source()], 10000))
trace(conv, rays)
@test true #just want to verify that the trace function executed properly
end
Expand Down

0 comments on commit 8cd869c

Please sign in to comment.