Python flavours of LIME¶
1. Flavour ‘pylime’¶
This flavour was developed to allow the user to write their model file in python. For this, we have to compile and run in separate steps.
Go to the package directory
<LIME base dir> and type
./configure # if you haven't already done so. make pylime
If this completes ok without errors, the next thing to do is to add some directories to your PYTHONPATH environment variable. A script to do this is provided for your convenience. If your shell is bash, do
Alternatively, if you use cshell, do
The compiled executable is called
pylime and will also be found in the
<LIME base dir> directory.
pylimerc script also adds
<LIME base dir> to your PATH environment variable - you don’t have to do this as an extra step.
To run pylime, do
pylime [options...] <model file>
Suppresses output messages.
This runs LIME in a test mode, in which it is compiled with the debugging flag set; fixed random seeds are also employed in this mode, so the results of any two runs with the same model should be identical.
Run in parallel mode with
nthreads. The default is a single thread, i.e. serial execution.
The number of threads may also be set with the par->nThreads parameter. This will override the value set via the -p option.
Curses-style output is not available for
The model file¶
This is written in python, but it follows a very similar format to the C-language file in original use with LIME. A template model file can be found at
<LIME base dir>/example/model.py.
Note that it is not necessary to recompile
pylime every time you make a change to the model file.
3. Flavour ‘casalime’¶
The final flavour of LIME offers similar functionality to
pyshared, but is designed to be used from the CASA command line. Originally the
pyshared modules were used for this, but due to stupid clashes in threading and cfitsio, it was decided to redesign the CASA interface so that it launched LIME in a new process.
cd <LIME base dir> make casalime
This generates an executable called
casalime. As with
pylime flavours, you will want to make sure that
<LIME base dir> is in your PATH environment variable, so CASA can find this executable. Also do
source ./pylimerc.csh # or the bash equivalent
There is a test script
<LIME base dir>/tests/casalime_test.py for checking that the tasks built ok.
The actual tasks which you run on the CASA command-line are called
raytrace. More on how to use those below. For the moment we just want to get them running.
You will find the following four files under
<LIME base dir>/casa:
limesolver.xml raytrace.xml task_limesolver.py task_raytrace.py
You can leave them there for the next step, but it is neater if you copy them somewhere else, to some convenient working directory. Suppose you have done that. CD to that working directory and invoke
buildmytasks from the CASA distro you plan to use. That should generate the following new files:
limesolver_cli.py limesolver.py mytasks.py raytrace_cli.py raytrace.py
The final step is to make sure that CASA can find these files when you start it up. If you don’t already have a file
~/.casa/init.py, create one. Add the following line to it:
execfile("<location of your task_* etc modules>/mytasks.py")
Once you’ve done that, you should be able to start CASA from anywhere and run the tasks
The CASA interface for setting task parameter values is not a very good tool for expressing the complicated and interrelated set of LIME parameters. Mostly for this reason, two simplifications have been made to flavour
casalime: the LIME functionality has been split between two tasks
raytrace, and only 1 image at a time can be produced.
This generates the grid and solves the radiative transfer equations. It’s not the job of
limesolver to make images.
CASA tasks store parameter values via INP files. A template INP file is available at
<LIME base dir>/casa/limesolver.template. If you copy this, together with the files
email@example.com jena_thin_e6.tab model_pyshared.py
<LIME base dir>/example to the directory you want to run CASA from, then you should be able from the CASA command line to do
for a nominal run of
limesolver. The output will be found in the same directory in the FITS file
grid_5_mymodel.ds. This conforms in format to the description in the header of the module
<LIME base dir>/src/grid2fits.c.
You will recognize most of the early parameters from LIME but those following
modelID all pertain to modellib.
This task reads the grid file created by
limesolver and makes a (single) image.
Once again there is a template INP file available:
<LIME base dir>/casa/raytrace.template. Perusal of this shows that the parameters are similar to the LIME ones, but two boolean parameters
doLine have been added.