Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d145205

Browse files
author
Documenter.jl
committedApr 27, 2024·
build based on e1c87b1
1 parent 50a551b commit d145205

File tree

9 files changed

+40
-40
lines changed

9 files changed

+40
-40
lines changed
 

‎dev/.documenter-siteinfo.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"documenter":{"julia_version":"1.10.2","generation_timestamp":"2024-04-10T17:10:37","documenter_version":"1.3.0"}}
1+
{"documenter":{"julia_version":"1.10.2","generation_timestamp":"2024-04-27T08:34:28","documenter_version":"1.4.0"}}

‎dev/assets/themes/documenter-dark.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dev/index.html

+1-1
Large diffs are not rendered by default.

‎dev/name/index.html

+4-4
Large diffs are not rendered by default.

‎dev/project/index.html

+4-4
Large diffs are not rendered by default.

‎dev/real_world/index.html

+14-14
Large diffs are not rendered by default.

‎dev/run&list/index.html

+4-4
Large diffs are not rendered by default.

‎dev/save/index.html

+5-5
Large diffs are not rendered by default.

‎dev/workflow/index.html

+6-6
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@
4040
Pkg.add([&quot;Statistics&quot;, &quot;JLD2&quot;])</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi"> Cloning git-repo `https://github.com/JuliaDynamics/DrWatson.jl.git`
4141
Resolving package versions...
4242
Updating `~/work/DrWatson.jl/DrWatson.jl/docs/build/DrWatsonExample/Project.toml`
43-
[634d3b9d] ~ DrWatson v2.14.1 ⇒ v2.15.0 `~/.julia/dev/DrWatson`
43+
[634d3b9d] ~ DrWatson v2.15.0 ⇒ v2.15.0 `~/.julia/dev/DrWatson`
4444
Updating `~/work/DrWatson.jl/DrWatson.jl/docs/build/DrWatsonExample/Manifest.toml`
45-
[634d3b9d] ~ DrWatson v2.14.1 ⇒ v2.15.0 `~/.julia/dev/DrWatson`
45+
[634d3b9d] ~ DrWatson v2.15.0 ⇒ v2.15.0 `~/.julia/dev/DrWatson`
4646
Resolving package versions...
4747
Updating `~/work/DrWatson.jl/DrWatson.jl/docs/build/DrWatsonExample/Project.toml`
4848
[033835bb] + JLD2 v0.4.46
@@ -70,8 +70,8 @@
7070
end</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">fakesim (generic function with 2 methods)</code></pre><p>and we create some parameters in our scripts and run the simulation</p><pre><code class="language-julia hljs">a, b = 2, 3
7171
v = rand(5)
7272
method = &quot;linear&quot;
73-
r, y = fakesim(a, b, v, method)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">([2.542145259253, 3.6518664510958336, 4.584802048524513, 3.1825562661089974, 2.743213595864532], 1.7320508075688772)</code></pre><p>Okay, that is fine, but it is typically the case that in scientific context some simulations are done for several different combinations of parameters. It is convenient to group all parameters in a dictionary, with the keys being the parameters. Depending on the package you will use to actually save the data, the key type should be either <code>String</code> or <code>Symbol</code>. Here we will be using JLD2.jl and therefore the key type will be <code>String</code>.</p><pre><code class="language-julia hljs">params = @strdict a b v method</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">Dict{String, Any} with 4 entries:
74-
&quot;v&quot; =&gt; [0.180715, 0.550622, 0.861601, 0.394185, 0.247738]
73+
r, y = fakesim(a, b, v, method)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">([3.771290566566879, 2.0321773626552555, 4.345305891764846, 3.5269226668192335, 4.313644068705602], 1.7320508075688772)</code></pre><p>Okay, that is fine, but it is typically the case that in scientific context some simulations are done for several different combinations of parameters. It is convenient to group all parameters in a dictionary, with the keys being the parameters. Depending on the package you will use to actually save the data, the key type should be either <code>String</code> or <code>Symbol</code>. Here we will be using JLD2.jl and therefore the key type will be <code>String</code>.</p><pre><code class="language-julia hljs">params = @strdict a b v method</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">Dict{String, Any} with 4 entries:
74+
&quot;v&quot; =&gt; [0.59043, 0.0107258, 0.781769, 0.508974, 0.771215]
7575
&quot;method&quot; =&gt; &quot;linear&quot;
7676
&quot;b&quot; =&gt; 3
7777
&quot;a&quot; =&gt; 2</code></pre><p>Above we used the ultra-cool <a href="../name/#DrWatson.@strdict"><code>@strdict</code></a> macro, which creates a dictionary from existing variables!</p><p>Now, for every simulation we want to do, we would create such a container. We can use the <a href="../run&amp;list/#DrWatson.dict_list"><code>dict_list</code></a> to ease up the process of preparing several of these parameter containers</p><pre><code class="language-julia hljs">allparams = Dict(
@@ -112,7 +112,7 @@
112112
wload(datadir(&quot;simulations&quot;, firstsim))</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">Dict{String, Any} with 8 entries:
113113
&quot;v&quot; =&gt; [2, 1]
114114
&quot;method&quot; =&gt; &quot;linear&quot;
115-
&quot;gitcommit&quot; =&gt; &quot;ba90137550819a517057fef8cda2a16d7dea8422-dirty&quot;
115+
&quot;gitcommit&quot; =&gt; &quot;e1c87b1c2d02c50dc70245e8b64e10d01a7b4e97-dirty&quot;
116116
&quot;script&quot; =&gt; &quot;docs/build/string#3&quot;
117117
&quot;b&quot; =&gt; 3
118118
&quot;r&quot; =&gt; [7, 4]
@@ -122,4 +122,4 @@
122122

123123
df = collect_results(datadir(&quot;simulations&quot;))</code></pre><div><div style = "float: left;"><span>4×7 DataFrame</span></div><div style = "clear: both;"></div></div><div class = "data-frame" style = "overflow-x: scroll;"><table class = "data-frame" style = "margin-bottom: 6px;"><thead><tr class = "header"><th class = "rowNumber" style = "font-weight: bold; text-align: right;">Row</th><th style = "text-align: left;">v</th><th style = "text-align: left;">method</th><th style = "text-align: left;">b</th><th style = "text-align: left;">r</th><th style = "text-align: left;">a</th><th style = "text-align: left;">y</th><th style = "text-align: left;">path</th></tr><tr class = "subheader headerLastRow"><th class = "rowNumber" style = "font-weight: bold; text-align: right;"></th><th title = "Union{Missing, Vector{Int64}}" style = "text-align: left;">Array…?</th><th title = "Union{Missing, String}" style = "text-align: left;">String?</th><th title = "Union{Missing, Int64}" style = "text-align: left;">Int64?</th><th title = "Union{Missing, Vector{Int64}}" style = "text-align: left;">Array…?</th><th title = "Union{Missing, Int64}" style = "text-align: left;">Int64?</th><th title = "Union{Missing, Float64}" style = "text-align: left;">Float64?</th><th title = "Union{Missing, String}" style = "text-align: left;">String?</th></tr></thead><tbody><tr><td class = "rowNumber" style = "font-weight: bold; text-align: right;">1</td><td style = "text-align: left;">[2, 1]</td><td style = "text-align: left;">linear</td><td style = "text-align: right;">3</td><td style = "text-align: left;">[7, 4]</td><td style = "text-align: right;">1</td><td style = "text-align: right;">1.73205</td><td style = "text-align: left;">/home/runner/work/DrWatson.jl/DrWatson.jl/docs/build/DrWatsonExample/data/simulations/a=1_b=3_method=linear.jld2</td></tr><tr><td class = "rowNumber" style = "font-weight: bold; text-align: right;">2</td><td style = "text-align: left;">[2, 1]</td><td style = "text-align: left;">linear</td><td style = "text-align: right;">4</td><td style = "text-align: left;">[9, 5]</td><td style = "text-align: right;">1</td><td style = "text-align: right;">2.0</td><td style = "text-align: left;">/home/runner/work/DrWatson.jl/DrWatson.jl/docs/build/DrWatsonExample/data/simulations/a=1_b=4_method=linear.jld2</td></tr><tr><td class = "rowNumber" style = "font-weight: bold; text-align: right;">3</td><td style = "text-align: left;">[2, 1]</td><td style = "text-align: left;">linear</td><td style = "text-align: right;">3</td><td style = "text-align: left;">[8, 5]</td><td style = "text-align: right;">2</td><td style = "text-align: right;">1.73205</td><td style = "text-align: left;">/home/runner/work/DrWatson.jl/DrWatson.jl/docs/build/DrWatsonExample/data/simulations/a=2_b=3_method=linear.jld2</td></tr><tr><td class = "rowNumber" style = "font-weight: bold; text-align: right;">4</td><td style = "text-align: left;">[2, 1]</td><td style = "text-align: left;">linear</td><td style = "text-align: right;">4</td><td style = "text-align: left;">[10, 6]</td><td style = "text-align: right;">2</td><td style = "text-align: right;">2.0</td><td style = "text-align: left;">/home/runner/work/DrWatson.jl/DrWatson.jl/docs/build/DrWatsonExample/data/simulations/a=2_b=4_method=linear.jld2</td></tr></tbody></table></div><p>Some things to note:</p><ul><li>the returned object is a <code>DataFrame</code> for further analysis.</li><li>the input to <code>collect_result</code> is a folder, <strong>not</strong> a dataframe! The function does the loading and combining for you.</li><li>If you create new simulations, you can iteratively (or all from scratch) add them to this dataframe.</li><li>If you create new simulations that have <strong>new parameters</strong>, that don&#39;t exist in the simulations already saved, that&#39;s no problem. <code>collect_results</code> will appropriately and automatically add <code>missing</code> to all parameter values that don&#39;t exist in previous and/or current simulations. This is demonstrated explicitly in the <a href="../real_world/#Adapting-to-new-data/parameters">Adapting to new data/parameters</a> real world example, so it is not repeated here.</li><li>Similarly with e.g. <code>savename</code>, <code>collect_results</code> is a flexible function. It has several configuration options.</li></ul><p>Great! so now we are doing some analysis and we want to save some results... It is very often the case in science that the same analysis may be done again, and again, and some times even with the same parameters... And poor scientitists sometimes forget to change the name of the output file, and end up overwritting previous work! Devastating!</p><p>To avoid such scenarios, we can use the function <a href="../save/#DrWatson.safesave"><code>safesave</code></a>, e.g.</p><pre><code class="language-julia hljs">analysis = 42
124124

125-
safesave(datadir(&quot;ana&quot;, &quot;linear.jld2&quot;), @strdict analysis)</code></pre><p>If a file <code>linear.jld2</code> exists in that folder, it is not overwritten. Instead, it is renamed to <code>linear#1.jld2</code>, and a new <code>linear.jld2</code> file is made!</p><h2 id="6.-Share-your-project"><a class="docs-heading-anchor" href="#6.-Share-your-project">6. Share your project</a><a id="6.-Share-your-project-1"></a><a class="docs-heading-anchor-permalink" href="#6.-Share-your-project" title="Permalink"></a></h2><p>This is already discussed in the <a href="../project/#Reproducibility">Reproducibility</a> section of the docs so there is no reason to copy/paste everything here. What is demonstrated there is that it is truly trivial to share your project with a colleague, and this project is guaranteed to work for them!</p><hr/><p>And that&#39;s it! We hope that DrWatson will take some stress out of the absurdly stressfull scientific life!</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../">« Introduction</a><a class="docs-footer-nextpage" href="../project/">Project Setup »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.3.0 on <span class="colophon-date" title="Wednesday 10 April 2024 17:10">Wednesday 10 April 2024</span>. Using Julia version 1.10.2.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
125+
safesave(datadir(&quot;ana&quot;, &quot;linear.jld2&quot;), @strdict analysis)</code></pre><p>If a file <code>linear.jld2</code> exists in that folder, it is not overwritten. Instead, it is renamed to <code>linear#1.jld2</code>, and a new <code>linear.jld2</code> file is made!</p><h2 id="6.-Share-your-project"><a class="docs-heading-anchor" href="#6.-Share-your-project">6. Share your project</a><a id="6.-Share-your-project-1"></a><a class="docs-heading-anchor-permalink" href="#6.-Share-your-project" title="Permalink"></a></h2><p>This is already discussed in the <a href="../project/#Reproducibility">Reproducibility</a> section of the docs so there is no reason to copy/paste everything here. What is demonstrated there is that it is truly trivial to share your project with a colleague, and this project is guaranteed to work for them!</p><hr/><p>And that&#39;s it! We hope that DrWatson will take some stress out of the absurdly stressfull scientific life!</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../">« Introduction</a><a class="docs-footer-nextpage" href="../project/">Project Setup »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.4.0 on <span class="colophon-date" title="Saturday 27 April 2024 08:34">Saturday 27 April 2024</span>. Using Julia version 1.10.2.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>

0 commit comments

Comments
 (0)
Please sign in to comment.