How to use the lightkurve.search.SearchResult function in lightkurve

To help you get started, we’ve selected a few lightkurve examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github KeplerGO / lightkurve / lightkurve / search.py View on Github external
if s in np.atleast_1d(sector) or sector is None:
                cutouts.append({'description': 'TESS FFI Cutout (sector {})'.format(s),
                                'target_name': str(target),
                                'targetid': str(target),
                                'productFilename': 'TESSCut',
                                'distance': 0.0,
                                'sequence_number': s,
                                'obs_collection': 'TESS'}
                               )
        if len(cutouts) > 0:
            log.debug("Found {} matching cutouts.".format(len(cutouts)))
            masked_result = Table(cutouts)
            masked_result.sort(['distance', 'sequence_number'])
        else:
            masked_result = None
        return SearchResult(masked_result)
github KeplerGO / lightkurve / lightkurve / search.py View on Github external
raise SearchError('No data found for target "{}".'.format(target))

    # Light curves and target pixel files
    if filetype.lower() != 'ffi':
        from astroquery.mast import Observations
        products = Observations.get_product_list(observations)
        result = join(products, observations, keys="obs_id", join_type='left',
                      uniq_col_name='{col_name}{table_name}', table_names=['', '_2'])
        result.sort(['distance', 'obs_id'])

        masked_result = _filter_products(result, filetype=filetype,
                                         campaign=campaign, quarter=quarter,
                                         cadence=cadence, project=mission,
                                         month=month, sector=sector, limit=limit)
        log.debug("MAST found {} matching data products.".format(len(masked_result)))
        return SearchResult(masked_result)

    # Full Frame Images
    else:
        cutouts = []
        for idx in np.where(['TESS FFI' in t for t in observations['target_name']])[0]:
            # if target passed in is a SkyCoord object, convert to RA, dec pair
            if isinstance(target, SkyCoord):
                target = '{}, {}'.format(target.ra.deg, target.dec.deg)
            # pull sector numbers
            s = observations['sequence_number'][idx]
            # if the desired sector is available, add a row
            if s in np.atleast_1d(sector) or sector is None:
                cutouts.append({'description': 'TESS FFI Cutout (sector {})'.format(s),
                                'target_name': str(target),
                                'targetid': str(target),
                                'productFilename': 'TESSCut',
github KeplerGO / lightkurve / lightkurve / search.py View on Github external
* A coordinate string in sexagesimal format, e.g. "19:02:43.1 +50:14:28.7".
            * An `astropy.coordinates.SkyCoord` object.
    sector : int or list
        TESS Sector number. Default (None) will return all available sectors. A
        list of desired sectors can also be provided.

    Returns
    -------
    result : :class:`SearchResult` object
        Object detailing the data products found.
    """
    try:
        return _search_products(target, filetype="ffi", mission='TESS', sector=sector)
    except SearchError as exc:
        log.error(exc)
        return SearchResult(None)
github KeplerGO / lightkurve / lightkurve / search.py View on Github external
def __getitem__(self, key):
        """Implements indexing and slicing, e.g. SearchResult[2:5]."""
        # this check is necessary due to an astropy bug
        # for more information, see issue #445
        if key == -1:
            key = len(self.table) - 1
        selection = self.table[key]
        # Indexing a Table with an integer will return a Row
        if isinstance(selection, Row):
            selection = Table(selection)
        return SearchResult(table=selection)
github KeplerGO / lightkurve / lightkurve / search.py View on Github external
>>> search_lightcurvefile('Kepler-10', radius=100, quarter=4)  # doctest: +SKIP

    This will display a table containing all targets within 100 arcseconds of
    Kepler-10 and in Quarter 4.  We can then download a
    `~lightkurve.collections.LightCurveFileCollection` containing all these
    products using::

        >>> search_lightcurvefile('kepler-10', radius=100, quarter=4).download_all()  # doctest: +SKIP
    """
    try:
        return _search_products(target, radius=radius, filetype="Lightcurve",
                                cadence=cadence, mission=mission, quarter=quarter,
                                month=month, campaign=campaign, sector=sector, limit=limit)
    except SearchError as exc:
        log.error(exc)
        return SearchResult(None)