Пример #1
0
def plot_chips(ax, fieldnum):
    """Plot the outline of the Kepler chips."""
    ra_deg, dec_deg, scRoll_deg = getRaDecRollFromFieldnum(fieldnum)
    ## convert from SC roll to FOV coordinates
    ## do not use the fovRoll coords anywhere else
    ## they are internal to this script only
    fovRoll_deg = fov.getFovAngleFromSpacecraftRoll(scRoll_deg)

    ## initialize class
    k = fov.KeplerFov(ra_deg, dec_deg, fovRoll_deg)

    raDec = k.getCoordsOfChannelCorners()

    light_grey = np.array([float(248) / float(255)] * 3)
    #ph = proj.Gnomic(ra_deg, dec_deg)
    ph = proj.PlateCaree()
    k.plotPointing(ph,
                   showOuts=False,
                   plot_degrees=False,
                   colour="k",
                   mod3="None",
                   lw=1.5)
Пример #2
0
def check_target(target,
                 first=0,
                 last=LAST_CAMPAIGN,
                 verbose=True,
                 create_plot=False,
                 print_speed=True):
    """
    Returns
    -------
    visible_campaigns : list of int
        List of campaign numbers in which the object is visible.
    """
    K2fov.logger.disabled = True  # Disable warnings about prelim fields
    ephem = get_ephemeris_dataframe(target, first, last)
    visible_campaigns = []
    for c in range(first, last + 1):
        visible = False
        fovobj = K2fov.getKeplerFov(c)
        campaign_ephem = ephem.loc[K2fov.getFieldInfo(c)["start"]:K2fov.
                                   getFieldInfo(c)["stop"]]
        if create_plot:
            import matplotlib.pyplot as pl
            from K2fov import projection
            ph = projection.PlateCaree()
            pl.figure()
            fovobj.plotPointing(ph, showOuts=False)
            pl.plot(campaign_ephem["ra"],
                    campaign_ephem["dec"],
                    color="black",
                    lw=3)
            #plot_padding = 5
            #pl.xlim([campaign_ephem["ra"].max() + plot_padding,
            #         campaign_ephem["ra"].min() - plot_padding])
            #pl.ylim([campaign_ephem["dec"].min() - plot_padding,
            #         campaign_ephem["dec"].max() + plot_padding])
            pl.xlabel('R.A. [degrees]')
            pl.ylabel('Declination [degrees]')
            pl.gca().invert_xaxis()
            pl.minorticks_on()
            pl.title("Visibility of {0} in K2 C{1}".format(target, c))
            plot_fn = "{}-c{}.png".format(target.replace("/", "_"), c)
            print("Writing {}".format(plot_fn))
            pl.savefig(plot_fn)
            pl.close()
        for idx, row in campaign_ephem.iterrows():
            if onSiliconCheck(row["ra"], row["dec"], fovobj):
                logging.debug("{} is visible in C{}.".format(target, c))
                logging.debug(campaign_ephem[["dra", "ddec"]])
                visible = True
                break
        if visible:
            visible_campaigns.append(c)
            if verbose:
                mag = campaign_ephem['mag']
                if mag.dtype == float:  # can also be the string "n/a"
                    min_mag, max_mag = mag.min(), mag.max()
                else:
                    min_mag, max_mag = -99.9, -99.9
                print("Object '{}' is visible in C{} ("
                      "mag {:.1f}..{:.1f}; "
                      "{:.1f}..{:.1f}\"/h; "
                      "ra {:.3f}..{:.3f}; "
                      "dec {:.3f}..{:.3f}).".format(
                          target, c, min_mag, max_mag,
                          campaign_ephem['motion'].min(),
                          campaign_ephem['motion'].max(),
                          campaign_ephem['ra'].min(),
                          campaign_ephem['ra'].max(),
                          campaign_ephem['dec'].min(),
                          campaign_ephem['dec'].max()))
            continue
    K2fov.logger.disabled = False
    return visible_campaigns
Пример #3
0
TILE_NO_DEC = 5  # Number of tiles in Dec direction


def get_fov(campaign):
    ra, dec, scRoll = getRaDecRollFromFieldnum(campaign)
    fovRoll = fov.getFovAngleFromSpacecraftRoll(scRoll)
    return fov.KeplerFov(ra, dec, fovRoll)


if __name__ == "__main__":
    output = {"tiles": {}}  # Dict that will be written as a JSON file

    f = get_fov(CAMPAIGN)

    pl.figure(figsize=(16, 9))
    ph = proj.PlateCaree()
    f.plotPointing(ph,
                   showOuts=False,
                   plot_degrees=False,
                   mod3="white",
                   colour="gray",
                   lw=5,
                   solid_capstyle="round",
                   solid_joinstyle="round")

    for x in range(TILE_NO_RA):
        for y in range(TILE_NO_DEC):
            ra = TILE_RA + x * TILE_SIZE
            dec = TILE_DEC + y * TILE_SIZE
            tile_def = {
                "ra1": ra - .5 * TILE_SIZE,