C++11
and is structured in classes for flexibility and configurability. Any new model, likelihood and prior probability density functions can be defined and implemented, deriving from an abstract class.
Please make sure you read the documentation at diamonds.readthedocs.io before installing and using the code.
To compile the C++ sources yourself, you should have the following utilities installed:
- git
- gcc
- cmake
- ninja
On Ubuntu, these utilities can be installed if needed by running sudo apt install git gcc cmake ninja
.
- First, clone this repository with
git clone
and use thecd
command to change into the newly cloned directory. - Create a build directory and change into it:
mkdir build && cd build
- Run cmake to prepare running the compiler:
cmake -GNinja -DCMAKE_CXX_FLAGS=-fopenmp -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCMAKE_BUILD_TYPE=Release ..
- Tip: Change "Release" to "Debug" to obtain a build with debug symbols, so you can use for example gdb to debug Diamonds and Background.
- Run ninja to run the compiler:
ninja
If all goes well and no errors happen in the above steps, the build directory will contain libdiamonds.so
(a shared library) and background
(an executable).
Then you should be able to build a demo application by typing cd demos
and then running
g++ -o demoSingle2DGaussian demoSingle2DGaussian.cpp -L../build -Wl,-rpath=$PWD/../build -I../include -ldiamonds -std=c++11
Run the demo by typing ./demoSingle2DGaussian
.
Note - don't remove libdiamonds.so in the build directory and don't move the repository somewhere else on the filesystem, because that will cause the demo to no longer work! The reason is that the demoSingle2DGaussian executable knows (using -rpath) that it should look for libdiamonds.so inside the build directory where it currently exists on the filesystem.
To compile the C++ sources yourself, you should have the following utilities installed:
- git
- clang
- make
- cmake
On a Mac, git, clang and make should already be available;
cmake can be installed with Homebrew by running sudo brew install cmake
.
- First, clone this repository with
git clone
and use thecd
command to change into the newly cloned directory. - Create a build directory and change into it:
mkdir build && cd build
- Run cmake to prepare running the compiler:
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCMAKE_BUILD_TYPE=Release ..
- Tip: Change "Release" to "Debug" to obtain a build with debug symbols, so you can use for example gdb to debug Diamonds and Background.
- Run ninja to run the compiler:
make -j4
If all goes well and no errors happen in the above steps, the build directory will contain libdiamonds.dylib
(a dynamic library) and background
(an executable).
Then you should be able to build a demo application by typing cd demos
and then running
clang++ -o demoSingle2DGaussian demoSingle2DGaussian.cpp -L../build -I ../include -ldiamonds -stdlib=libc++ -std=c++11 -Wno-deprecated-register
Run the demo by typing ./demoSingle2DGaussian
.
To run the tutorials provided in the package, please follow the guidelines presented in tutorials/README.md
Here's the Linux shell commands you should run to follow the steps in the tutorial. Inside a fresh clone of this repository, run:
mkdir build &&
cd build &&
cmake -GNinja -DCMAKE_CXX_FLAGS=-fopenmp -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCMAKE_BUILD_TYPE=Release .. &&
ninja &&
echo $PWD/ > localPath.txt &&
mkdir data &&
cp ../tutorials/KIC012008916/KIC012008916.txt data &&
mkdir results &&
cp -rt results ../tutorials/KIC012008916 &&
mkdir results/KIC012008916/00 &&
./background KIC 012008916 00 ThreeHarvey background_hyperParameters 0.0 0
Here's the Linux shell commands you should run to build the library and the demo. Inside a fresh clone of this repository, run:
mkdir build &&
cd build &&
cmake -GNinja -DCMAKE_CXX_FLAGS=-fopenmp -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCMAKE_BUILD_TYPE=Release .. &&
ninja &&
cd ../demos &&
g++ -o demoSingle2DGaussian demoSingle2DGaussian.cpp -L../build -Wl,-rpath=$PWD/../build -I../include -ldiamonds -std=c++11 &&
./demoSingle2DGaussian