Skip to content

mjkramer/JuliaDybExample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Julia Daya Bay example

Set up

Note: These steps are intended to be run on Cori at NERSC. Other systems and platforms should work, but you'll need to change, e.g., the value of DATA_FILE in TrigTimeSep.jl to point to a valid Daya Bay reconstructed data file. When possible I'll point out special considerations for Mac/Windows.

Installing Julia

Download the latest version of Julia and follow the instructions for your platform. For example, on Cori, you would do something like the following (replacing 1.4.2 with the latest version, of course):

cd
wget https://julialang-s3.julialang.org/bin/linux/x64/1.4/julia-1.4.2-linux-x86_64.tar.gz
tar xf julia-1.4.2-linux-x86_64.tar.gz
rm julia-1.4.2-linux-x86_64.tar.gz

Now Julia can be started by typing out the full path to the executable, e.g., ~/julia-1.4.2/bin/julia. However, it would be more convenient if you could just type julia. Toward that end, you could add ~/julia-1.4.2/bin to your PATH, but let's kill two birds with one stone and use a different solution. Run the following, and put it in your ~/.bashrc.ext (or its equivalent) to make it persist:

alias julia="PYTHON= ~/julia-1.4.2/bin/julia"

On Linux, setting the PYTHON environment variable to the empty string tells Julia not to use the system's Python + packages, but to manage its own (using Conda). This means that you don't have to worry about installing any needed Python packages (like UpROOT), as Julia will do it for you. This convenience is the default on Mac and Windows, but not on Linux, where we must force it using this trick. If you already have a well-oiled Python 3 environment, you can use it by leaving PYTHON alone; just be sure to install UpROOT with pip or conda.

Running the example (plotting AD trigger time differences)

In your terminal, navigate to this directory, and start up Julia. To "activate" this project, go to the package manager by pressing the ] key, enter activate . and then exit the package manager by pressing backspace. (Protip: To skip the activate dance, start Julia like julia --project=..) Then load the analysis by running include("TrigTimeSep.jl"), and finally, run example_plot().

Making your own project

Create a directory, cd into it, run Julia, press ] to go to the package prompt, create/activate the empty project with activate ., then add any desired packages by doing, e.g., add UpROOT. You will now have a Project.toml file, containing a list of the packages you added, and a Manifest.toml file, listing (for reproducibility) the exact versions of every package you added along with those of all their dependencies.

About

Examples of Daya Bay analysis with Julia

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages