Skip to content

Commit 5994749

Browse files
committed
rename scripts/ to sysimg/
1 parent 7999ce1 commit 5994749

File tree

8 files changed

+132
-48
lines changed

8 files changed

+132
-48
lines changed

ReadMe.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Directories:
1515
- [`pkg/`](pkg) contains Julia packages, which define functions and data types that are reused in multiple notebooks.
1616
- [`web/`](web) contains config and code to build the [website](https://tfiers.github.io/phd)
1717
where the notebooks are hosted (using [JupyterBook](https://jupyterbook.org/)).
18-
- [`scripts/`](scripts) contains scripts for updating dependencies and speeding up their imports.
18+
- [`sysimg/`](sysimg) contains instructions for building a custom Julia [system image](https://julialang.github.io/PackageCompiler.jl/dev/sysimages.html). It is not necessary to run the notebooks, but it speeds up package imports and first function calls.
1919

2020

2121
Files:
@@ -73,7 +73,7 @@ To reproduce results, *i.e.* to succesfully run one of the notebooks:
7373
which is included in the repository for the purpose of reproducibility.
7474
- Downloading and installing all these packages will take a while.
7575
- If you want to instead use newer versions of dependencies (maybe because you
76-
already have them downloaded), run `julia scripts/update.jl` in the terminal,
76+
already have them downloaded), run `julia update.jl` in the terminal,
7777
instead of `instantiate`.
7878
</details>
7979

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

Lines changed: 89 additions & 20 deletions
Large diffs are not rendered by default.

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ using VoltoMapSim
3030

3131
# ## Params
3232

33+
using ProfileView
34+
3335
p = get_params(
3436
duration = 10minutes,
3537
p_conn = 0.04,
@@ -44,10 +46,16 @@ p = get_params(
4446

4547
# ## Run sim
4648

47-
s = cached(sim, [p.sim]);
49+
@time s = cached(sim, [p.sim]);
50+
51+
@profview s = augment(s, p);
4852

49-
s = augment(s, p);
53+
using PyPlot
54+
using VoltoMapSim.Plot
5055

51-
plotSTA(23=>1,s,p);
56+
@profview plotSTA(1=>1,s,p);
57+
plotSTA(2=>2,s,p);
58+
plotSTA(801=>801,s,p);
59+
plotSTA(802=>802,s,p);
5260

5361

scripts/to_precompile.jl

Lines changed: 0 additions & 23 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.

sysimg/to_precompile.jl

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# For use with PackageCompiler.jl, to generate a custom "system image", like here:
2+
# https://julialang.github.io/PackageCompiler.jl/stable/examples/plots.html.
3+
#
4+
# The goal is having to wait less long for package imports and first function calls in a
5+
# fresh Julia session.
6+
#
7+
# Commands to run, in the repo root:
8+
#=
9+
using PackageCompiler
10+
pkgs = [:Revise, :PyCall, :IJulia, :PyPlot, :DataFrames, :ComponentArrays]
11+
sysimage_path = "sysimg/mysys.dll"
12+
precompile_execution_file = "sysimg/to_precompile.jl"
13+
script = "sysimg/pyplot_delay_init.jl"
14+
create_sysimage(pkgs; sysimage_path, precompile_execution_file, script)
15+
=#
16+
# To use this system image:
17+
# - On the command line: `julia --sysimg=sysimg/mysis.dll`
18+
# - As a 'kernel' in Jupyter:
19+
# https://julialang.github.io/IJulia.jl/stable/manual/installation/#Installing-additional-Julia-kernels
20+
# Make sure to also add the flag "--project=@.".
21+
# For me, the generated kernel definition file is located at:
22+
# C:\Users\tfiers\AppData\Roaming\jupyter\kernels\julia-preloaded-1.7\kernel.json
23+
24+
using PyPlot, DataFrames, ComponentArrays
25+
26+
df = DataFrame([(a=1, b=2), (a=2, b=2)])
27+
cv = ComponentVector(a=3, b=8)
28+
29+
fig, ax = plt.subplots()
30+
ax.plot(df.a, collect(cv))
File renamed without changes.

0 commit comments

Comments
 (0)