-
Notifications
You must be signed in to change notification settings - Fork 0
/
WatsonBasics.jl
54 lines (40 loc) · 1.2 KB
/
WatsonBasics.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# It's part of DynamicalSystems so add
using Pkg
Pkg.add(["DynamicalSystems", "DrWatson", "BSON"])
using DrWatson
# Initialize Project
initialize_project("Project_Name"; authors="My_Name")
# Active the Project Environment
@quickactivate "Project_Name"
# Navigation Basics
cd("Change current working directory to anywhere")
projectdir()
datadir()
# extracting parameter values into name
params_1 = Dict(:a => 2, :b => 3, :v => rand(5), :method = "linear")
savename(params_1)
struct A
a
b
method
end
params_2 = A(0.5, 3.2, "linear")
savename(params_2)
savename("prefix", params_2, "bson")
# "prefix_a=0.5_b=3.2_method=linear.bson"
# Saving tools
save("name.bson", data)
safesave("name.bson", data)
# It adds git information for reproducibility
# like :gitcommit, :script, :gitpatch
@tagsave(datadir("name.bson"), data; safe = true)
load(datadir("name.bson"))
# Send entire project to Colleague
# and they will run
```
julia> using Pkg
julia> Pkg.add("DrWatson") # install globally, for using `quickactivate`
julia> Pkg.activate("path/to/this/project")
julia> Pkg.instantiate()
```
# Relative Paths, Exact Package Versions, Git Information