Skip to content

Tutorials

Mike Jarvis edited this page Sep 6, 2013 · 16 revisions

The examples directory contains files that essentially amount to tutorials on how to use the GalSim code.

To learn how to use GalSim in python, you should read through the files demo*.py. Each file in the series adds some new features, and each new feature is generally well documented, so you can both see an example of how it is used in practice and usually also get some additional explanation for what the code does.

To learn how to use GalSim using config files (probably the easier path for those who don't know python, but useful even for pythonistas), you should read through the files demo*.yaml. Each yaml configuration file does the same thing as the corresponding .py script. So once you understand the .yaml file, you can see how the same thing can be done in python by looking at the corresponding .py file (or vice versa).

The executable that will parse the yaml file is bin/galsim. Doing scons install will install this executable in /usr/local/bin or $PREFIX/bin (if you specify a different PREFIX). So you should just be able to type galsim demo1.yaml in the examples directory to use this file (assuming $PREFIX/bin is in your path).

If you don't have PyYAML installed on your system, you can use the JSON config format instead. The examples/json directory has demo*.json files that do the same thing as the corresponding .yaml files. The executable to parse these is the same. It automatically determines the format according to the file extension.