Skip to content

Julia module for creating plots, GIFs, and videos from the data produced by Gadget2/3/4 simulations.

License

Notifications You must be signed in to change notification settings

Ezequiel92/GADGETPlotting

Repository files navigation

🚨 DEPRECATED 🚨

This package is no longer under development, it will only get its dependecies updated, see GalaxyInspector instead.

🌌 GADGET Plotting

Caution

Some functions use data generated exclusively by my personal version of P-Gadget3, which is not a publicly available code. This code is written for my personal use and may break at any moment. So, use it at your own risk.

Julia module for creating plots, GIFs, and videos from the data produced by Gadget2/3/4 simulations.

There are more advanced tools to analyze/plot the data generated by Gadget2/3/4 (you can see some in the References section), but this module was written, not only as a basic plotting tool, but as an exercise to learn Julia and software development in general (testing, documentation, version control, etc.).

⚙️ Characteristics

  • This only works with snapshots in the binary output format of Gadget2/3/4 (option SnapFormat = 2).
  • This is a script inside a module, not a package. Only five global constants and no data structures are defined.
  • Two small testing data sets are provided in example/example_data/, one from an isolated simulation and the other from a cosmological one.
  • The script example/run_examples.jl shows how to import the main module, gives examples for every function, and provides a sanity check, as it should run without errors.
  • The dependencies are given by the Project.toml files.

🖥️ Functions

There are four tiers of functions:

  • Auxiliary functions (src/auxiliary.jl): These are only for internal use. All but make_video are pure functions that do soma data processing. Some of these are exported for testing purposes.
  • Data acquisition functions (src/data_acquisition.jl): These are only for internal use. They take the location of the data files, apply some transformation (e.g. unit conversions) and return the data inside a familiar data structure.
  • Plotting functions (src/plotting.jl): These are exported, but I do not recommend using them as is. These are pure functions that take data in the format outputted by the data acquisition functions and return plot objects. They do all the data processing necessary to create the plots, except unit conversion. They will plot using the units selected when the data acquisition functions were called.
  • Pipeline functions (src/pipelines.jl): These are exported. These functions run a whole pipeline, from raw data to the final plot. They take the location of the snapshot files with some configuration parameters, and as a result, produce a series of plots/GIFs/videos. By default, some of these functions may generate a large number of images (but can be configured to do less), and they may take a long time to run.

📘 Examples

Refer to examples/ for how to use the functions. Note that the scripts there expect the simple file structure of this repo, namely:

.
├── src
│    ├── GADGETPlotting.jl 
│    └── ...
├── example  
│    ├── example_data
│    │    └── ...
│    ├── run_examples.jl
│    └── ...
└── ...

🔗 References

I make extensive use of Ludwig Boess packages to read snapshots, manipulate units and apply kernels to the data.

Official GADGET

GADGET2

GADGET4

Alternative vizualization tools

Splash (in FORTRAN)

yt (in Python)

pynbody/tangos (in Python)

pygad (in Python)

About

Julia module for creating plots, GIFs, and videos from the data produced by Gadget2/3/4 simulations.

Topics

Resources

License

Stars

Watchers

Forks

Languages