k2.py - Main mission routines

Implements several routines specific to the K2 mission.

everest.missions.k2.k2.Setup()

Called when the code is installed. Sets up directories and downloads the K2 catalog.

everest.missions.k2.k2.Season(EPIC, **kwargs)

Returns the campaign number for a given EPIC target.

everest.missions.k2.k2.Breakpoints(EPIC, season=None, cadence='lc', **kwargs)

Returns the location of the breakpoints for a given target.

Parameters:
  • EPIC (int) – The EPIC ID number
  • cadence (str) – The light curve cadence. Default lc

Note

The number corresponding to a given breakpoint is the number of cadences since the beginning of the campaign.

everest.missions.k2.k2.GetData(EPIC, season=None, cadence='lc', clobber=False, delete_raw=False, aperture_name='k2sff_15', saturated_aperture_name='k2sff_19', max_pixels=75, download_only=False, saturation_tolerance=-0.1, bad_bits=[1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17], get_hires=True, get_nearby=True, **kwargs)

Returns a DataContainer instance with the raw data for the target.

Parameters:
  • EPIC (int) – The EPIC ID number
  • season (int) – The observing season (campaign). Default None
  • cadence (str) – The light curve cadence. Default lc
  • clobber (bool) – Overwrite existing files? Default False
  • delete_raw (bool) – Delete the FITS TPF after processing it? Default False
  • aperture_name (str) – The name of the aperture to use. Select custom to call GetCustomAperture(). Default k2sff_15
  • saturated_aperture_name (str) – The name of the aperture to use if the target is saturated. Default k2sff_19
  • max_pixels (int) – Maximum number of pixels in the TPF. Default 75
  • download_only (bool) – Download raw TPF and return? Default False
  • saturation_tolerance (float) – Target is considered saturated if flux is within this fraction of the pixel well depth. Default -0.1
  • bad_bits (array_like) – Flagged :py:obj`QUALITY` bits to consider outliers when computing the model. Default [1,2,3,4,5,6,7,8,9,11,12,13,14,16,17]
  • get_hires (bool) – Download a high resolution image of the target? Default True
  • get_nearby (bool) – Retrieve location of nearby sources? Default True
everest.missions.k2.k2.GetNeighbors(EPIC, season=None, model=None, neighbors=10, mag_range=(11.0, 13.0), cdpp_range=None, aperture_name='k2sff_15', cadence='lc', **kwargs)

Return neighbors random bright stars on the same module as EPIC.

Parameters:
  • EPIC (int) – The EPIC ID number
  • model (str) – The everest model name. Only used when imposing CDPP bounds. Default None
  • neighbors (int) – Number of neighbors to return. Default 10
  • aperture_name (str) – The name of the aperture to use. Select custom to call GetCustomAperture(). Default k2sff_15
  • cadence (str) – The light curve cadence. Default lc
  • mag_range (tuple) – (low, high) values for the Kepler magnitude. Default (11, 13)
  • cdpp_range (tuple) – (low, high) values for the de-trended CDPP. Default None
everest.missions.k2.k2.Statistics(season=None, clobber=False, model='nPLD', injection=False, compare_to='kepler', plot=True, cadence='lc', planets=False, **kwargs)

Computes and plots the CDPP statistics comparison between model and compare_to for all long cadence light curves in a given campaign

Parameters:
  • season – The campaign number or list of campaign numbers. Default is to plot all campaigns
  • clobber (bool) – Overwrite existing files? Default False
  • model (str) – The everest model name
  • compare_to (str) – The everest model name or other K2 pipeline name
  • plot (bool) – Default True
  • injection (bool) – Statistics for injection tests? Default False
  • planets (bool) – Statistics for known K2 planets? Default False
everest.missions.k2.k2.TargetDirectory(ID, season, relative=False, **kwargs)

Returns the location of the everest data on disk for a given target.

Parameters:
  • ID – The target ID
  • season (int) – The target season number
  • relative (bool) – Relative path? Default False
everest.missions.k2.k2.HasShortCadence(EPIC, season=None)

Returns True if short cadence data is available for this target.

Parameters:
  • EPIC (int) – The EPIC ID number
  • season (int) – The campaign number. Default None
everest.missions.k2.k2.DVSFile(ID, season, cadence='lc')

Returns the name of the DVS PDF for a given target.

Parameters:
  • ID – The target ID
  • season (int) – The target season number
  • cadence (str) – The cadence type. Default lc
everest.missions.k2.k2.InjectionStatistics(campaign=0, clobber=False, model='nPLD', plot=True, show=True, **kwargs)

Computes and plots the statistics for injection/recovery tests.

Parameters:
  • campaign (int) – The campaign number. Default 0
  • model (str) – The everest model name
  • plot (bool) – Default True
  • show (bool) – Show the plot? Default True. If False, returns the fig, ax instances.
  • clobber (bool) – Overwrite existing files? Default False
everest.missions.k2.k2.HDUCards(headers, hdu=0)

Generates HDU cards for inclusion in the de-trended light curve FITS file. Used internally.

everest.missions.k2.k2.CSVFile(ID, user='rl')

Returns the name of the CSV file for a given target.

Parameters:
  • ID – The target ID
  • season (int) – The target season number
  • cadence (str) – The cadence type. Default lc
everest.missions.k2.k2.FITSFile(ID, season, cadence='lc')

Returns the name of the FITS file for a given target.

Parameters:
  • ID – The target ID
  • season (int) – The target season number
  • cadence (str) – The cadence type. Default lc
everest.missions.k2.k2.FITSUrl(ID, season)

Returns the online path to the FITS file for a given target.

Parameters:
  • ID – The target ID
  • season (int) – The target season number
everest.missions.k2.k2.CDPP(flux, mask=[], cadence='lc')

Compute the proxy 6-hr CDPP metric.

Parameters:
  • flux (array_like) – The flux array to compute the CDPP for
  • mask (array_like) – The indices to be masked
  • cadence (str) – The light curve cadence. Default lc
everest.missions.k2.k2.GetTargetCBVs(model)

Returns the design matrix of CBVs for the given target.

Parameters:model – An instance of the everest model for the target
everest.missions.k2.k2.FitCBVs(model)

Fits the CBV design matrix to the de-trended flux of a given target. This is called internally whenever the user accesses the fcor attribute.

Parameters:model – An instance of the everest model for the target
everest.missions.k2.k2.PlanetStatistics(model='nPLD', compare_to='k2sff', **kwargs)

Computes and plots the CDPP statistics comparison between model and compare_to for all known K2 planets.

Parameters:
  • model (str) – The everest model name
  • compare_to (str) – The everest model name or other K2 pipeline name
everest.missions.k2.k2.StatsToCSV(campaign, model='nPLD')

Generate the CSV file used in the search database for the documentation.