ModelZapper is a supplementary app to GLASS which can inspect, analyze, and filter GLASS “states”. Free-form gravitational lens modelling techniques which are used in GLASS, generally try to deal with the mass-sheet degeneracy (an intrinsic problem in gravitational lens modelling) by exploring the solution space in a Monte-Carlo sampling approach. Every lens model is therefore built out of many different models that solve the lens equation with the given priors. Such an ensemble model usually looks fine on average, but not all models in the ensemble might be valid or realistic solutions to the observed lens. This is where ModelZapper comes in. With this app, one can manually go through the GLASS ensemble and select realistic models, filter out the unrealistic solutions, and save the filtered ensemble in a new GLASS state.
Binaries can be directly downloaded here (currently only for macOS).
Generally, modelzapper.py
should be runnable without installation.
Just make sure to properly add the pre-installed glass paths to the PYTHONPATH
(for an example see: setenv) before running
python modelzapper.py
To properly install modelzapper.py
(in order to build the app yourself
or to run the app within a virtual python environment), first run
configure
in the root directory of the repo.
./configure
This will set up a virtual python environment and download all required
libraries.
After the environment and required libraries are downloaded, use install
./install
This will compile the glass
source code into src
, and move the build
into libs
and includes
directories.
If glass
was compiled without errors, modelzapper.py
should be able to
run (without setting any PYTHONPATH
or PATH
) as
python modelzapper.py [gls.state]
Once you configured and installed modelzapper.py
, building the app is
easy! Enter the virtual environment and run py2app
with
source activate
python setup.py py2app
or alternatively use
./rebuild
After the command(s) finish, you should find two new directories in your repo,
dist
and build
. In dist
you’ll find your standalone macOS app that is
ready to be double-clicked.
To build the app yourself, you need a Python framework with an integrated
Tkinter library (or linked to Tcl/Tk frameworks).
The app relies on several python modules which are installable
via e.g. pip
.
Since the app interfaces with glass
, a runnable version of glass
is
essential.
To summarize (also see requirements.txt):
- Python framework (==2.7)
- Tkinter (built-in or linked to Tcl and Tk frameworks (>= 8.6))
- glass
- virtualenv
- numpy
- scipy
- matplotlib
- PIL
Since it is not really easy to install glass
, let alone automatically,
chances are you might have problems running the app.
If so, try building it yourself. In order to be able to build the app though,
python
must be installed as a framework.
It is also recommended to install a newer Tcl/Tk framework than the one that
comes with the macOS system.
For more details see https://github.com/phdenzel/local-python-install
(try installing the frameworks in standard locations though,
e.g. /Library/Frameworks/
).