Giter Club home page Giter Club logo

science_magic's Introduction

science_magic

IPython magic for importing science

It's like %pylab but with less littering of your namespace.

Install

git clone [email protected]:ucsc-astro/science_magic.git
cd science_magic
pip install .

with the last line prepended by sudo for most python installations.

Usage

You can make the new line magic commands automatically load as an IPython extension by adding the following to your ipython_config.py (usually located at $HOME/.ipython/profile_default):

c.InteractiveShellApp.extensions = ['science_magic']

Otherwise, you can load the extension manually with the magic command %load_ext science_magic.

%science does the following imports

import numpy as np
import pandas as pd
from astropy.coordinates import SkyCoord
from astropy.table import Table
from astropy.io import fits
from astropy import units as u
from astropy import constants as c
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns

In addition, it sets up a default plotting enviroment with the following matplotlib.rcParams settings:

savefig.bbox = tight
figure.figsize = (9, 6)
text.usetex = True
image.origin = lower
image.interpolation = none

and the following seaborn settings:

context = poster
style = ticks
font_scale = 1.0
color_codes = True
palette = deep

%astro will just do the astropy imports, and %plotting will just do the matplotlib and seaborn imports.

You can pass a dictionary of rcParams settings as the line argument of either %plotting or %science (e.g., %science {'errorbar.capsize': 2} to update the default plotting settings.

Customizing

Want to use this structure to set your own imports? Don't like my default plotting settings? Just edit the relevant files under the science_magic/science_magic directory. E.g., to add an import for astropy.time.Time, just add from astropy.time import Time to science_magic/science_magic/astro_imports.py.

science_magic's People

Contributors

adwasser avatar egentry avatar

Watchers

 avatar  avatar

Forkers

egentry

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.