Skip to content

Commit 3bb7711

Browse files
committed
update benchmarks
1 parent ce858da commit 3bb7711

File tree

5 files changed

+62
-7
lines changed

5 files changed

+62
-7
lines changed

bench/bench.jl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@ using DataFrames
44
using PSFModels: Gaussian, AiryDisk, Moffat
55
using PyCall
66

7-
apm = pyimport("astropy.modeling.functional_models")
8-
97
@info "Starting PSF evaluation benchmark"
108

9+
ap = pyimport("astropy")
10+
apm = pyimport("astropy.modeling.models")
11+
@info "Using astropy version $(ap.__version__)"
12+
13+
1114
julia_models = [
1215
Gaussian((5.3, 4.7)),
1316
AiryDisk(12.7),
@@ -19,7 +22,7 @@ astropy_models = [
1922
apm.Moffat2D(gamma=8.1, alpha=-1)
2023
]
2124

22-
names = ("Gaussian", "AiryDisk", "Moffat")
25+
names = ["Gaussian", "AiryDisk", "Moffat"]
2326
jl_times = []
2427
py_times = []
2528

@@ -36,7 +39,8 @@ end
3639
filename = joinpath(@__DIR__, "results.csv")
3740
DataFrame(name=names, psfmodels=jl_times, astropy=py_times) |> CSV.write(filename)
3841

42+
@info "Results saved to $filename"
3943

40-
@info "Finished PSF evaluation benchmark. Results saved to $filename"
44+
@info "Finished PSF evaluation benchmark"
4145

4246
nothing

bench/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
astropy==4.*

bench/results.csv

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
name,psfmodels,astropy
2-
"(""Gaussian"", ""AiryDisk"", ""Moffat"")",1.5927855711422846e-8,0.000165969
3-
"(""Gaussian"", ""AiryDisk"", ""Moffat"")",3.7001009081735617e-8,0.000135154
4-
"(""Gaussian"", ""AiryDisk"", ""Moffat"")",1.192685370741483e-8,0.000134448
2+
Gaussian,1.5832665330661323e-8,0.000164387
3+
AiryDisk,3.699092741935484e-8,0.000108041
4+
Moffat,1.192685370741483e-8,9.8272e-5

docs/Project.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
[deps]
2+
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
3+
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
24
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
35
HCIDatasets = "1893dc6a-5236-4cb8-aa54-62ea411c10cd"
46
LossFunctions = "30fc2ffe-d236-52d8-8643-a9d8f7c094a7"
57
Optim = "429524aa-4258-5aef-a3af-852621145aeb"
68
PSFModels = "9ba017d1-7760-46cd-84a3-1e79e9ae9ddc"
79
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
10+
StatsPlots = "f3b207a7-027a-5e70-b257-86293d7955fd"
811

912
[compat]
1013
Documenter = "0.25"

docs/src/index.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,50 @@ model = M.Gaussian(10)
5151
```@docs
5252
PSFModels
5353
```
54+
55+
## Benchmarks
56+
57+
The benchmarks can be found in the [`bench/`](https://github.com/JuliaAstro/PSFModels.jl/tree/master/bench) folder. To run them, first install the python dependencies
58+
59+
```
60+
$ pip install -r bench/requirements.txt
61+
```
62+
63+
Then run the benchmark
64+
65+
```
66+
$ julia --project=bench bench/bench.jl
67+
```
68+
69+
**System Information**
70+
71+
```
72+
Julia Version 1.5.0
73+
Commit 96786e22cc (2020-08-01 23:44 UTC)
74+
Platform Info:
75+
OS: macOS (x86_64-apple-darwin18.7.0)
76+
CPU: Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
77+
WORD_SIZE: 64
78+
LIBM: libopenlibm
79+
LLVM: libLLVM-9.0.1 (ORCJIT, skylake)
80+
Environment:
81+
JULIA_NUM_THREADS = 4
82+
```
83+
84+
```@setup bench
85+
using CSV, DataFrames
86+
using StatsPlots
87+
benchdir(args...) = joinpath("..", ".." ,"bench", args...);
88+
```
89+
90+
---
91+
92+
```@example bench
93+
table = CSV.File(benchdir("results.csv")) |> DataFrame
94+
```
95+
96+
```@example bench
97+
@df table groupedbar(:name, [:psfmodels :astropy];
98+
ylabel="time (s)", yscale=:log10, leg=:outerbottom,
99+
label=["PSFModels.jl" "Astropy"])
100+
```

0 commit comments

Comments
 (0)