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

Test rework #23

Merged
merged 10 commits into from
Mar 19, 2021
Merged
8 changes: 0 additions & 8 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ repository = "https://github.com/microsoft/OpticSim.jl"
version = "0.2.8"

[deps]
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
ColorSchemes = "35d6a980-a343-548e-a6ea-1d62b119f2f4"
ColorTypes = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
FiniteDifferences = "26cc04aa-876d-5657-8c51-4c34ba976000"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
ImageView = "86fae568-95e7-573e-a6b2-d8a6b900c9ef"
Images = "916415d5-f1e6-5110-898d-aaa5f9f070e0"
Expand All @@ -31,28 +29,23 @@ PackageCompiler = "9b87118b-4619-50d2-8e1e-99f35a4d4d9d"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Polynomials = "f27b6e38-b328-58d1-80ce-0feddd5e7a45"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267"
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
StringEncodings = "69024149-9ee7-55f6-a4c4-859efe599b68"
Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
UrlDownload = "856ac37a-3032-4c1c-9122-f86d88358c8b"
ZipFile = "a5390f91-8eb1-5f08-bee0-b1d1ffed6cea"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

[compat]
BenchmarkTools = "0.5, 0.6"
CSV = "0.8"
ColorSchemes = "3.10"
ColorTypes = "0.10"
Colors = "0.12"
DataFrames = "0.22"
Distributions = "0.24"
FileIO = "1.6"
FiniteDifferences = "0.12"
ForwardDiff = "0.10"
ImageView = "0.10"
Images = "0.23"
Expand All @@ -70,7 +63,6 @@ ReverseDiff = "1.7"
Revise = "3.1"
StaticArrays = "1.0"
StringEncodings = "0.3"
Suppressor = "0.2"
Unitful = "1.6"
UrlDownload = "1.0"
ZipFile = "0.9"
Expand Down
27 changes: 15 additions & 12 deletions deps/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,21 @@ function generate_cat_jl(cat, jlpath)
push!(vals, repr(get(glass_info, fn, NaN)))
end
end
raw_name = glass_info["raw_name"] == glass_name ? "" : " ($(glass_info["raw_name"]))"
doc_string = "\"\"\" $catalog_name.$glass_name$raw_name\n"
doc_string *= "```\n$(rpad("ID:", 25))AGF:$idnum\n"
doc_string *= "$(rpad("RI @ 587nm:", 25))$(get(glass_info, "Nd", 0.0))\n"
doc_string *= "$(rpad("Abbe Number:", 25))$(get(glass_info, "Vd", 0.0))\n"
doc_string *= "$(rpad("ΔPgF:", 25))$(get(glass_info, "ΔPgF", 0.0))\n"
doc_string *= "$(rpad("TCE (÷1e-6):", 25))$(get(glass_info, "TCE", 0.0))\n"
doc_string *= "$(rpad("Density:", 25))$(get(glass_info, "p", 0.0))g/m³\n"
doc_string *= "$(rpad("Valid wavelengths:", 25))$(get(glass_info, "λmin", 0.0))μm to $(get(glass_info, "λmax", 0.0))μm\n"
doc_string *= "$(rpad("Reference Temp:", 25))$(get(glass_info, "temp", 20.0))°C\n"
doc_string *= "```\n\"\"\""
push!(eval_string, doc_string)
# skip docstrings for CI builds - this prevents missing docstring warnings in makedocs
if isnothing(get(ENV, "CI", nothing))
raw_name = glass_info["raw_name"] == glass_name ? "" : " ($(glass_info["raw_name"]))"
doc_string = "\"\"\" $catalog_name.$glass_name$raw_name\n"
doc_string *= "```\n$(rpad("ID:", 25))AGF:$idnum\n"
doc_string *= "$(rpad("RI @ 587nm:", 25))$(get(glass_info, "Nd", 0.0))\n"
doc_string *= "$(rpad("Abbe Number:", 25))$(get(glass_info, "Vd", 0.0))\n"
doc_string *= "$(rpad("ΔPgF:", 25))$(get(glass_info, "ΔPgF", 0.0))\n"
doc_string *= "$(rpad("TCE (÷1e-6):", 25))$(get(glass_info, "TCE", 0.0))\n"
doc_string *= "$(rpad("Density:", 25))$(get(glass_info, "p", 0.0))g/m³\n"
doc_string *= "$(rpad("Valid wavelengths:", 25))$(get(glass_info, "λmin", 0.0))μm to $(get(glass_info, "λmax", 0.0))μm\n"
doc_string *= "$(rpad("Reference Temp:", 25))$(get(glass_info, "temp", 20.0))°C\n"
doc_string *= "```\n\"\"\""
push!(eval_string, doc_string)
end
push!(eval_string, "const $glass_name = Glass($(join(vals, ", "))) \n export $glass_name")
end
idnum += 1
Expand Down
2 changes: 2 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a"
Images = "916415d5-f1e6-5110-898d-aaa5f9f070e0"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
OpticSim = "24114763-4efb-45e7-af0e-cde916beb153"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
35 changes: 15 additions & 20 deletions docs/src/vis.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ There are a number of helper methods, as well as the ability to draw objects, su
Vis.drawtracerays(Examples.cooketriplet(), trackallrays=true, test=true, numdivisions=100)
```

```@eval
```@setup base
using OpticSim
```

