1
1
Parameter Sweep Guide
2
2
===================
3
3
4
- Parameter sweeps are a very common use of VPLanet, and the team has
5
- developed a set of python and command line tools to facilitate their completion
6
- and analysis. In brief, :code: `vspace ` builds a set of initial conditions,
7
- :code: `multi-planet ` performs the simulations, and :code: `bigplanet ` compresses the data
4
+ Parameter sweeps are a very common use of `` VPLanet `` , and the team has
5
+ developed a set of Python and command line tools to facilitate their completion
6
+ and analysis. In brief, :code: `VSPACE ` builds a set of initial conditions,
7
+ :code: `multi-planet ` performs the simulations, and :code: `BigPlanet ` compresses the data
8
8
and streamlines analysis. The following guide explains how to use these
9
9
tools with an example based on Earth's internal thermal evolution. Files for the example
10
10
presented here can be found in `examples/ParameterSweep
@@ -15,93 +15,92 @@ core temperature and the current amount of radiogenic heating from potassium-40.
15
15
16
16
.. note ::
17
17
18
- You need to install :code: `vplot `, :code: `vspace `, :code: `multi-planet `, and :code: `bigplanet ` to
18
+ You need to install :code: `vplot `, :code: `VSPACE `, :code: `MultiPlanet `, and :code: `BigPlanet ` to
19
19
reproduce this example.
20
20
21
21
22
- Initializing Parameter Sweeps with :code: `vspace `
22
+ Initializing Parameter Sweeps with :code: `VSPACE `
23
23
------------------------
24
24
25
- The first step is to create an input file for :code: `vspace `, which is typically called `vspace .in `.
26
- As described in more detail in :code: `vspace `'s `documentation
27
- <https://github.com/VirtualPlanetaryLaboratory/vplanet/tree/master/vspace > `_, this file
28
- modifies template files (here we use the .in files from `examples/EarthInterior
25
+ The first step is to create an input file for :code: `VSPACE `, which is typically called `VSPACE .in `.
26
+ As described in more detail in :code: `VSPACE `'s `documentation
27
+ <https://virtualplanetarylaboratory. github.io/VSPACE/ > `_, this file
28
+ modifies template files (here we use the `` VPLanet `` input files from `examples/EarthInterior
29
29
<https://github.com/VirtualPlanetaryLaboratory/vplanet/tree/master/examples/EarthInterior> `_)
30
30
and then builds a directory structure with each
31
- folder containing the .in files for a specific simulation. In this guide we vary
31
+ folder containing the input files for a specific simulation. In this guide we vary
32
32
dTCore (initial core temperature) and d40KPowerCore (initial radiogenic power from potassium-40).
33
33
34
- Here’s the input file for :code: `vspace `:
34
+ Here’s the input file for :code: `VSPACE `:
35
35
36
36
.. code-block :: bash
37
37
38
- srcfolder ~ /vplanet/examples/EarthInterior
39
- destfolder ParameterSweep
40
- trialname test_
38
+ sSrcFolder ~ /vplanet/examples/EarthInterior
39
+ sDestFolder ParameterSweep
40
+ sTrialName test_
41
41
42
- file sun.in
42
+ sBodyFile sun.in
43
43
44
- file earth.in
44
+ sBodyFile earth.in
45
45
46
46
dTCore [5500, 6500, n10] tcore
47
47
d40KPowerCore [-1.5, -0.5, n10] K
48
48
49
- file vpl.in
49
+ sPrimaryFile vpl.in
50
50
51
- This file directs :code: `vspace ` to vary initial core temperature from 5500 to 6500 in 10 steps and
52
- initial potassium-40 power from 50 - 150% of Earth's nominal initial amount (see the VPLanet paper
53
- for more details). The directories will be built in a folder called
51
+ This file directs :code: `VSPACE ` to vary initial core temperature from 5500 to 6500 in 10 steps and
52
+ initial potassium-40 power from 50 - 150% of Earth's nominal initial amount. The directories will be built in a folder called
54
53
ParameterSweep and the individual folders will be called test_tcore?K?, where the
55
- "n" tells :code: `vspace ` to create 10 evenly spaced values for each (other distributions are available), so the total number of
54
+ "n" tells :code: `VSPACE ` to create 10 evenly spaced values for each (other distributions are available), so the total number of
56
55
simulations will be 100.
57
56
58
- To build the files, run the following command in the command line :
57
+ To build the files, run the following command:
59
58
60
59
.. code-block :: bash
61
60
62
- vspace [-q, -f ] vspace.in
61
+ vspace [-q -f ] vspace.in
63
62
64
63
This command will create the folder ParameterSweep, with 100 folders
65
64
inside of it, each with their own sun.in, earth.in and vpl.in with the
66
65
parameters from the EarthInteror example, but with dTCore and d40KPowerCore changed
67
- based on the vspace file. Use -q to suppress output and -f to force :code: `vspace ` to overwrite previous
68
- data (including any :code: `multi-planet ` and :code: `bigplanet ` files!). Now we are ready to run the parameter sweep.
66
+ based on the instructions in the VSPACE.in file. Use `` -q `` to suppress output and `` -f `` to force :code: `VSPACE ` to overwrite previous
67
+ data (including any :code: `MultiPlanet ` and :code: `BigPlanet ` files!). Now we are ready to run the parameter sweep.
69
68
70
69
.. note ::
71
70
72
- If you randomly generate initial conditions, i.e. Monte Carlo, then :code: `vspace ` automatically creates histograms of the
73
- options you varied so you can confirm the initial conditions. These png files are located in destfolder.
71
+ If you randomly generate initial conditions, i.e. Monte Carlo, then :code: `VSPACE ` automatically creates histograms of the
72
+ options you varied so you can confirm the initial conditions. These png files are located in * destfolder * .
74
73
75
- Running Simulations with :code: `multi-planet `
74
+ Running Simulations with :code: `MultiPlanet `
76
75
-------------------------
77
76
78
- :code: `multi-planet ` is the command line tool to run the simulations created with :code: `vspace `
77
+ :code: `MultiPlanet ` is the command line tool to run the simulations created with :code: `VSPACE `
79
78
across the processors on your computer. To run, type the following in the
80
79
command line:
81
80
82
81
.. code-block :: bash
83
82
84
- multi-planet -c < num_cores> [-q] vspace.in
83
+ multiplanet -c < num_cores> [-q -b p ] vspace.in
85
84
86
- The optional argument -c (or --cores) tells :code: `multi-planet ` the number of cores to run.
87
- There is another optional argument that creates the HDF5 Files for :code: ` bigplanet `
85
+ The optional argument `` -c `` (or `` --cores `` ) tells :code: `MultiPlanet ` the number of cores to run.
86
+ The `` -bp `` flag creates ` "BigPlanet archive < https://virtualplanetarylaboratory.github.io/ bigplanet/filetypes.html >`_
88
87
directly after the simulation completes, but we are going to leave it at the default
89
- setting, which is false. See the :code: `multi-planet ` `documentation
90
- <https://github.com/VirtualPlanetaryLaboratory/vplanet/tree/master /multi-planet> `_ for
88
+ setting, which is false. See the :code: `MultiPlanet ` `documentation
89
+ <https://virtualplanetarylaboratory. github.io /multi-planet> `_ for
91
90
more information. Use the -q option to suppress output to the terminal.
92
91
93
92
.. note ::
94
93
95
- The default number of cores :code: `multi-planet ` will use is the maximum number of
94
+ The default number of cores :code: `MultiPlanet ` will use is the maximum number of
96
95
cores on the machine.
97
96
98
- Checking :code: `multi-planet ` Progress with :code: `mpstatus `
97
+ Checking :code: `MultiPlanet ` Progress with :code: `mpstatus `
99
98
-------------------------
100
99
101
100
This example is quick to run (~1 minute, depending on the number of cores), but for
102
101
longer simulations it is often
103
102
helpful to know how far along the parameter sweep is. The command :code: `mpstatus ` returns the
104
- current state of the :code: `multi-planet ` process. To check the current status, type the
103
+ current state of the :code: `MultiPlanet ` process. To check the current status, type the
105
104
following command:
106
105
107
106
.. code-block :: bash
@@ -112,56 +111,75 @@ This command returns output like the following to the terminal:
112
111
113
112
.. code-block :: bash
114
113
115
- --Multi-Planet Status--
114
+ --MultiPlanet Status--
116
115
Number of Simulations completed: 35
117
116
Number of Simulations in progress: 6
118
117
Number of Simulations remaining: 59
119
118
120
119
But with the proper numbers shown.
121
120
122
- After :code: `multi-planet ` completes, you may have a large number of directories with gigabytes
121
+ After :code: `MultiPlanet ` completes, you may have a large number of directories with gigabytes
123
122
of data. Storing, analyzing, and plotting these data can be tedious as each output file
124
123
from each directory must be opened and read in sequentially. To streamline this process,
125
- use :code: `bigplanet `.
124
+ use :code: `BigPlanet `.
126
125
127
- Compressing Data with :code: `bigplanet `
126
+ Compressing Data with :code: `BigPlanet `
128
127
-------------------------------
129
128
130
- The :code: `bigplanet ` command compresses your parameter sweep data into an HDF5 file in which
129
+ The :code: `BigPlanet ` command compresses your parameter sweep data into an HDF5 file in which
131
130
specific data can be efficiently extracted. **Although compression can take some time,
132
- plotting with a ** :code: `bigplanet ` **file can be orders of magnitude faster because the script will
133
- not need to open files and each directory! **
134
- To compress the data, type the following command in the terminal (after multi-planet
131
+ plotting with a ** :code: `BigPlanet ` ** file can be orders of magnitude faster because the script will
132
+ not need to open files and each directory!** Here we demonstrate the typical workflow of building a biplanet file.
133
+ To compress the data, type the following command in the terminal (after MultiPlanet
135
134
finishes):
136
135
137
136
138
137
.. code-block :: bash
139
138
140
- bigplanet -c < num_cores> [-q] vspace .in
139
+ bigplanet -c < num_cores> [-a] bpl .in
141
140
142
- The bigplanet arguments work identically to :code: `multi-planet `’s with the user able to
143
- specify the number of processors :code: `bigplanet ` can use. This will create an `HDF5
141
+ The BigPlanet arguments work similarly to :code: `multiplanet `’s with the user able to
142
+ specify the number of processors :code: `BigPlanet ` can use. The only difference is that
143
+ BigPlanet uses a bpl.in file, which is *very * similar to a vspace input file.
144
+
145
+ Here’s the input file for :code: `BigPlanet `:
146
+
147
+ .. code-block :: bash
148
+
149
+ sSrcFolder ~ /vplanet/examples/EarthInterior
150
+ sDestFolder ParameterSweep
151
+ sArchiveFile ParameterSweep.bpa
152
+
153
+ saBodyFiles sun.in earth.in
154
+
155
+ sPrimaryFile vpl.in
156
+
157
+ saKeyInclude earth:TCore:initial earth:40KPowerCore:final earth:RIC:final
158
+
159
+
160
+ This will create an `HDF5
144
161
<https://en.wikipedia.org/wiki/Hierarchical_Data_Format> `_ file
145
- that shares the same name as the destfolder from the :code: `vspace ` file, but with ".hdf5"
146
- appended, e.g. ParameterSweep.hdf5. This file will now replace the directory structure
147
- created by :code: `vspace `. Use the -q option to suppress output to the terminal.
162
+ that shares the same name as the destfolder from the :code: `VSPACE ` file, but with ".bpf" or ".bpa"
163
+ appended, e.g. ParameterSweep.bpa. This file will now replace the directory structure
164
+ created by :code: `VSPACE `. The -a option is for creation of an achvie file, which has **everything from
165
+ the destfolder created with :code:`VSPACE` and the data generated from :code:`MultiPlanet`. Here is a
148
166
149
167
.. note ::
150
168
151
- The default number of cores :code: `bigplanet ` will use is the maximum number of
169
+ The default number of cores :code: `BigPlanet ` will use is the maximum number of
152
170
cores on the machine.
153
171
154
- Checking :code: `bigplanet ` Progress with :code: `bpstatus `
172
+ Checking :code: `BigPlanet ` Progress with :code: `bpstatus `
155
173
-------------------------
156
174
157
- For large data sets, :code: `bigplanet ` may take several hours or more to complete. To check the
175
+ For large data sets, :code: `BigPlanet ` may take several hours or more to complete. To check the
158
176
status, use :code: `bpstatus `, which employs the same syntax as :code: `mpstatus ` above.
159
177
160
- Extracting and Plotting with :code: `bigplanet `
178
+ Extracting and Plotting with :code: `BigPlanet `
161
179
------------------------------
162
180
163
181
After you have compressed your data, you need to access it. To accomplish this goal,
164
- :code: `bigplanet ` is also a python module that can be imported into python scripts for the
182
+ :code: `BigPlanet ` is also a python module that can be imported into python scripts for the
165
183
extraction of data from the HDF5 file. For our example, final inner core radius as a function of
166
184
current potassium-40 abundance in the core and the initial core temerature, the script looks like
167
185
this:
@@ -172,7 +190,7 @@ this:
172
190
import matplotlib.pyplot as plt
173
191
import vplot as vpl
174
192
175
- data = bp.HDF5File(‘ParameterSweep.hdf5 ’)
193
+ data = bp.HDF5File(‘ParameterSweep.bpf ’)
176
194
177
195
This loads in the necessary modules and reads in the HDF5 file as data. Now we are
178
196
ready to extract the data we want to graph, which are the initial values of TCore,
@@ -181,13 +199,13 @@ start with inner core radius, grabbing its final values and its units:
181
199
182
200
.. code-block :: python
183
201
184
- RIC = bp.ExtractColumn(data,' earth_RIC_final ' )
185
- RIC_units = bp.ExtractUnits(data,' earth_RIC_final ' )
202
+ RIC = bp.ExtractColumn(data,' earth:RIC:final ' )
203
+ RIC_units = bp.ExtractUnits(data,' earth:RIC:final ' )
186
204
187
205
ExtractColumn returns an array in which each element corresponds to the final
188
206
value of the inner core radius for each simulation. The first argument is the HDF5
189
207
file, the second argument is called a "key" and describes a parameter of
190
- interest. To learn more about keys, consult the `bigplanet documentation
208
+ interest. To learn more about keys, consult the `BigPlanet documentation
191
209
<https://github.com/VirtualPlanetaryLaboratory/vplanet/tree/master/multi-planet> `_.
192
210
In brief, the key syntax is "body_variable_aggregation", in
193
211
which aggregation is some property of a body's variable, e.g. the final value. The
@@ -201,14 +219,14 @@ needed for the plot, use the ``ExtractUniqueValues`` function, like so:
201
219
202
220
.. code-block :: python
203
221
204
- TCore_uniq = bp.ExtractUniqueValues(data,' earth_TCore_initial ' )
205
- TCore_units = bp.ExtractUnits(data,' earth_TCore_initial ' )
222
+ TCore_uniq = bp.ExtractUniqueValues(data,' earth:TCore:initial ' )
223
+ TCore_units = bp.ExtractUnits(data,' earth:TCore:initial ' )
206
224
207
- K40_uniq = bp.ExtractUniqueValues(data,' earth_40KPowerCore_final ' )
208
- K40_units = bp.ExtractUnits(data,' earth_40KPowerCore_final ' )
225
+ K40_uniq = bp.ExtractUniqueValues(data,' earth:40KPowerCore:final ' )
226
+ K40_units = bp.ExtractUnits(data,' earth:40KPowerCore:final ' )
209
227
210
228
Now we have the values we need for our plot, but the inner core radius is currently
211
- stored as an array, not a matrix, so we're still not ready to plot. With :code: `bigplanet ` you
229
+ stored as an array, not a matrix, so we're still not ready to plot. With :code: `BigPlanet ` you
212
230
can easily transform an array into the appropriately shaped matrix with the ``CreateMatrix ``
213
231
function:
214
232
@@ -227,30 +245,30 @@ of Earth's inner core radius.
227
245
228
246
.. figure :: BigPlanetExample.png
229
247
230
- Creating Meta-Data Files with :code: `bigplanet `
248
+ Creating Meta-Data Files with :code: `BigPlanet `
231
249
----------------------------
232
250
233
251
Finally, it's often convenient to write out ASCII files in which each line contains the meta-data
234
252
for your parameter sweep, e.g. the initial eccentricity, the final semi-major axis, and the maximum
235
- inclination. :code: `bigplanet ` facilitates the creation of these files with the ``WriteOutput `` method:
253
+ inclination. :code: `BigPlanet ` facilitates the creation of these files with the ``ArchiveToCSV `` method:
236
254
237
255
.. code-block :: python
238
256
239
- WriteOutput (inputfile, columns, file = " bigplanet.out " , delim = " " , header = False , ulysses = False )
257
+ ArchiveToCSV (inputfile, columns, exportfile , delim = " " , header = False , ulysses = 0 )
240
258
241
259
where:
242
260
243
261
*inputfile * is the name of the HDF5 file
244
262
245
263
*columns * is the list of keys you are extracting, i.e. the output from calls to ExtractColumn
246
264
247
- *File * is the name of the output file
265
+ *exportfile * is the name of the output file
248
266
249
267
*delim * is the delimiter for the output file (the default is spaces)
250
268
251
269
*header * adds the names and units for each column (default is False)
252
270
253
- *ulysses * makes the file compatable with `VR Ulysses <https://www.vrulysses.com/ >`_ (default is False )
271
+ *ulysses * makes the file compatable with `VR Ulysses <https://www.vrulysses.com/ >`_ (default is 0 )
254
272
255
273
256
274
You are now ready to efficiently explore your parameter space!
0 commit comments