Up and running with sims_maf_contrib

Update: The best method for getting sims_maf_contrib is to follow these instructions:

  1. Install sims and sims_maf following https://confluence.lsstcorp.org/display/SIM/MAF+Installation+and+Initial+Examples

  2. See the sims_maf_contrib README to install and use sims_maf_contrib.

The original instructions below are now out of date.


This is a short and unofficial tutorial on how to get sims_maf_contrib up and running on your machine. sims_maf_contrib will be an important package to many astronomers who want to run and contribute new metrics that guide the LSST observing strategy.

This tutorial will use the LSST’s Conda packages to minimize build time. Good references along the way are

Installing the lsst-distrib Conda Package

1. Install Anaconda or Miniconda

Miniconda is the easiest way to get a good Python 2.7 on your machine: http://conda.pydata.org/miniconda.html

Download an installation script and run it. For example:

bash ~/Downloads/Miniconda-latest-MacOSX-x86_64.sh

This installs miniconda into ~/miniconda2

2. Add the Conda channel with LSST software

conda config --add channels http://research.majuric.org/conda/stable

This is mentioned at https://confluence.lsstcorp.org/display/SIM/Catalogs+and+MAF

3. Install the Stack with lsst-distrib

conda install lsst-distrib

This will take a while. The stack itself will be installed in your $CONDA_ROOT/opt/lsst directory. You don’t need to cd into this directory at any time, though.

4. Setup the Eups environment

source eups-setups.sh
setup lsst_sims

You’ll need to do this every time you open a new shell.

5. Add a sims tag to Eups

Eups needs to know about the sims tag used by the simulations group.

mkdir -p ~/.eups
vim ~/.eups/startup.py

and add the line

hooks.config.Eups.globalTags += ['sims’]

to startup.py and save the file (:wq).

This is a one-time operation.


Getting sims_maf_contrib

Now we follow instructions for sims_maf_contrib itself at https://github.com/LSST-nonproject/sims_maf_contrib

6. Clone the sims_maf_contrib repo

Choose a directory to work in, and

git clone  https://github.com/LSST-nonproject/sims_maf_contrib.git
cd sims_maf_contrib

7. Declare the sims_maf_contrib package to Eups

eups declare sims_maf_contrib -t $USER -r .

Ignore the Eups warning about absolute paths.

8. Setup the sims_maf_contrib package.

setup sims_maf_contrib -t $USER -t sims

Do this every time you open a new shell for working on sims_maf_contrib.

Run sims_maf_contrib code and notebooks

Finally, you can run the ipython notebooks in the tutorials/ directory and contribute metrics.

cd tutorials
ipython notebook

and take a look at Index.ipynb

Thanks @jsick ! I will try working through this when I set up my new machine. In the meantime, @ljones tells me that the correct syntax for the command in your step 7 should be:

eups declare sims_maf_contrib -t $USER -r .

Thanks @drphilmarshall! I made the fix.

I think it turns out that you can do either, although perhaps including sims_maf_contrib is slightly more clear (you define the package name, the tag (with -t) and the directory (with -r). I had thought that was the cause of your problem, but that wasn’t the case.

However - is the right channel conda/stable or conda/dev? I think @danielsf the other day said it should be /dev for sims items (stable for DM) because we are post-v11 for sims and conda/stable is only at v11.
Note that we are starting to get many versions of instructions on installation (see https://github.com/LSST-nonproject/sims_maf_contrib/blob/master/tutorials/Index.ipynb, https://confluence.lsstcorp.org/display/SIM/Catalogs+and+MAF, and the README for sims_maf_contrib itself https://github.com/LSST-nonproject/sims_maf_contrib). (I would be quite happy for some of these to go away if we could find a consistent place that we can all agree on).

I’m not an expert on the Sim conda channels at all :slight_smile: This was actually a repost my reply to an email inquiry I received. I’ve made my post a wiki so you should be able to edit it freely (if I’ve got permissions right).

You’re right, the stable channel right now includes only the v11 (aka Summer 2015) releases (both of DM and sims code). I think @danielsf has been publishing more recent versions onto dev, though they may behave inconsistently in updates due to recent changes to how versions are computed. I think you should be safe, as long as you always do conda update conda update lsst-sims (as it’s never been tagged, I use a different algorithm to compute its version so it remained unaffected).

PS: I 100% agree it’d be good to have one, canonical, place with install instructions.

@jsick, @ljones – regarding getting sims_maf_contrib – the procedure described above seems too involved. Instead of steps 5, 6, 7 and 8, wouldn’t just:

git clone  https://github.com/LSST-nonproject/sims_maf_contrib.git
cd sims_maf_contrib
setup -r .

work?

Just doing setup -r . will certainly work, and really it just depends on how you want to use the package in the future. If you just want to cd to the directory and run ipython notebooks, that’s probably the simplest way. If you want to use the code from sims_maf_contrib/python (the new metrics and other classes contributed by the community), doing the full eups declare may be simpler because then in the future you don’t have to cd to the sims_maf_contrib directory (just the setup command).

OK, I see.

But trying to look at it through a newbie’s eyes, setup -r <sims_maf_dir> -t sims (though still magical), may seem less scary than editing startup.py and then running the declare and $USER incantations. I’m also not sure adding the sims global tag is necessary, unless you’re installing additional EUPS packages on top of the conda-installed packages.

We should find some time to talk about this – I think we could simplify these instructions a lot (I worry having to follow an 8-step program just to get started gives us a bit of a bad rep re usability…).

why do you have to edit startup.py? (is this conda related, that I haven’t noticed because I use a eups distrib installed stack?)

The other good news is that we don’t need the -t $USER thing anymore, as apparently eups should be fixed so that you could just do
eups declare -r . -c (in the sims_maf_contrib directory)
and then setup sims_maf_contrib -t sims afterwards (we do need the -t sims tag for non-conda versions, as sims is tagged but not declared current).

but yes, you could skip the declare and just tell people to follow the line you suggest – setup -t <sims_maf_contrib_dir> -t sims, probably simpler.

Sorry - just actually read the instructions above (did they change?)

The startup.py edit is to add the sims tag, for conda installs. For non-conda installs, the sims tag is already present.

I guess to make life really simple for each of these users, we need to have two completely separate use instructions?
For conda installs, skip the -t sims and skip the startup.py edits.
For non-conda installs, use the -t sims tag, no need to edit startup.py.

Hi, these instructions still have the http://research.majuric.org/conda/stable link, which I think is now superseded by http://conda.lsst.codes/

Cheers,

Fed

Good point. I’ll retire these instructions in favor of the README at https://github.com/LSST-nonproject/sims_maf_contrib.