def period_disk_class_histograms():
    """ 
    What do the period distributions of disked vs nondisked stars look like?

    """

    # UKvar sTrict Periodics
    uk_tp = ukvar_spread.where((ukvar_spread.strict == 1) & 
                               (ukvar_spread.periodic == 1))

    # Disk criterion
    excess = 1.714*uk_tp.hmk_median - uk_tp.jmh_median 

    p_sample = uk_tp.where(excess <= 0)
    d_sample = uk_tp.where((excess > 0) & (excess <= 0.614))
    e_sample = uk_tp.where(excess > 0.614)

    print len(p_sample), len(d_sample), len(e_sample)

    fig = plt.figure()
    s1 = fig.add_subplot(3,1,1)
    s2 = fig.add_subplot(3,1,2)
    s3 = fig.add_subplot(3,1,3)

    s1.hist(p_sample.Period, bins=50, range=(0,20))
    s1.text(12,10, "Photosphere sample, n=%d" % len(p_sample))
    s1.set_title("Histograms of periods for photosphere, disk, extreme samples")
    s2.hist(d_sample.Period, bins=50, range=(0,20),color='r')
    s2.text(12,10, "Disk sample, n=%d" % len(d_sample))
    s3.hist(e_sample.Period, bins=50, range=(0,20),color='k')
    s3.text(12,0.8, "Extreme sample, n=%d" % len(e_sample))
    s3.set_xlabel("Period (days)")

    plt.show()

    fig2 = plt.figure()

    plot_trajectory_vanilla(plt.gca())
    
    plt.plot(p_sample.hmk_median, p_sample.jmh_median, 'bo')
    plt.plot(d_sample.hmk_median, d_sample.jmh_median, 'ro')
    plt.plot(e_sample.hmk_median, e_sample.jmh_median, 'ko')

    plt.xlabel(r"median $H-K$")
    plt.ylabel(r"median $J-H$")
    plt.title("Color-color diagram of periodic stars")

    plt.xlim(-0.1,2.5)
    plt.ylim(-0.2, 2.8)

    plt.show()

    return
Пример #2
0
def f_cc_generic(spread, title="", cmap='cubehelix_r'):
    """
    Given an input dataset, makes a color-color plot with cool 
    colors and stuff.

    Parameters
    ----------
    spread : atpy.Table
        A spreadsheet with information on stars whose median 
        J-H and H-K colors want to be plotted.
    title : str
        Desired title for the plot, if any.

    Returns
    -------
    fig : Figure object
        Figure that we plotted onto.
    
    """
    fig = plt.figure()
    ax = plt.gca()

    plot_trajectory_vanilla(ax)

    # First group: only group! Because of how the data quality works.
    plt.scatter(spread.hmk_median, spread.jmh_median, c=spread.k_median,
                vmin=11, vmax=15, cmap=cmap)

    plt.xlabel(r"median $H-K$")
    plt.ylabel(r"median $J-H$")

    plt.xlim(-0.1,2.5)
    plt.ylim(-0.2, 2.8)
    
    cbar = plt.colorbar()
    cbar.ax.invert_yaxis()
    cbar.set_label(r"Median $K$ magnitude")
    
    if title:
        plt.title(title)

    plt.show()

    return fig
Пример #3
0
def f_cc_cmd_and_map_by_megeath_class(sample='all', title=True):
    """
    A color-color diagram where stars are colored by Megeath class.

    Also a CMD and a map.
    
    """

    megeath_class_column = make_megeath_class_column()

    # Nonperiodic stars only
    if 'non' in sample.lower():
        sample_boolean_criterion = np.isnan(ukvar_periods)
        sample_name = "Non-periodic"
    elif 'per' in sample.lower():
        sample_boolean_criterion = ~np.isnan(ukvar_periods)
        sample_name = "Periodic"
    elif 'strict' in sample.lower():
        sample_boolean_criterion = (ukvar_spread.strict == 1)
        sample_name = "Q=2"
    else:
        sample_boolean_criterion = (np.zeros_like(ukvar_periods) == 0) #all true
        sample_name = "All"

    # Now we want the rows in ukvar_spread that correspond to certain
    # Megeath subsamples.

    disk_indices = (
        # its Class is 'D'
        (megeath_class_column == 'D') &
        # and it matches our 'periodic/nonperiodic/all' cut.
         sample_boolean_criterion)

    protostar_indices = (
        (megeath_class_column == 'P') & sample_boolean_criterion)

    nondisk_indices = (
        (megeath_class_column == 'ND') & sample_boolean_criterion)

    unknown_indices = (
        (megeath_class_column == 'na') & sample_boolean_criterion)
    
        
    fig = plt.figure()
    ax = plt.gca()

    plot_trajectory_vanilla(ax, a_k=3)

    plt.plot(ukvar_spread.hmk_median[nondisk_indices],
             ukvar_spread.jmh_median[nondisk_indices],
             'o', color=color_dict['nondisk'], ms=4, label="Non-disks")
    plt.plot(ukvar_spread.hmk_median[disk_indices],
             ukvar_spread.jmh_median[disk_indices],
             'o', color=color_dict['disk'], ms=4, label="Disks")
    plt.plot(ukvar_spread.hmk_median[protostar_indices],
             ukvar_spread.jmh_median[protostar_indices],
             '*', color=color_dict['protostar'], ms=10, label="Protostars")

    plt.xlabel(r"median $H-K$")
    plt.ylabel(r"median $J-H$")

    plt.xlim(-0.1,3.1)
    plt.ylim(-0.2, 4.4)

    if title:
        plt.title(sample_name + " variables, colored by Megeath+2012 class")

    plt.legend(loc='lower right')


    fig3 = plt.figure()
    ax3 = plt.gca()

    plot_trajectory_vanilla(ax, a_k=3)

    plt.plot(ukvar_spread.hmk_median[nondisk_indices],
             ukvar_spread.k_median[nondisk_indices],
             'o', color=color_dict['nondisk'], ms=4, label="Non-disks")
    plt.plot(ukvar_spread.hmk_median[disk_indices],
             ukvar_spread.k_median[disk_indices],
             'o', color=color_dict['disk'], ms=4, label="Disks")
    plt.plot(ukvar_spread.hmk_median[protostar_indices],
             ukvar_spread.k_median[protostar_indices],
             '*', color=color_dict['protostar'], ms=10, label="Protostars")

    plt.xlabel(r"median $H-K$")
    plt.ylabel(r"median $K$ mag")

    plt.xlim(-0.1,3.1)
    plt.ylim(17, 8)
    
    plt.title(sample_name + " variables, colored by Megeath 2012 class")

    plt.legend(loc='upper right')


    fig2 = plt.figure()

    plt.plot(np.degrees(ukvar_spread.RA)[nondisk_indices], 
             np.degrees(ukvar_spread.DEC)[nondisk_indices], 
             'o', color=color_dict['nondisk'], ms=4, label="Non-disks")
    plt.plot(np.degrees(ukvar_spread.RA)[disk_indices], 
             np.degrees(ukvar_spread.DEC)[disk_indices], 
             'o', color=color_dict['disk'], ms=4, label="Disks")
    plt.plot(np.degrees(ukvar_spread.RA)[protostar_indices], 
             np.degrees(ukvar_spread.DEC)[protostar_indices], 
             '*', color=color_dict['protostar'], ms=10, label="Protostars")

    plt.legend()
    plt.gca().invert_xaxis()

    plt.show()

    return (fig, fig2, fig3)