Ejemplo n.º 1
0
# IPython log file


from astroML import datasets
X = datasets.fetch_great_wall()
A = datasets.fetch_moving_objects()
X.shape
plt.scatter(*X.T)
plt.scatter(*X.T, s=1, c='k')
plt.scatter(X[:, 1], X[:, 0], s=1, c='k')
X.shape
fig, ax = plt.subplots()
ax.set_facecolor('black')
fig, ax = plt.subplots(1, 2, figsize=(10, 5), facecolor='black')
for a in ax:
    a.set_facecolor('black')
    for spine in ax.spines.values():
        spine.set_color('w')
    for tick in ax.xaxis.get_major_ticks() + ax.yaxis.get_major_ticks():
        for child in tick.get_children():
            child.set_color('w')
for a in ax.ravel():
    a.set_facecolor('black')
    for spine in ax.spines.values():
        spine.set_color('w')
    for tick in ax.xaxis.get_major_ticks() + ax.yaxis.get_major_ticks():
        for child in tick.get_children():
            child.set_color('w')
for a in ax.ravel():
    a.set_facecolor('black')
    for spine in a.spines.values():
Ejemplo n.º 2
0
SDSS Moving Object Data
-----------------------
This example shows how to fetch the moving object (i.e. asteroid) data from
Stripe 82 and to plot some measures of the orbital dynamics.
"""
# Author: Jake VanderPlas <*****@*****.**>
# License: BSD
#   The figure produced by this code is published in the textbook
#   "Statistics, Data Mining, and Machine Learning in Astronomy" (2013)
#   For more information, see http://astroML.github.com
from matplotlib import pyplot as plt
from astroML.datasets import fetch_moving_objects

#------------------------------------------------------------
# Fetch the moving object data
data = fetch_moving_objects(Parker2008_cuts=True)

# Use only the first 10000 points
data = data[:10000]

a = data['aprime']
sini = data['sin_iprime']

#------------------------------------------------------------
# Plot the results
ax = plt.axes()
ax.plot(a, sini, '.', markersize=2, color='black')

ax.set_xlim(2.0, 3.6)
ax.set_ylim(-0.01, 0.31)
Ejemplo n.º 3
0
    # enhance green beyond the a_crit cutoff
    i = np.where(mag_a < a_crit)
    G[i] += 10000 * (10 ** (-0.01 * (mag_a[i] - a_crit)) - 1)

    # normalize color of each point to its maximum component
    RGB = np.vstack([R, G, B])
    RGB /= RGB.max(0)

    # return an array of RGB colors, which is shape (n_points, 3)
    return RGB.T


#------------------------------------------------------------
# Fetch data and extract the desired quantities
data = fetch_moving_objects(Parker2008_cuts=True)
mag_a = data['mag_a']
mag_i = data['mag_i']
mag_z = data['mag_z']
a = data['aprime']
sini = data['sin_iprime']

# dither: magnitudes are recorded only to +/- 0.01
mag_a += -0.005 + 0.01 * np.random.random(size=mag_a.shape)
mag_i += -0.005 + 0.01 * np.random.random(size=mag_i.shape)
mag_z += -0.005 + 0.01 * np.random.random(size=mag_z.shape)

# compute RGB color based on magnitudes
color = compute_color(mag_a, mag_i, mag_z)

#------------------------------------------------------------