Last active
September 10, 2017 01:28
-
-
Save taldcroft/547c0b6e0ae15e0c970d to your computer and use it in GitHub Desktop.
IPython startup magic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/.ipython/profile_default/startup/10-mystartup.py | |
import numpy as np | |
ip = get_ipython() | |
def import_astropy(self, arg): | |
ip.ex('import astropy') | |
ip.ex('print(astropy.__version__)') | |
ip.ex('from astropy.io import ascii') | |
ip.ex('from astropy import table') | |
ip.ex('from astropy.table import Table, QTable, Column, MaskedColumn') | |
ip.ex('from astropy.table.table_helpers import TimingTables, simple_table, complex_table') | |
ip.ex('from astropy.time import Time, TimeDelta') | |
ip.ex('from astropy.coordinates import SkyCoord, ICRS, FK4, FK5') | |
ip.ex('import astropy.units as u') | |
try: | |
import line_profiler | |
ip.define_magic('lprun', line_profiler.magic_lprun) | |
except ImportError: | |
pass | |
ip.define_magic('astro', import_astropy) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Very useful, thanks for sharing this !