Computing

Tips, tricks, and scripts

Some of my favorite packages:

pyds9 and iPython startup

Display numpy arrays in DS9. My favorite short-cut is to define a .view method for DS9, which I find easier to type for interactive work than .set_np2arr. I have an iPython profile named scipy. After initializing with ipython --profile=scipy, create the file .ipython/profile_scipy/startup/99-user.py (location for GNU/Linux systems) with the following content:

from importlib import reload

import scipy.ndimage as nd

import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.pyplot import *

try:
    from astropy.io import fits, ascii
    from astropy.table import Table
    import astropy.units as u
    import astropy.constants as const
    from astropy.coordinates import Angle
    from astropy.time import Time
except ImportError:
    pass

try:
    from sbpy.data import *
    from sbpy.activity import *
except ImportError:
    pass

try:
    import pyds9
    pyds9.DS9.view = pyds9.DS9.set_np2arr
except ImportError:
    pass

try:
    import mskpy
    from mskpy import *
except ImportError:
    pass

Copyright © Michael S. P. Kelley 2024