Coder Social home page Coder Social logo

guobuchi / astro-dataviz Goto Github PK

View Code? Open in Web Editor NEW

This project forked from megbedell/astro-dataviz

0.0 0.0 0.0 1.15 MB

demos of interactive data viz packages with astronomical data

License: MIT License

Jupyter Notebook 92.88% Python 7.12%

astro-dataviz's Introduction

This repository contains some IPython worksheets designed to demonstrate the relative capabilities of a few interactive plotting modules in python. These worksheets were made by Megan Bedell.

Slides for a companion talk can be found here.

Contents

The animated_cepheids.ipynb notebook shows how to make animated gifs or movies with matplotlib. As an example, we make a (somewhat cartoony) illustration of how Cepheid variable stars change in brightness over time using Gaia DR1 measurements.

The interactive_exoplanets.ipynb notebook demonstrates interactive plotting (tooltips, scroll and zoom, cross-linking plots, etc) with bokeh and altair. In this example, we use properties of confirmed exoplanets to make a mass-radius diagram.

The interactive_gaia.ipynb notebook scales this up to large datasets with vaex and holoviews is an unfinished look at using vaex and holoviews to view Gaia data. Although it's not extremely usable at the moment, it does contain links to other tutorials that may be helpful.

Required software

These notebooks run with Python 3 and Jupyter notebooks.

To run animated_cepheids.ipynb you'll just need a basic scientific stack (numpy, matplotlib, pandas) and astroquery. All of these are easy to install with pip.

To run interactive_exoplanets.ipynb you'll additionally need bokeh and altair, also available with pip:

pip install bokeh altair

If you're going to run from a notebook, you're good to go. If you want to run in Jupyter Labs you'll need an extension to make the bokeh plots render:

jupyter labextension install jupyterlab_bokeh

Note that altair is recommended for use with Jupyter Labs, but it still works in a notebook (with one extra line of setup code).

For interactive_gaia.ipynb, you'll need holoviews and vaex. The installation for these is more complex and has the potential to interfere with your normal python environment. One good way of installing is using Anaconda distribution and creating a virtual environment in which to install these packages. Here's a snippet of code to do this:

conda create -n dataviz_env python=3.6
source activate dataviz_env
pip install jupyterlab pandas astropy 
conda install -c conda-forge vaex
conda install -c conda-forge holoviews

(Some of the conda installs can be done in pip too, but I ran into install issues there that didn't come up with conda. Your mileage may vary.)

Then get the JupyterLab extension for holoviews:

jupyter labextension install @pyviz/jupyterlab_holoviews

Using these notebooks

Download this repository by running:

git clone https://github.com/megbedell/astro-dataviz

Then go into the astro-dataviz directory and start a Jupyter notebook server:

jupyter notebook

Click on a notebook file to run it.

astro-dataviz's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.