ScatterSim:Installing

From GISAXS
Jump to: navigation, search

Installing ScatterSim

Here are some rough guidelines into installing ScatterSim.

  1. Download and install Anaconda
    https://www.continuum.io/downloads
  2. Download the ScatterSim Library, either:
    1. Direct download
      1. Download from https://github.com/CFN-softbio/SciAnalysis/archive/master.zip
        and install to the directory of your choice.
    2. Using git
      1. Download and install git:
        https://git-scm.com/downloads
      2. Download the ScatterSim library using git
        1. Open a terminal and choose a directory where you want to install ScatterSim, for example:
          cd ~/
          mkdir -p software
          cd software
          
        2. clone:
          git clone https://github.com/CFN-softbio/ScatterSim.git
          

          (For more information, you may also visit the github page)

  3. Now install ScatterSim
    cd ScatterSim
    python setup.py develop
    

    It should now be installed.



You should be able to now run ScatterSim in a python environment.

Testing ScatterSim

To test that ScatterSim was properly installed, let's make a folder where we can add code and test.

  1. Create a folder where you'll want to store your notebooks, for example, in a terminal, type:
    cd ~/software
    mkdir -p ScatterSim-examples
    cd ScatterSim-examples
    
  2. In this folder, in the terminal, type:
    jupyter notebook
    

    This will open your web browser to run jupyter notebooks.

  3. Click "New" and select one of the entries under "Notebook". Likely it will say something like "Python 3" or something similar. You should only have one entry (unless you've manually created extra notebook kernels, or installed jupyter on its own).
  4. To test that ScatterSim is installed, type in a cell:
    from ScatterSim.NanoObjects import SphereNanoObject
    

    and hit SHIFT + ENTER. If you do not receive an error, then it is installed. If you do receive an error, then try to use another kernel (the entries under notebook mentioned in the previous step).

Troubleshooting If this was not successful, then here are some things you may try:

  • you have two instances of jupyter installed and you are not running the correct one. Try to find them and uninstall everything. The command (linux/mac)
    which jupyter
    can help hint where the jupyter version you're using is installed.
  • Another possibilty is that you are not in the right conda environment. Simply closing your terminal and opening it again could help. Else, you may need to find out the name of your conda environments by typing in a terminal:
    conda env list
    

    and finally selecting the correct environment by typing:

    source activate ENV
    

    where ENV is one of the names in the list you saw. (it should be one entry unless you've purposely added more environments)


Updating ScatterSim

If you installed using git, you can also update ScatterSim using git. When an update is pushed to the server, it may be retrieved as follows:

  1. Go into ScatterSim directory. Ex:
    cd ~/software/ScatterSim
    
  2. Then run the following two commands:
    git checkout master
    git pull origin master
    

NOTE : If you made any changes to ScatterSim, git will complain (this could happen by accidentally opening a file and adding in a whitespace for example). To resolve this, you delete all changes you may have made by typing:

git reset --hard

If you wanted to keep your changes, then one option is to create a new branch for them, such as: may either need to add the changes:

git checkout -b development-branch-name
git add <files...>
git commit -m "MY Commit message for these edits"

Now your changes are saved and may always be accessed by running:

git checkout development-branch-name

This is likely unnecessary, unless you are digging into the code.