From 5f4db0a3abd626f8aa51e6df844dd25bfbb902c9 Mon Sep 17 00:00:00 2001 From: Pey Lian Lim Date: Fri, 30 Dec 2016 13:12:45 -0500 Subject: [PATCH] Better Windows support. Make instructions clearer. Added missing packages. More verbose check_env. Other minor edits. --- .gitignore | 1 + Installation_and_Setup.md | 66 +++++++++++++++++++++++++++++++++------ README.md | 29 ++++++++++------- Schedule.md | 2 +- check_env.py | 24 ++++++++------ environment.yml | 4 +++ environment_win.yml | 1 + pip_requirements_win.txt | 5 +++ 8 files changed, 100 insertions(+), 32 deletions(-) create mode 100644 pip_requirements_win.txt diff --git a/.gitignore b/.gitignore index 72364f9..9287819 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ lib64/ parts/ sdist/ var/ +src/ *.egg-info/ .installed.cfg *.egg diff --git a/Installation_and_Setup.md b/Installation_and_Setup.md index f57594c..7e73932 100644 --- a/Installation_and_Setup.md +++ b/Installation_and_Setup.md @@ -1,37 +1,83 @@ -This will be an interactive workshop so be sure to come with a laptop prepared to try out some of the tools that will be discussed and demoed. +This will be an interactive workshop so be sure to come with a laptop prepared to try out some of the tools that will be discussed and demonstrated. + +If you have any problem with the instructions here, please open an issue at https://github.com/spacetelescope/aas229_workshop/issues/ + +# 1. Clone This Repository First, download this repository by either doing: - git clone http://github.com/spacetelescope/aas229_workshop.git + % git clone http://github.com/spacetelescope/aas229_workshop.git or by downloading and then expanding the repository file. Then, cd into the aas229_workshop directory. +# 2. Install Anaconda, AstroConda + +Note: please do this ahead of the workshop if possible. + +## 2a. No Anaconda + +### Mac, Linux + If you don't already have Anaconda installed, install the the Anaconda distribution for Python 3.5, which we have packaged along with some additional software. Downloads for Mac and Linux can be found at: http://ssb.stsci.edu/conda/installers/AstroConda-1.0.2-Linux-x86_64.sh http://ssb.stsci.edu/conda/installers/AstroConda-1.0.2-MacOSX-x86_64.sh -Note: please do this ahead of the workshop if possible. +These shell installers include both Anaconda and the AstroConda software repository, which contains additional tools that will be shown at the workshop. + +If you have trouble installing using the above files, you will need to download Anaconda separately (https://www.continuum.io/downloads). Then, proceed to Step 2b. + +More information about AstroConda can be found at http://astroconda.readthedocs.io/en/latest/ (currently does not support Windows build). + +### Windows + +You will need to download Anaconda separately (https://www.continuum.io/downloads). Then, proceed to Step 2b. + +## 2b. Already Has Anaconda -These shell installers include both Anaconda and the AstroConda software repository, which contains additional tools that will be shown at the workshop. If you have trouble installing using the above files (or are using Windows), you will need to download anaconda separately (https://www.continuum.io/downloads), and then install Astroconda on top following the instructions here: http://astroconda.readthedocs.io/en/latest/. +If you have Anaconda already installed, have not used the shell installer in Step 2a, and have not already installed the Astroconda software package, then follow this step. If you've already used the installer in Step 2a, you should already have all the software you need on your machine and you can skip this step. -If you have Anaconda already installed, and have not used the shell installer above, and have not already installed the Astroconda software package, you can create a special environment for this workshop which contains all the software you will need using the environment file below. If you've already used the installer above you should already have all the software you need on your machine: +Note: You need to be inside the aas229_workshop directory for this to work. + +The command below will create an environment called "aas229-workshop", but you can change that to any other desirable name by replacing the quoted name. + +### Mac, Linux + +You can create a special environment for this workshop which contains all the software you will need using the environment file below: % conda env create -n aas229-workshop --file environment.yml % source activate aas229-workshop -Note: you need to be inside the aas229_workshop directory for this to work. - -The command above will create an environment called "aas229-workshop", but you can change that to any other desirable name by replacing the quoted name. +### Windows -Note for windows users: you can use the environment_win.yml file instead, this will not include the ginga or imexam packages: +You can create a special environment for this workshop which contains most of the software you will need using the environment file below: % conda env create -n aas229-workshop --file environment_win.yml - % source activate aas229-workshop + % activate aas229-workshop + +Then, you can install the rest of the packages using: + + % pip install -r pip_requirements_win.txt +Note: Windows distribution currently does not yet support imexam. + +# 3. Check Installation + +Note: You need to be inside the aas229_workshop directory for this to work. You can run the check_env.py script to perform a basic check of your Python environment and some of the required dependencies: % python check_env.py + +# 4. Pick Up Changes + +To pick up any updates for workshop materials, make sure you are in the aas229_workshop directory and then use the following commands: + + % git fetch origin master + % git rebase origin/master + +The commands above only work if you used git in Step 1. The rebase command will not work properly if you have modified the materials (e.g., running the notebooks). In that case or if you downloaded the materials manually, you will have to update the changed files manually as well; e.g., by downloading the updated file (the RAW format) via GitHub web interface. + +Software covered in this workshop should not need any more updates after Steps 2 and 3. However, in the event of any necessary quick fix, instructions will be given out during the workshop (e.g., using conda or pip commands). diff --git a/README.md b/README.md index ecb3081..3de083d 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,44 @@ Using Python for Astronomical Data Analysis in the Era of JWST ================================================================ + The Space Telescope Science Institute and core developers from the Astropy community are sponsoring a workshop at the January 2017 meeting of the [American Astronomical Society](http://aas.org/) #AAS229 in Grapevine, Texas. -Check out the [Schedule!](Schedule.md) +Check out the [Schedule](Schedule.md)! -View the [installation and setup instructions!](Installation_and_Setup.md) +View the [installation and setup instructions](Installation_and_Setup.md)! -This workshop will cover the use of Python tools for astronomical data analysis and visualization in the era of JWST, with the focus primarily on UV, Optical and IR data. Data analysis tools for JWST are being written in Python and distributed as part of Astropy, a community developed Python library for astronomy, and its affiliated packages, many of which are designed to be compatible with JWST, HST and other major mission data. +This workshop will cover the use of Python tools for astronomical data analysis and visualization in the era of JWST, with the focus primarily on UV, Optical, and IR data. Data analysis tools for JWST are being written in Python and distributed as part of Astropy, a community developed Python library for astronomy, and its affiliated packages, many of which are designed to be compatible with JWST, HST, and other major mission data. -Our goals will be to introduce you to the variety of tools which are already available inside the Astropy library as well as provide ample hands-on time during which you’ll be able to explore the science analysis capabilities which the greater python environment and community provide. +Our goals will be to introduce you to the variety of tools which are already available inside the Astropy library as well as provide ample hands-on time during which you’ll be able to explore the science analysis capabilities which the greater Python environment and community provide. -We plan on accomplishing this with focused talks on the main tools followed by more extended instructor guided tutorials where you’ll be able to try them out for yourself and ask questions in the company of expert users and developers. Instructions on installing the necessary software will be provided before and during the workshop, however those attending should make every effort to install the software ahead of time. Some basic Python experience is highly recommended to be able to effectively participate in the exercises, but those without Python experience will still get much useful information about the capabilities for data analysis in Python and perhaps pick up some pointers on where they can get started learning more scientific Python and integrating it into their work flow. +We plan on accomplishing this with focused talks on the main tools followed by more extended instructor guided tutorials where you’ll be able to try them out for yourself and ask questions in the company of expert users and developers. Instructions on installing the necessary software will be provided before and during the workshop, however those attending should make every effort to install the software ahead of time. Some basic Python experience is highly recommended to be able to effectively participate in the exercises, but those without Python experience will still get much useful information about the capabilities for data analysis in Python and perhaps pick up some pointers on where they can get started learning more scientific Python and integrating it into their work flow. If you would like to get a head start with the tools we will be concentrating on you can check out their documentation on readthedocs: * [Physical Units and Quantities](http://docs.astropy.org/en/stable/units/index.html) -* [Basics on accessing data files, both FITS and ascii tables](http://docs.astropy.org/en/stable/io/unified.html) +* [Constants](http://docs.astropy.org/en/stable/constants/index.html) * [Coordinate utilities](http://docs.astropy.org/en/stable/coordinates/index.html) +* [Basics on accessing data files, both FITS and ASCII tables](http://docs.astropy.org/en/stable/io/unified.html) * [Modeling and Fitting](http://docs.astropy.org/en/stable/modeling/index.html) +* [Astropy WCS](http://docs.astropy.org/en/stable/wcs/index.html) +* [Generalized WCS](http://gwcs.readthedocs.io/en/stable/) * Interactive visualization and analysis tools: - * [Glue](http://glueviz.org/) - * [imexam](http://imexam.readthedocs.io/) - * [Ginga](http://ginga.readthedocs.io) - * spectroscopy tools such as [specviz](https://github.com/spacetelescope/specviz) * Photometric tools, such as [photutils](http://photutils.readthedocs.io/) + * [imexam](http://imexam.readthedocs.io/) + * [Ginga](http://ginga.readthedocs.io/) and [stginga](http://stginga.readthedocs.io/) + * [Glue](http://glueviz.org/) + * Spectroscopy tools, such as [SpecViz](http://specviz.readthedocs.io/en/latest/) + -For those of you just starting out in using python for astronomy, or looking for more information consider checking out the resources listed below and begin exploring the possibilities! +For those of you just starting out in using Python for astronomy, or looking for more information consider checking out the resources listed below and begin exploring the possibilities! The Astropy website, go here for a good overview and documentation about the project: http://www.astropy.org/ Ready to get into the action? Check out some of these tutorials: http://www.astropy.org/astropy-tutorials/ -Python For Astronomers, where the emphasis is on using Python to solve real-world problems that astronomers are likely to encounter in research. https://python4astronomers.github.io/ +Python For Astronomers, where the emphasis is on using Python to solve real-world problems that astronomers are likely to encounter in research: https://python4astronomers.github.io/ If you have issues getting set up, you can also run the notebooks on mybinder.org: [![Binder](http://mybinder.org/badge.svg)](http://mybinder.org:/repo/spacetelescope/aas229_workshop) diff --git a/Schedule.md b/Schedule.md index 8c22ef3..13145ef 100644 --- a/Schedule.md +++ b/Schedule.md @@ -18,7 +18,7 @@ Workshop Schedule |2:30 - 3:00 | Generalized World Coordinate System (GWCS) | Nadia Dencheva | |**3:00 - 3:15** | **BREAK** | Refreshments | |3:15 - 3:45 | Photutils | Megan Sosey| -|3:45 - 5:00 | imexam, Ginga, SpecViz, Glue | Megan Sosey & Pey Lian Lim | +|3:45 - 5:00 | imexam, Ginga, Glue, SpecViz | Megan Sosey & Pey Lian Lim | Wrap up! Questions and Comments from participants diff --git a/check_env.py b/check_env.py index 9f7e784..4f6e2e4 100644 --- a/check_env.py +++ b/check_env.py @@ -2,14 +2,17 @@ """ Check for required dependencies for the workshop. Usage:: + % python check_env.py + """ +from __future__ import print_function import sys from distutils.version import LooseVersion -def check_package(package_name, minimum_version=None): +def check_package(package_name, minimum_version=None, verbose=True): errors = False try: pkg = __import__(package_name) @@ -17,17 +20,19 @@ def check_package(package_name, minimum_version=None): print('Error: Failed import: {0}'.format(err)) errors = True else: - if minimum_version is not None: - if package_name == 'xlwt': - installed_version = pkg.__VERSION__ - else: - installed_version = pkg.__version__ - if (LooseVersion(installed_version) < + if package_name == 'xlwt': + installed_version = pkg.__VERSION__ + else: + installed_version = pkg.__version__ + if (minimum_version is not None and + LooseVersion(installed_version) < LooseVersion(str(minimum_version))): print('Error: {0} version {1} or later is required, you ' 'have version {2}'.format(package_name, minimum_version, installed_version)) errors = True + if not errors and verbose: + print('Found', package_name, installed_version) return errors pkgs = {'IPython': '5.1', @@ -43,12 +48,13 @@ def check_package(package_name, minimum_version=None): 'imexam': '0.6.2', 'astroquery': '0.3', 'ginga': '2.6.1', - 'gwcs': '0.7' + 'stginga':'0.1.3', + 'gwcs': '0.7', + 'specviz':'0.2' } if sys.platform.startswith('win'): pkgs.pop('imexam') - pkgs.pop('ginga') errors = [] for package_name, min_version in pkgs.items(): diff --git a/environment.yml b/environment.yml index 7129a6a..85c9262 100644 --- a/environment.yml +++ b/environment.yml @@ -7,6 +7,7 @@ dependencies: - python=3.5 - numpy>=1.7 - scipy>=0.15 + - cython - matplotlib>=1.3 - astropy>=1.2.1 - photutils>=0.3 @@ -16,6 +17,9 @@ dependencies: - glue-vispy-viewers>=0.6 - glueviz>=0.9.1 - ginga>=2.6.1 + - stginga + - specutils + - specviz - jupyter - notebook - ipython diff --git a/environment_win.yml b/environment_win.yml index 27c7f57..1643643 100644 --- a/environment_win.yml +++ b/environment_win.yml @@ -8,6 +8,7 @@ dependencies: - python=3.5 - numpy>=1.7 - scipy>=0.15 + - cython - matplotlib>=1.3 - astropy>=1.2.1 - photutils>=0.3 diff --git a/pip_requirements_win.txt b/pip_requirements_win.txt new file mode 100644 index 0000000..3bf37d9 --- /dev/null +++ b/pip_requirements_win.txt @@ -0,0 +1,5 @@ +-e git+https://github.com/astropy/specutils.git@v0.2.2#egg=specutils +-e git+https://github.com/ejeschke/ginga.git@v2.6.1#egg=ginga +-e git+https://github.com/spacetelescope/gwcs.git@0.7#egg=gwcs +-e git+https://github.com/spacetelescope/specviz.git@master#egg=specviz +-e git+https://github.com/spacetelescope/stginga.git@0.1.3#egg=stginga