diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..22d01ae --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "astropy_helpers"] + path = astropy_helpers + url = git://github.com/astropy/astropy-helpers diff --git a/.rtd-environment.yml b/.rtd-environment.yml index d8a7761..4d971c0 100644 --- a/.rtd-environment.yml +++ b/.rtd-environment.yml @@ -1,16 +1,21 @@ name: stips channels: - - astropy + - conda-forge + - astropy + - http://ssb.stsci.edu/astroconda + - defaults dependencies: - - python>=3.7 - - astropy - - Cython - - matplotlib - - numpy >= 1.13 - - sphinx-astropy - - astropy-helpers + - python>=3.7 + - astropy - - pip: - - stsci_rtd_theme + # Docs + - sphinx + - docutils + - stsci_rtd_theme + + - pip: + # Docs + - astropy_helpers + - sphinx_astropy \ No newline at end of file diff --git a/README.md b/README.md index f3dd927..508ef73 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,11 @@ # STScI-STIPS +For documentation and installation instructions please visit https://stsci-stips.readthedocs.io + ## Table of Contents * [Overview](#overview) * [Why use STIPS?](#why-use-stips) -* [STIPS Python Requirements](#stips-python-requirements) -* [STIPS Examples](#stips-examples) -* [STIPS and Python 3](#stips-python-3-status) ## Overview @@ -30,158 +29,9 @@ If extremely good instrumental accuracy is needed, STIPS is not the ideal choice various instrument design teams have produced much more detailed simulators. STIPS is intended to run reasonably quickly, and to make scene generation and observation as easy as possible. -## STIPS Python Requirements - -STIPS currently runs under python 2.7 (and has been developed with versions 2.7.3 through 2.7.12). -Eventually, STIPS will be made compatible with python 3. - -STIPS requires the following STScI-supported python packages be installed and running correctly -(along with any data files that the packages themselves require, as can be found in their -documentation): - -* Pandeia (tested with versions 1.0 and 1.1.1) -* Webbpsf (tested with versions between 0.4.0 and 0.6.0) - -STIPS also uses the following (more general) python packages: - -* astropy (version 1.3.2): STIPS uses astropy in order to - * read and write FITS files - * read and write ASCII tables (specifically in the IPAC format) - * generate Sersic profile models (if any are in the generated scene) -* esutil (version 0.6.0): Used for retrieving data from sqlite databases in the form of numpy arrays -* montage_wrapper (version 0.9.8): STIPS uses montage to generate mosaics. It is only imported if - STIPS is asked to generate a multi-detector image. -* numpy (version 1.12.1): STIPS uses numpy extensively for almost everything that it does -* photutils (version 0.3.2): STIPS uses photutils to determine the flux inside the half-light radius - in generated Sersic profiles -* pysynphot (version 0.9.8.5): STIPS uses pysynphot to generate bandpasses, count rates, and - zero points. Note that pysynphot's data files (also known as the CDBS data tree) must also be - installed and available as indicated in pysynphot's documentation. -* scipy (version 0.18.1): STIPS uses scipy to manipulate its internal images (zoom and rotate) - -Finally, STIPS requires a set of data files whose location is marked by setting the environment -variable `stips_data`. Currently these files are available as part of the STSCI-STIPS-UI github -project, but they should eventually be made available as a (versioned) direct download. - -## STIPS Examples - -**NOTE:** If you do not have environment variables pointing to the location of your Pandeia data, -STIPS data, and Webbpsf data, you must set these environment variables using `os.environ` or other -equivalent method prior to running any of these example scripts. - -* Creating a scene with a single stellar population and a single galaxy population, then observing - it with NIRCam Short F115W: - - from stips.scene_module import SceneModule - from stips.observation_module import ObservationModule - - scm = SceneModule() - - stellar = {'n_stars': 50000, - 'age_low': 1.0e12, 'age_high': 1.0e12, - 'z_low': -2.0, 'z_high': -2.0, - 'imf': 'salpeter', 'alpha': -2.35, - 'binary_fraction': 0.1, - 'distribution': 'invpow', 'clustered': True, - 'radius': 100.0, 'radius_units': 'pc', - 'distance_low': 20.0, 'distance_high': 20.0, - 'offset_ra': 0.0, 'offset_dec': 0.0} - stellar_cat_file = scm.CreatePopulation(stellar) - - galaxy = {'n_gals': 1000, - 'z_low': 0.0, 'z_high': 1.0, - 'rad_low': 0.01, 'rad_high': 2.0, - 'sb_v_low': 30.0, 'sb_v_high': 25.0, - 'distribution': 'uniform', 'clustered': False, - 'radius': 200.0, 'radius_units': 'arcsec', - 'offset_ra': 0.0, 'offset_dec': 0.0} - galaxy_cat_file = scm.CreateGalaxies(galaxy) - - obs = {'instrument': 'NIRCamShort', - 'filters': ['F115W'], - 'detectors': 1, - 'distortion': False, - 'oversample': 5, - 'pupil_mask': '', - 'background': 'avg', - 'observations_id': 1, - 'exptime': 1000, - 'offsets': [{'offset_id': 1, 'offset_centre': False, 'offset_ra': 0.0, 'offset_dec': 0.0, 'offset_pa': 0.0}]} - obm = ObservationModule(obs) - obm.nextObservation() - output_stellar_catalogues = obm.addCatalogue(stellar_cat_file) - output_galaxy_catalogues = obm.addCatalogue(galaxy_cat_file) - psf_file = obm.addError() - fits_file, mosaic_file, params = obm.finalize(mosaic=False) - - In this case, the output FITS file will be in the variable `fits_file`, and the output catalogues - (showing the actual count rate and position of the sources observed) will be in the variables - `output_stellar_catalogues` and `output_galaxy_catalogues`. -* Creating a scene from an existing source catalogue `input_sources.txt`, and observing it with the - WFIRST WFI "F129" filter, offset by 0.5 degrees in RA, and rotated by 27 degrees: - - from stips.observation_module import ObservationModule - - obs = {'instrument': 'WFI', - 'filters': ['F129'], - 'detectors': 1, - 'distortion': False, - 'oversample': 5, - 'pupil_mask': '', - 'background': 'avg', - 'observations_id': 1, - 'exptime': 1000, - 'offsets': [{'offset_id': 1, 'offset_centre': False, 'offset_ra': 0.5, 'offset_dec': 0.0, 'offset_pa': 27.0}]} - scene_general = {'ra': 256.274799731, 'dec': 22.6899695529, 'pa': 0.0, 'seed': 1} - obm = ObservationModule(obs, scene_general=scene_general) - obm.nextObservation() - source_count_catalogues = obm.addCatalogue('input_sources.txt') - psf_file = obm.addError() - fits_file, mosaic_file, params = obm.finalize(mosaic=False) - - In this case, the output catalogue(s) will show the actual applied count rates. Whether there is - only one output catalogue or two depends on the input catalogue format. - -## STIPS Python 3 Status - -STIPS was originally designed with and for python 2, but work has recently begun on converting it to -python 3. Currently, STIPS is known to be importable from python 3, and the STIPS observation -module has been used with an internal-format catalogue. Any issues encountered when using STIPS with -python 3 should be reported on -[STIPS Github Issue 16](https://github.com/spacetelescope/STScI-STIPS/issues/16). - -To install, in bash: - -Once you have a version of "conda" on your machine, Obtain a copy of cdbs and pandeia _data-1.0 (need link to these), and note their paths: - -export PYSYN_CDBS="[path to cdbs]" - -export pandeia_refdata="[path to pandeia_data-1.0]" - -conda create -n forSTIPS python=2.7.12 astropy=1.3.2 numpy=1.12.1 scipy=0.18.1 photutils=0.3.2 pysynphot=0.9.8.5 webbpsf=0.6 - -source activate forSTIPS - -echo $WEBBPSF_PATH #if this is defined, then the environment should be correct - -pip install "esutil==0.6.0" - -pip install "montage-wrapper==0.9.9" - -pip install "jwst_backgrounds==1.1.1" - -pip install "pandeia.engine==1.0" - -#to install in /local/tmp/Work Substitute directory as needed - -cd /local/tmp/Work - -git clone https://github.com/spacetelescope/STScI-STIPS-UI.git - -export stips_data="/local/tmp/Work/STScI-STIPS-UI/sim_input/stips_data" +Developed by Brian York ([@york-stsci](https://github.com/york-stsci)) and +Robel Geda ([@robelgeda](https://github.com/robelgeda)). -git clone https://github.com/spacetelescope/STScI-STIPS.git -cd STScI-STIPS +![Alt text](docs/wfirst_figures/stips_demo.png?raw=true "WFIRST Image of a Star Cluster and Background Galaxies") -python setup.py install \ No newline at end of file diff --git a/ah_bootstrap.py b/ah_bootstrap.py index 512a05a..42961c0 100644 --- a/ah_bootstrap.py +++ b/ah_bootstrap.py @@ -79,6 +79,13 @@ # Start off by parsing the setup.cfg file +_err_help_msg = """ +If the problem persists consider installing astropy_helpers manually using pip +(`pip install astropy_helpers`) or by manually downloading the source archive, +extracting it, and installing by running `python setup.py install` from the +root of the extracted source code. +""" + SETUP_CFG = ConfigParser() if os.path.exists('setup.cfg'): @@ -156,6 +163,8 @@ sys.stderr.write("ERROR: setuptools 30.3 or later is required by astropy-helpers\n") sys.exit(1) +SETUPTOOLS_LT_42 = LooseVersion(setuptools.__version__) < LooseVersion('42') + # typing as a dependency for 1.6.1+ Sphinx causes issues when imported after # initializing submodule with ah_boostrap.py # See discussion and references in @@ -526,7 +535,9 @@ def get_option_dict(self, command_name): opts['find_links'] = ('setup script', find_links) if index_url is not None: opts['index_url'] = ('setup script', index_url) - if allow_hosts is not None: + # For setuptools>=42, the allow_hosts option can't + # be used because pip doesn't support it. + if allow_hosts is not None and SETUPTOOLS_LT_42: opts['allow_hosts'] = ('setup script', allow_hosts) return opts @@ -921,14 +932,6 @@ def _silence(): sys.stderr = old_stderr -_err_help_msg = """ -If the problem persists consider installing astropy_helpers manually using pip -(`pip install astropy_helpers`) or by manually downloading the source archive, -extracting it, and installing by running `python setup.py install` from the -root of the extracted source code. -""" - - class _AHBootstrapSystemExit(SystemExit): def __init__(self, *args): if not args: @@ -1007,4 +1010,4 @@ def use_astropy_helpers(**kwargs): # Create a new bootstrapper with the updated configuration and run it BOOTSTRAPPER = _Bootstrapper(**config) - BOOTSTRAPPER.run() + BOOTSTRAPPER.run() \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py index 42ef3dd..33dfa2c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -50,6 +50,7 @@ def setup(app): from ConfigParser import ConfigParser except ImportError: from configparser import ConfigParser + conf = ConfigParser() conf.read([os.path.join(os.path.dirname(__file__), '..', 'setup.cfg')]) @@ -59,11 +60,8 @@ def setup(app): # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. sys.path.insert(0, os.path.abspath('../')) -sys.path.insert(0, os.path.abspath('../webbpsf/')) -sys.path.insert(0, os.path.abspath('exts/')) extensions = [ - 'numfig', 'sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', @@ -72,6 +70,7 @@ def setup(app): 'sphinx.ext.autosummary', 'sphinx_automodapi.automodapi', ] + numpydoc_show_class_members = False # -- General configuration ---------------------------------------------------- @@ -99,22 +98,18 @@ def setup(app): # -- Project information ------------------------------------------------------ # This does not *have* to match the package name, but typically does -project = setup_cfg['package_name'] +project = setup_cfg['name'] author = setup_cfg['author'] -copyright = '{0}, {1}'.format( - datetime.datetime.now().year, setup_cfg['author']) +copyright = '{0}, {1}'.format(datetime.datetime.now().year, setup_cfg['author']) # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. -__import__(setup_cfg['package_name']) -package = sys.modules[setup_cfg['package_name']] - # The short X.Y version. -version = package.__version__.split('-', 1)[0] +version = setup_cfg['version'].split('-', 1)[0] # The full version, including alpha/beta/rc tags. -release = package.__version__ +release = setup_cfg['version'] # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' @@ -178,7 +173,7 @@ def setup(app): if eval(setup_cfg.get('edit_on_github')): extensions += ['astropy_helpers.sphinx.ext.edit_on_github'] - versionmod = __import__(setup_cfg['package_name'] + '.version') + versionmod = __import__(setup_cfg['name'] + '.version') edit_on_github_project = setup_cfg['github_project'] if versionmod.version.release: edit_on_github_branch = "v" + versionmod.version.version diff --git a/docs/examples.rst b/docs/examples.rst index ccfd237..703f150 100644 --- a/docs/examples.rst +++ b/docs/examples.rst @@ -1,20 +1,90 @@ STIPS Examples =============== .. note:: + If you do not have environment variables pointing to the location of your Pandeia data, STIPS data, and Webbpsf data, you must set these environment variables using `os.environ` or other equivalent method prior to running any of these example scripts. + +* Creating a scene from an existing source catalogue `input_sources.txt`, and observing it with the + WFIRST WFI "F129" filter, offset by 0.5 degrees in RA, and rotated by 27 degrees: + +.. code-block:: python + + from stips.scene_module import SceneModule + from stips.observation_module import ObservationModule + + + scm = SceneModule() + + stellar = { + 'n_stars': 50000, + 'age_low': 1.0e12, 'age_high': 1.0e12, + 'z_low': -2.0, 'z_high': -2.0, + 'imf': 'salpeter', 'alpha': -2.35, + 'binary_fraction': 0.1, + 'distribution': 'invpow', 'clustered': True, + 'radius': 100.0, 'radius_units': 'pc', + 'distance_low': 20.0, 'distance_high': 20.0, + 'offset_ra': 0.0, 'offset_dec': 0.0 + + } + + stellar_cat_file = scm.CreatePopulation(stellar) + + galaxy = { + 'n_gals': 1000, + 'z_low': 0.0, 'z_high': 0.2, + 'rad_low': 0.01, 'rad_high': 2.0, + 'sb_v_low': 30.0, 'sb_v_high': 25.0, + 'distribution': 'uniform', 'clustered': False, + 'radius': 200.0, 'radius_units': 'arcsec', + 'offset_ra': 0.0, 'offset_dec': 0.0 + } + + galaxy_cat_file = scm.CreateGalaxies(galaxy) + + + obs = { + 'instrument': 'WFI', + 'filters': ['F129'], + 'detectors': 1, + 'distortion': False, + 'oversample': 5, + 'pupil_mask': '', + 'background': 'avg', + 'observations_id': 1, + 'exptime': 1000, + 'offsets': [{'offset_id': 1, 'offset_centre': False, 'offset_ra': 0.5, 'offset_dec': 0.0, 'offset_pa': 27.0}] + } + + obm = ObservationModule(obs) + obm.nextObservation() + + output_stellar_catalogues = obm.addCatalogue(stellar_cat_file) + output_galaxy_catalogues = obm.addCatalogue(galaxy_cat_file) + + psf_file = obm.addError() + + fits_file, mosaic_file, params = obm.finalize(mosaic=False) + +In this case, the output catalogue(s) will show the actual applied count rates. Whether there is +only one output catalogue or two depends on the input catalogue format. + + * Creating a scene with a single stellar population and a single galaxy population, then observing it with NIRCam Short F115W: -.. code-block:: language +.. code-block:: python + from stips.scene_module import SceneModule from stips.observation_module import ObservationModule scm = SceneModule() - stellar = {'n_stars': 50000, + stellar = { + 'n_stars': 50000, 'age_low': 1.0e12, 'age_high': 1.0e12, 'z_low': -2.0, 'z_high': -2.0, 'imf': 'salpeter', 'alpha': -2.35, @@ -22,28 +92,36 @@ STIPS Examples 'distribution': 'invpow', 'clustered': True, 'radius': 100.0, 'radius_units': 'pc', 'distance_low': 20.0, 'distance_high': 20.0, - 'offset_ra': 0.0, 'offset_dec': 0.0} + 'offset_ra': 0.0, 'offset_dec': 0.0 + } + stellar_cat_file = scm.CreatePopulation(stellar) - galaxy = {'n_gals': 1000, + galaxy = { + 'n_gals': 1000, 'z_low': 0.0, 'z_high': 1.0, 'rad_low': 0.01, 'rad_high': 2.0, 'sb_v_low': 30.0, 'sb_v_high': 25.0, 'distribution': 'uniform', 'clustered': False, 'radius': 200.0, 'radius_units': 'arcsec', - 'offset_ra': 0.0, 'offset_dec': 0.0} + 'offset_ra': 0.0, 'offset_dec': 0.0 + } + galaxy_cat_file = scm.CreateGalaxies(galaxy) - obs = {'instrument': 'NIRCamShort', - 'filters': ['F115W'], - 'detectors': 1, - 'distortion': False, - 'oversample': 5, - 'pupil_mask': '', - 'background': 'avg', - 'observations_id': 1, - 'exptime': 1000, - 'offsets': [{'offset_id': 1, 'offset_centre': False, 'offset_ra': 0.0, 'offset_dec': 0.0, 'offset_pa': 0.0}]} + obs = { + 'instrument': 'NIRCamShort', + 'filters': ['F115W'], + 'detectors': 1, + 'distortion': False, + 'oversample': 5, + 'pupil_mask': '', + 'background': 'avg', + 'observations_id': 1, + 'exptime': 1000, + 'offsets': [{'offset_id': 1, 'offset_centre': False, 'offset_ra': 0.0, 'offset_dec': 0.0, 'offset_pa': 0.0}] + } + obm = ObservationModule(obs) obm.nextObservation() output_stellar_catalogues = obm.addCatalogue(stellar_cat_file) @@ -56,28 +134,3 @@ In this case, the output FITS file will be in the variable `fits_file`, and the (showing the actual count rate and position of the sources observed) will be in the variables `output_stellar_catalogues` and `output_galaxy_catalogues`. -* Creating a scene from an existing source catalogue `input_sources.txt`, and observing it with the - WFIRST WFI "J129" filter, offset by 0.5 degrees in RA, and rotated by 27 degrees: - -.. code-block:: language - from stips.observation_module import ObservationModule - - obs = {'instrument': 'WFI', - 'filters': ['J129'], - 'detectors': 1, - 'distortion': False, - 'oversample': 5, - 'pupil_mask': '', - 'background': 'avg', - 'observations_id': 1, - 'exptime': 1000, - 'offsets': [{'offset_id': 1, 'offset_centre': False, 'offset_ra': 0.5, 'offset_dec': 0.0, 'offset_pa': 27.0}]} - scene_general = {'ra': 256.274799731, 'dec': 22.6899695529, 'pa': 0.0, 'seed': 1} - obm = ObservationModule(obs, scene_general=scene_general) - obm.nextObservation() - source_count_catalogues = obm.addCatalogue('input_sources.txt') - psf_file = obm.addError() - fits_file, mosaic_file, params = obm.finalize(mosaic=False) - -In this case, the output catalogue(s) will show the actual applied count rates. Whether there is -only one output catalogue or two depends on the input catalogue format. diff --git a/docs/index.rst b/docs/index.rst index 31d026a..a15b333 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -23,10 +23,22 @@ If extremely good instrumental accuracy is needed, STIPS is not the ideal choice various instrument design teams have produced much more detailed simulators. STIPS is intended to run reasonably quickly, and to make scene generation and observation as easy as possible. +Developed by Brian York (`@york-stsci `_) and +Robel Geda (`@robelgeda `_). + + +.. warning:: + + STIPS JWST is no longer being actively developed except by inheriting updates to pandeia, webbpsf, and jbt + (i.e. STIPS will get new throughput information, any changes to the simulated PSFs, and any changes to the + simulated backgrounds). We do not test the JWST and HST portions of STIPS. + +.. figure:: wfirst_figures/stips_demo.png + + Fig. 1: Simulated WFI image of a star cluster and background galaxies. .. toctree:: :maxdepth: 2 - stips/index.rst - stips/requirements.rst - stips/examples.rst + installation + examples diff --git a/docs/installation.rst b/docs/installation.rst new file mode 100644 index 0000000..d1da01e --- /dev/null +++ b/docs/installation.rst @@ -0,0 +1,175 @@ +************ +Installation +************ + +STIPS is a simulation tool that depends on other modules such as PSF and exposure time calculators. +These underlying submodules need to be installed for STIPS to function properly along with their supporting datasets. +There are multiple options for installation and they are listed in this section along with instructions. + +STIPS Requirements +################## + +* `Pandeia`: Exposure time calculator. +* `WebbPSF`: James Webb and WFIRST PSF calculator. +* `astropy`: STIPS uses astropy in order to: + + - Read and write FITS files. + - Read and write ASCII tables (specifically in the IPAC format). + - Generate Sersic profile models (if any are in the generated scene). + +* `esutil`: Used for retrieving data from sqlite databases in the form of numpy arrays. +* `montage_wrapper`: STIPS uses montage to generate mosaics. It is only imported if + STIPS is asked to generate a multi-detector image. +* `numpy`: STIPS uses numpy extensively for almost everything that it does. +* `photutils`: STIPS uses photutils to determine the flux inside the half-light radius + in generated Sersic profiles. +* `pysynphot`: STIPS uses pysynphot to generate bandpasses, count rates, and + zero points. Note that pysynphot's data files (also known as the CDBS data tree) must also be + installed and available as indicated in pysynphot's documentation. +* `scipy`: STIPS uses scipy to manipulate its internal images (zoom and rotate). + +Finally, STIPS requires a set of data files whose location is marked by setting the environment +variable `stips_data`. The current best form of stips_data is actually kept (and versioned) inside +the STIPS project itself. + +Installing Using Conda and Source +################################## + +STIPS can be installed using the source code and a Conda environment file. +If you do not have anaconda or miniconda installed, please visit the `astroconda docs `_ for installation instructions. +We have included a Conda environment file for easily installing or updating Conda packages to meet STIPS requirements. +Please follow the steps below to install STIPS: + +Installing +********** + +1. You will need to clone the STIPS source code from the `spacetelescope/STScI-STIPS `_ repository.`cd` into the directory you would like to store the source code and run:: + + git clone https://github.com/spacetelescope/STScI-STIPS.git + + cd STScI-STIPS + +2. The environment file can be used in two ways: + + a. To create a new Conda environment named `stips` run:: + + conda env create -f environment.yml + + conda activate stips + + + b. To install to or update an existing (currently active) Conda environment:: + + conda env update --file environment.yml + + +3. You can now install STIPS using the cloned source code as follows:: + + python setup.py install + + +Downloading Required Data +************************* + +Pandeia and WebbPSF need the reference datasets. +You will need to download the data and add them to your environmental path + +1. Check if wget is installed by running:: + + wget + + # If it is not installed (usually on Mac OS), + # it can be downloaded using Conda + + conda install wget + +2. `cd` into a directory you would like to store the data in and run the following commands:: + + # PySynphot reference data + wget -qO- http://ssb.stsci.edu/cdbs/tarfiles/synphot1.tar.gz | tar xvz + wget -qO- http://ssb.stsci.edu/cdbs/tarfiles/synphot2.tar.gz | tar xvz + wget -qO- http://ssb.stsci.edu/cdbs/tarfiles/synphot5.tar.gz | tar xvz + + + # Pandeia reference data + wget -qO- https://stsci.box.com/shared/static/5j506xzg9tem2l7ymaqzwqtxne7ts3sr.gz | tar -xvz + + # WebbPSF reference data + wget -qO- https://stsci.box.com/shared/static/qcptcokkbx7fgi3c00w2732yezkxzb99.gz | tar xvz + +3. Add the data paths to your bash environmental path. It is recommended that you add the path to your `.bashrc` file:: + + export WEBBPSF_PATH=//webbpsf-data + export PYSYN_CDBS=//grp/hst/cdbs + export pandeia_refdata=//pandeia_data-x.x_wfirst + +Make sure that you have the correct version number for `pandeia_refdata` (replace the "x.x"). + +.. note:: + The URL we provide in this section and the suggested pandeia reference data directory name + are specifically for using STIPS with WFIRST. If you would like to use STIPS with JWST, + you need to download the regular pandeia reference data (and if you want to be able to use both, + you download both and either copy the 'wfirst' directory into the regular reference data, or the + 'jwst' directory into the WFIRST reference data). + +Testing Installation +********************* + +To test if all the required files have been installed, please import STIPS in python:: + + bash-3.2$ python + Python 3.7.3 | packaged by conda-forge | (default, Dec 6 2019, 08:36:57) + [Clang 9.0.0 (tags/RELEASE_900/final)] :: Anaconda, Inc. on darwin + Type "help", "copyright", "credits" or "license" for more information. + + >>> import stips + +The following warning message can be ignored if it appears:: + + WARNING: stips_data environment variable not found. Falling back on local STIPS data. + + +Installing Using Docker +####################### + +Installing +********** + +1. Start by installing the free `Docker Community Edition `_ locally. +This will make the `docker` command available in your terminal. Note that after installing docker, +you must open the application once for docker to be available from the command line. + +2. You will need to clone the STIPS source code from the `spacetelescope/STScI-STIPS `_ repository. +`cd` into the directory you would like to store the source code and run:: + + git clone https://github.com/spacetelescope/STScI-STIPS.git + + cd STScI-STIPS + +3. Run the docker build command:: + + docker build -t stips . + + + +Testing Installation +********************* + +To test if the Docker image was built correctly you can `exec` into the image and try to import STIPS:: + + # cd into STScI-STIPS + $ docker build -t stips . + + # Create Docker Image + $ docker create -t -i stips bash + + 8293abe302b0c4f07a04282e811824d74681b77d0174148cc8af68078c098fa6 + + # Start Docker Image + $ docker start -a -i 8293abe302b0 + + (stips) root@8293abe302b0:~# python + Python 3.7.3 | packaged by conda-forge | (default, Jul 1 2019, 21:52:21) + [GCC 7.3.0] :: Anaconda, Inc. on linux + Type "help", "copyright", "credits" or "license" for more information. + >>> import stips diff --git a/docs/requirements.rst b/docs/requirements.rst deleted file mode 100644 index 4370d23..0000000 --- a/docs/requirements.rst +++ /dev/null @@ -1,77 +0,0 @@ -STIPS Python Requirements -========================= -STIPS currently runs under python 2.7 (and has been developed with versions 2.7.3 through 2.7.12). -Eventually, STIPS will be made compatible with python 3. - -STIPS requires the following STScI-supported python packages be installed and running correctly -(along with any data files that the packages themselves require, as can be found in their -documentation): - -* Pandeia (tested with versions 1.0 and 1.1.1) -* Webbpsf (tested with versions between 0.4.0 and 0.6.0) - -STIPS also uses the following (more general) python packages: - -* astropy (version 1.3.2): STIPS uses astropy in order to - * read and write FITS files - * read and write ASCII tables (specifically in the IPAC format) - * generate Sersic profile models (if any are in the generated scene) -* esutil (version 0.6.0): Used for retrieving data from sqlite databases in the form of numpy arrays -* montage_wrapper (version 0.9.8): STIPS uses montage to generate mosaics. It is only imported if - STIPS is asked to generate a multi-detector image. -* numpy (version 1.12.1): STIPS uses numpy extensively for almost everything that it does -* photutils (version 0.3.2): STIPS uses photutils to determine the flux inside the half-light radius - in generated Sersic profiles -* pysynphot (version 0.9.8.5): STIPS uses pysynphot to generate bandpasses, count rates, and - zero points. Note that pysynphot's data files (also known as the CDBS data tree) must also be - installed and available as indicated in pysynphot's documentation. -* scipy (version 0.18.1): STIPS uses scipy to manipulate its internal images (zoom and rotate) - -Finally, STIPS requires a set of data files whose location is marked by setting the environment -variable `stips_data`. Currently these files are available as part of the STSCI-STIPS-UI github -project, but they should eventually be made available as a (versioned) direct download. - - -STIPS Python 3 Status ---------------------- -STIPS was originally designed with and for python 2, but work has recently begun on converting it to -python 3. Currently, STIPS is known to be importable from python 3, and the STIPS observation -module has been used with an internal-format catalogue. Any issues encountered when using STIPS with -python 3 should be reported on -[STIPS Github Issue 16](https://github.com/spacetelescope/STScI-STIPS/issues/16). - -To install, in bash: - -Once you have a version of "conda" on your machine, Obtain a copy of cdbs and pandeia _data-1.0 (need link to these), and note their paths: - -export PYSYN_CDBS="[path to cdbs]" - -export pandeia_refdata="[path to pandeia_data-1.0]" - -conda create -n forSTIPS python=2.7.12 astropy=1.3.2 numpy=1.12.1 scipy=0.18.1 photutils=0.3.2 pysynphot=0.9.8.5 webbpsf=0.6 - -source activate forSTIPS - -echo $WEBBPSF_PATH #if this is defined, then the environment should be correct - -pip install "esutil==0.6.0" - -pip install "montage-wrapper==0.9.9" - -pip install "jwst_backgrounds==1.1.1" - -pip install "pandeia.engine==1.0" - -#to install in /local/tmp/Work Substitute directory as needed - -cd /local/tmp/Work - -git clone https://github.com/spacetelescope/STScI-STIPS-UI.git - -export stips_data="/local/tmp/Work/STScI-STIPS-UI/sim_input/stips_data" - -git clone https://github.com/spacetelescope/STScI-STIPS.git - -cd STScI-STIPS - -python setup.py install \ No newline at end of file diff --git a/docs/wfirst_figures/stips_demo.png b/docs/wfirst_figures/stips_demo.png new file mode 100644 index 0000000..4a7a777 Binary files /dev/null and b/docs/wfirst_figures/stips_demo.png differ diff --git a/environment.yml b/environment.yml index 59b521e..d8188e4 100644 --- a/environment.yml +++ b/environment.yml @@ -38,7 +38,7 @@ dependencies: - esutil # Major modules - - webbpsf==0.9.0 + - webbpsf>=0.9.0 # Minor modules - pyyaml @@ -57,10 +57,11 @@ dependencies: - jwst_backgrounds # Major modules - - pandeia.engine==1.5 + - pandeia.engine>=1.5 # Minor modules - montage-wrapper # Docs + - astropy_helpers - sphinx_astropy