%%bash 

cd ~

git clone https://github.com/desihub/imaginglss
cd imaginglss

/anaconda/bin/pip install --user -e .
    

"""
Explanation: ImagingLSS on NERSC Jupyter Portal
This example will guide you setup imaginglss at NERSC with Jupyter.
https://jupyter.nersc.gov
This guide will not work on Cori or Edison. 
Refer to the documentation for using imaginglss in a Batch environment.
First time install
This will checkout the imaginglss source code to ~/imaginglss
If you'd like to put the code some other places, change the path.
End of explanation
"""


%%bash 

cd ~/imaginglss

git stash
git pull 


"""
Explanation: Update
This will abandon all of your local changes!
End of explanation
"""


%%bash

cd ~/imaginglss
/anaconda/bin/pip uninstall imaginglss
/anaconda/bin/pip install --user -e .


import imaginglss
print imaginglss

decals = imaginglss.DECALS('/global/project/projectdirs/m779/imaginglss/dr2.conf.py')

"""
Explanation: Head start for Developers
For developers, it is preferable to do updates with git pull 
from a true terminal window, or follow other standard git practice of
merging in upstream changes. (e.g. git fetch)
The main development of imaginglss is done this way:

One terminal window connected to NERSC
One notebook connected to http://jupyter.nersc.gov
Write up some ideas in the notebook
git checkout -b mybigidea
implement it from the terminal window
Reload the notebook kernel and test the implementation
If it works, git add, git commit, git push, and file a Pull Request.
If it does not work, go to 'implement' step.
Wait till the feature is merged, 
git checkout master; git branch -d mybigidea.

Reinstall
Usually not needed, but if things go severely wrong, try this.
End of explanation
"""


