Skip to content

Commit 60c387c

Browse files
committed
VtMS: absorb .Plot submodule (cause PyPlot import is instant with sysimg)
1 parent 2a197c2 commit 60c387c

File tree

6 files changed

+134
-66
lines changed

6 files changed

+134
-66
lines changed

nb/2022-09-15__Two-pass_conntest_ptp-then-cor.ipynb

Lines changed: 119 additions & 39 deletions
Large diffs are not rendered by default.

nb/2022-09-15__Two-pass_conntest_ptp-then-cor.jl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
#
2323
# -
2424

25-
using Revise
26-
2725
using MyToolbox
2826

2927
using VoltoMapSim
@@ -46,14 +44,15 @@ p = get_params(
4644

4745
@time s = cached(sim, [p.sim]);
4846

47+
# (To speed this up: SnoopCompile. Not now).
48+
4949
s = augment(s, p);
5050

51-
using PyPlot
5251
using VoltoMapSim.Plot
5352

53+
using Pkg
54+
5455
@time plotSTA(1=>1,s,p);
5556
# plotSTA(2=>2,s,p);
5657
# plotSTA(801=>801,s,p);
5758
# plotSTA(802=>802,s,p);
58-
59-

pkg/Sciplotlib

pkg/VoltoMapSim/src/VoltoMapSim.jl

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ module VoltoMapSim
22

33
using MyToolbox: @reexport
44
@reexport using MyToolbox
5+
@reexport using Sciplotlib
56
@reexport using Distributions # Sample from lognormal, exponential, ….
67
@reexport using DataFrames
78

@@ -32,29 +33,17 @@ export calc_STA, to_ISIs, to_spiketimes!, shuffle_ISIs, test_connection
3233
include("eval.jl")
3334
export evaluate_conntest_perf, cached_conntest_eval
3435

36+
include("plot.jl")
37+
export color_exc, color_inh, color_unconn
38+
export plotsig, plotSTA
39+
export rasterplot, histplot_fr
40+
export plot_detection_rates, plot_samples_and_means, add_α_line, extract
41+
export ydistplot, add_refline
3542

36-
function __init__()
37-
set_print_precision(3)
38-
end
3943

40-
41-
"""
42-
Custom plotting functions are in this separate submodule, so that the heavy PyPlot does not
43-
need to be loaded when plotting is not needed.
44-
"""
45-
module Plot
46-
using ..VoltoMapSim
4744
function __init__()
48-
@require PyPlot = "d330b81b-6aea-500a-939a-2ce795aea3ee" begin
49-
include("plot.jl")
50-
export color_exc, color_inh, color_unconn
51-
export plotsig, plotSTA
52-
export rasterplot, histplot_fr
53-
export plot_detection_rates, plot_samples_and_means, add_α_line, extract
54-
export ydistplot, add_refline
55-
end
45+
set_print_precision(3)
5646
end
57-
end # module Plot
5847

5948

6049
end # module VoltoMapSim

pkg/VoltoMapSim/src/plot.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
@reexport using Sciplotlib
21

32

43
const color_exc = C0

sysimg/pyplot_delay_init.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
# Needs
55
# Pkg.add(url="https://github.com/xzackli/PyPlot.jl")
66

7-
using PyPlot
7+
import PyPlot # `import` instead of `using`, so we do not import all the names.
8+
89
PyPlot.delay_init_until_cell[] = true

0 commit comments

Comments
 (0)