Installation Notes
===================

Assume anaconda python >3.7 installation on Linux/Mac

0. Add channels:
   conda config --append channels http://ssb.stsci.edu/astroconda
   conda config --append channels conda-forge
   Check .condarc

1. pysiaf - https://github.com/spacetelescope/pysiaf
   Download source directly from github. Navigate to directory, 
   then use pip's -e option to create an editable installation:
      "pip install -e ."
   Branch to use: master`
   
2. poppy - https://github.com/spacetelescope/poppy
   Download source directly from github. Navigate to directory, 
   then use pip's -e option to create an editable installation:
      "pip install -e ."
   Branch to use: develop

3. webbpsf - https://github.com/spacetelescope/webbpsf
   Download source directly from github. Navigate to directory, 
   then use pip's -e option to create an editable installation:
      "pip install -e ."
   Note: This also install photutils via pip if not already installed
   Branch to use: develop

3a. webbpsf-data files - https://stsci.box.com/shared/static/34o0keicz2iujyilg4uz617va46ks6u9.gz
   Download WebbPSF data files into "webbpsf-data" directory.
   Set the environment variable $WEBBPSF_PATH to point to that directory.
   For example, in .bashrc shell file, add:  
      export WEBBPSF_PATH='$HOME/data/webbpsf-data/'
   
4. jwst-backgrounds - https://github.com/spacetelescope/jwst_backgrounds
   Install healpy: conda install healpy
      If healpy asks to downgrade any dependencies, cancel and install the 
      missing dependencies manually, then try again  --no-deps flag:
         conda install healpy --no_deps
   Install jwst_backgrounds: pip install -e .

5. jwst pipeline
   Install the following git repositories in order with "pip install -e ."
      https://github.com/spacetelescope/stcal        
      https://github.com/spacetelescope/stdatamodels 
      https://github.com/spacetelescope/crds         
      https://github.com/spacetelescope/stpipe       
      https://github.com/spacetelescope/jwst    # adds a few other dependencies

5a. Configure calibration reference database (CRDS)
   Define CRDS directory to download and save cal files.
   For example, in .bashrc shell file:
      export CRDS_PATH='$HOME/data/crds_cache/'
      export CRDS_SERVER_URL='https://jwst-crds.stsci.edu'

6. pysynphot - https://pysynphot.readthedocs.io/
   conda install pysynphot (v2.0)
   Download and untar http://mips.as.arizona.edu/~jleisenring/pynrc/cdbs.tar.gz
   Set the environment variable $PYSYN_CDBS to point to that directory.
   For example, in .bashrc shell file, add: 
      export PYSYN_CDBS='$HOME/data/cdbs/'
   
7. webbpsf_ext - https://github.com/JarronL/webbpsf_ext
   Download repository and use "pip install -e ."
   Set the environment variable $WEBBPSF_EXT_PATH to point to some data directory.
   All PSF coefficients will be saved here as they are generated to be reused later.
   For example, in .bashrc shell file, add: 
      export WEBBPSF_EXT_PATH='$HOME/data/webbpsf_ext_data/'
   
8. pynrc - https://github.com/JarronL/pynrc/tree/develop
   Download repository and use "pip install -e ."

8a. pynrc data files - http://mips.as.arizona.edu/~jleisenring/pynrc/
   If you're planning on generating DMS simulations, download the full set of
   data files, including detector cal information and untar (17GB):
      http://mips.as.arizona.edu/~jleisenring/pynrc/pynrc_data_all.tar
   Individual detector cal info can be found here (1.7GB/detector):
      http://mips.as.arizona.edu/~jleisenring/pynrc/pynrc_data_tarballs/
   If only utilizing pynrc's ETC and quick PSF creation capabilities, you only need:
      http://mips.as.arizona.edu/~jleisenring/pynrc/pynrc_data_tarballs/sim_params.tar

   Set the environment variable $PYNRC_DATA to point to that directory.
   For example, in .bashrc shell file, add: 
      export PYNRC_DATA='$HOME/data/pynrc_data/'
   

In the end, you should have a number of new environment variables:
   export CRDS_PATH='$HOME/data/crds_cache/'
   export CRDS_SERVER_URL='https://jwst-crds.stsci.edu'
   export PYSYN_CDBS='$HOME/data/cdbs/'
   export WEBBPSF_PATH='$HOME/data/webbpsf-data/'
   export WEBBPSF_EXT_PATH='$HOME/data/webbpsf_ext_data/'
   export PYNRC_DATA='$HOME/data/pynrc_data/'
   
Other requirements:
   astropy >=4.2
   astroquery >=0.4.3


Other useful programs:
1. hxrg_ref_pixels - https://github.com/JarronL/hxrg_ref_pixels
   Reference pixel correction of HxRG detectors.
