Skip to content

Commit 8401af1

Browse files
authored
Merge pull request #195 from VirtualPlanetaryLaboratory/dev
Dev
2 parents 123d253 + 2f4bb77 commit 8401af1

File tree

13 files changed

+115
-96
lines changed

13 files changed

+115
-96
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,5 @@ sandbox
9090
todo
9191
misc
9292
vplot/
93+
build/
94+
dist/

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,13 @@ Many of these modules can be combined together to simulate numerous phenomena an
6969
### Resources
7070

7171
The [examples/](examples) directory contains input files and scripts for generating the figures in [Barnes et al. (2020)](https://ui.adsabs.harvard.edu/abs/2020PASP..132b4502B/abstract) and subsequent publications. The [Manual/](Manual) directory contains the pdf of [Barnes et al. (2020)](https://ui.adsabs.harvard.edu/abs/2020PASP..132b4502B/abstract), which describes the physics of the first 11 modules, validates the software against observations and/or past results, and uses figures from the [examples/](examples) directory.
72-
72+
7373
An ecosystem of support software is also publicly available. In this repo, [vspace/](vspace) contains scripts to generate input files for a parameter space sweep, and then use [multi-planet/](multiplanet) to perform the simulations on an arbitrary number of cores. [bigplanet/](bigplanet) contains scripts to store large datasets in HDF5 format and quickly calculate summary properties from an integration, such as change in surface temperature. These three scripts can be run from the command line to seamlessly [perform parameter sweeps](https://virtualplanetarylaboratory.github.io/vplanet/parametersweep.html). In a separate repository is [vplot](https://github.com/VirtualPlanetaryLaboratory/vplot), which consists of both a command line tool to quickly plot the evolution of a system, and also matplotlib functions to generate publication-worthy figures. Finally, we recommend using [approxposterior](https://github.com/dflemin3/approxposterior) to quickly obtain posterior distributions of model parameters. These python scripts are optimized for [anaconda](https://www.anaconda.com/) distributions versions 3.5-3.7.
7474

7575
### Code Integrity
7676

7777
Behind the scenes, the VPLanet team maintains code integrity through [continuous integration](https://travis-ci.org), in which numerous scientific and numerical tests are validated at every commit. Check the "build" badge above for the current status. See the [tests/](tests) directory for the validation checks that the current build passes. The "coverage" badge shows the percentage of the code (by line number) that is currently tested by <a href="https://codecov.io/gh/VirtualPlanetaryLaboratory/vplanet">Codecov</a> at every commit. Additionally, we use [valgrind](http://valgrind.org) and [addresssanitizer](https://github.com/google/sanitizers/wiki/AddressSanitizer) to periodically search for memory issues like use of uninitialized memory, accessing memory beyond array bounds, etc. The "memcheck" badge shows the current status of the main branch, either clean (no errors) or dirty. If dirty, check the [Issues](https://github.com/VirtualPlanetaryLaboratory/vplanet/issues) for more information about the current status. Note that all releases are clean. We are committed to maintaining a stable tool for scientists to analyze any planetary system.
7878

79-
8079
### Community
8180

8281
`VPLanet` is a community project. We're happy to take pull requests; if you want to create one, please issue it to the *dev* branch. The documentation includes [tutorials on adding new features and modules](https://VirtualPlanetaryLaboratory.github.io/vplanet/tutorials.html). It's a platform for planetary science that can grow exponentially, either by adding new physics or by adding competing models for clean comparisons.
@@ -95,5 +94,4 @@ If you use this code to generate results used in any publication or conference c
9594

9695
Enjoy!
9796

98-
99-
© 2018-2020 The VPLanet Team.
97+
© 2018-2021 The VPLanet Team.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.0.6
1+
2.1.0

docs/VPLanetLogo.png

100644100755
-23.7 KB
Loading

docs/authors.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ development.
3535
He also found many bugs with valgrind and address-sanitizer.
3636

3737
**Caitlyn Wilhelm** added forced eccentricity and obliquity oscillations to
38-
POISE, and assisted in debugging it. She also built the bigplanet and
39-
multi-planet script.
38+
POISE, and assisted in debugging it. She also built the BigPlanet and
39+
MultiPlanet scripts.
4040

4141
**Rodolfo Garcia** assisted in AtmEsc and ThermInt development.
4242

docs/parametersweep.rst

Lines changed: 89 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
Parameter Sweep Guide
22
===================
33

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
88
and streamlines analysis. The following guide explains how to use these
99
tools with an example based on Earth's internal thermal evolution. Files for the example
1010
presented here can be found in `examples/ParameterSweep
@@ -15,93 +15,92 @@ core temperature and the current amount of radiogenic heating from potassium-40.
1515

1616
.. note::
1717

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
1919
reproduce this example.
2020

2121

22-
Initializing Parameter Sweeps with :code:`vspace`
22+
Initializing Parameter Sweeps with :code:`VSPACE`
2323
------------------------
2424

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
2929
<https://github.com/VirtualPlanetaryLaboratory/vplanet/tree/master/examples/EarthInterior>`_)
3030
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
3232
dTCore (initial core temperature) and d40KPowerCore (initial radiogenic power from potassium-40).
3333

34-
Here’s the input file for :code:`vspace`:
34+
Here’s the input file for :code:`VSPACE`:
3535

3636
.. code-block:: bash
3737
38-
srcfolder ~/vplanet/examples/EarthInterior
39-
destfolder ParameterSweep
40-
trialname test_
38+
sSrcFolder ~/vplanet/examples/EarthInterior
39+
sDestFolder ParameterSweep
40+
sTrialName test_
4141
42-
file sun.in
42+
sBodyFile sun.in
4343
44-
file earth.in
44+
sBodyFile earth.in
4545
4646
dTCore [5500, 6500, n10] tcore
4747
d40KPowerCore [-1.5, -0.5, n10] K
4848
49-
file vpl.in
49+
sPrimaryFile vpl.in
5050
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
5453
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
5655
simulations will be 100.
5756

58-
To build the files, run the following command in the command line:
57+
To build the files, run the following command:
5958

6059
.. code-block:: bash
6160
62-
vspace [-q, -f] vspace.in
61+
vspace [-q -f] vspace.in
6362
6463
This command will create the folder ParameterSweep, with 100 folders
6564
inside of it, each with their own sun.in, earth.in and vpl.in with the
6665
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.
6968

7069
.. note::
7170

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*.
7473

75-
Running Simulations with :code:`multi-planet`
74+
Running Simulations with :code:`MultiPlanet`
7675
-------------------------
7776

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`
7978
across the processors on your computer. To run, type the following in the
8079
command line:
8180

8281
.. code-block:: bash
8382
84-
multi-planet -c <num_cores> [-q] vspace.in
83+
multiplanet -c <num_cores> [-q -bp] vspace.in
8584
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>`_
8887
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
9190
more information. Use the -q option to suppress output to the terminal.
9291

9392
.. note::
9493

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
9695
cores on the machine.
9796

98-
Checking :code:`multi-planet` Progress with :code:`mpstatus`
97+
Checking :code:`MultiPlanet` Progress with :code:`mpstatus`
9998
-------------------------
10099

101100
This example is quick to run (~1 minute, depending on the number of cores), but for
102101
longer simulations it is often
103102
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
105104
following command:
106105

107106
.. code-block:: bash
@@ -112,56 +111,75 @@ This command returns output like the following to the terminal:
112111

113112
.. code-block:: bash
114113
115-
--Multi-Planet Status--
114+
--MultiPlanet Status--
116115
Number of Simulations completed: 35
117116
Number of Simulations in progress: 6
118117
Number of Simulations remaining: 59
119118
120119
But with the proper numbers shown.
121120

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
123122
of data. Storing, analyzing, and plotting these data can be tedious as each output file
124123
from each directory must be opened and read in sequentially. To streamline this process,
125-
use :code:`bigplanet`.
124+
use :code:`BigPlanet`.
126125

127-
Compressing Data with :code:`bigplanet`
126+
Compressing Data with :code:`BigPlanet`
128127
-------------------------------
129128

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
131130
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
135134
finishes):
136135

137136

138137
.. code-block:: bash
139138
140-
bigplanet -c <num_cores> [-q] vspace.in
139+
bigplanet -c <num_cores> [-a] bpl.in
141140
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
144161
<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
148166
149167
.. note::
150168

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
152170
cores on the machine.
153171

154-
Checking :code:`bigplanet` Progress with :code:`bpstatus`
172+
Checking :code:`BigPlanet` Progress with :code:`bpstatus`
155173
-------------------------
156174

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
158176
status, use :code:`bpstatus`, which employs the same syntax as :code:`mpstatus` above.
159177

160-
Extracting and Plotting with :code:`bigplanet`
178+
Extracting and Plotting with :code:`BigPlanet`
161179
------------------------------
162180

163181
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
165183
extraction of data from the HDF5 file. For our example, final inner core radius as a function of
166184
current potassium-40 abundance in the core and the initial core temerature, the script looks like
167185
this:
@@ -172,7 +190,7 @@ this:
172190
import matplotlib.pyplot as plt
173191
import vplot as vpl
174192
175-
data = bp.HDF5File(‘ParameterSweep.hdf5’)
193+
data = bp.HDF5File(‘ParameterSweep.bpf’)
176194
177195
This loads in the necessary modules and reads in the HDF5 file as data. Now we are
178196
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:
181199

182200
.. code-block:: python
183201
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')
186204
187205
ExtractColumn returns an array in which each element corresponds to the final
188206
value of the inner core radius for each simulation. The first argument is the HDF5
189207
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
191209
<https://github.com/VirtualPlanetaryLaboratory/vplanet/tree/master/multi-planet>`_.
192210
In brief, the key syntax is "body_variable_aggregation", in
193211
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:
201219

202220
.. code-block:: python
203221
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')
206224
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')
209227
210228
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
212230
can easily transform an array into the appropriately shaped matrix with the ``CreateMatrix``
213231
function:
214232

@@ -227,30 +245,30 @@ of Earth's inner core radius.
227245

228246
.. figure:: BigPlanetExample.png
229247

230-
Creating Meta-Data Files with :code:`bigplanet`
248+
Creating Meta-Data Files with :code:`BigPlanet`
231249
----------------------------
232250

233251
Finally, it's often convenient to write out ASCII files in which each line contains the meta-data
234252
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:
236254

237255
.. code-block:: python
238256
239-
WriteOutput(inputfile, columns, file="bigplanet.out", delim=" ", header=False, ulysses=False)
257+
ArchiveToCSV(inputfile, columns, exportfile, delim=" ", header=False, ulysses=0)
240258
241259
where:
242260

243261
*inputfile* is the name of the HDF5 file
244262

245263
*columns* is the list of keys you are extracting, i.e. the output from calls to ExtractColumn
246264

247-
*File* is the name of the output file
265+
*exportfile* is the name of the output file
248266

249267
*delim* is the delimiter for the output file (the default is spaces)
250268

251269
*header* adds the names and units for each column (default is False)
252270

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)
254272

255273

256274
You are now ready to efficiently explore your parameter space!

docs/repos.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ can be found at the GitHub sites:
1313
David Graham <https://github.com/dglezg7>
1414
David Fleming <https://github.com/dflemin3>
1515
Héctor Martínez-Rodríguez <https://github.com/hector-mr>
16+
Caitlyn Wilhelm <https://github.com/caitlyn-wilhelm>

0 commit comments

Comments
 (0)