```@example base
Vis.drawtracerays(Examples.cooketriplet(), trackallrays=true, test=true, numdivisions=100)
Vis.save("assets/vis_ex_3d.png")
Vis.save("assets/vis_ex_3d.png") # hide
Vis.drawtracerays(Examples.cooketriplet(), trackallrays=true, test=true, numdivisions=100, drawsys=true, resolution = (1000, 700))
Vis.make2dy()
Vis.save("assets/vis_ex_2d.png")
nothing
Vis.save("assets/vis_ex_2d.png"); nothing #hide
```

![3D visualization example](assets/vis_ex_3d.png)
Expand All @@ -27,12 +29,10 @@ And the image on the detector for a trace of a system:
Vis.drawtraceimage(Examples.cooketriplet(), test=true)
```

```@eval
using OpticSim
using Images
```@example base
using Images # hide
im = Vis.drawtraceimage(Examples.cooketriplet(Float64, 400), test=true)
save("assets/vis_ex_im.png", colorview(Gray, real.(im ./ maximum(im))))
nothing
save("assets/vis_ex_im.png", colorview(Gray, real.(im ./ maximum(im)))); nothing # hide
```

![detector image example](assets/vis_ex_im.png)
Expand All @@ -42,8 +42,7 @@ nothing
These methods are all you need to build up a visualization piece by piece.
For example:

```@example
using OpticSim # hide
```@example base
obj = csgintersection(Sphere(0.5), Plane(0.0, 1.0, 0.0, 0.0, 0.1, 0.0))()
ray1 = Ray([0.0, -0.1, 1.0], [0.0, 0.0, -1.0])
ray2 = Ray([0.8, 0.0, 0.0], [-1.0, 0.0, 0.0])
Expand All @@ -52,8 +51,7 @@ Vis.draw!(ray1, rayscale=0.2)
Vis.draw!(ray2, rayscale=0.2, color=:blue)
Vis.draw!(surfaceintersection(obj, ray1), color=:red)
Vis.draw!(surfaceintersection(obj, ray2), color=:green)
Vis.save("assets/vis_ex_3d_parts.png") # hide
nothing # hide
Vis.save("assets/vis_ex_3d_parts.png"); nothing # hide
```

![basic drawing example](assets/vis_ex_3d_parts.png)
Expand All @@ -73,13 +71,10 @@ These are the helper methods to provide common visualizations more easily, as us
Vis.surfacesag(AcceleratedParametricSurface(TestData.zernikesurface2()), (256, 256), (1.55, 1.55))
```

```@eval
using OpticSim
using Plots
Vis.surfacesag(AcceleratedParametricSurface(TestData.zernikesurface2()), (256, 256), (1.55, 1.55))
p = Vis.surfacesag(AcceleratedParametricSurface(TestData.zernikesurface2()), (256, 256), (1.55, 1.55)) # hide
Plots.savefig(p, "assets/surface_sag.svg")
nothing
```@example base
using Plots; include("../../test/TestData.jl") # hide
p = Vis.surfacesag(AcceleratedParametricSurface(TestData.zernikesurface2()), (256, 256), (1.55, 1.55))
Plots.savefig(p, "assets/surface_sag.svg"); nothing # hide
```

![surface sag example](assets/surface_sag.svg)
Expand Down
26 changes: 0 additions & 26 deletions src/Data/Spectra.jl

This file was deleted.

Loading