How to use the lightkurve.utils.channel_to_module_output 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 / prf / prfmodel.py View on Github external
def _prepare_prf(self):
        n_hdu = 5
        min_prf_weight = 1e-6
        module, output = channel_to_module_output(self.channel)
        # determine suitable PRF calibration file
        if module < 10:
            prefix = 'kplr0'
        else:
            prefix = 'kplr'
        prfs_url_path = "http://archive.stsci.edu/missions/kepler/fpc/prf/extracted/"
        prffile = prfs_url_path + prefix + str(module) + '.' + str(output) + '_2011265_prf.fits'

        # read PRF images
        prfn = [0] * n_hdu
        crval1p = np.zeros(n_hdu, dtype='float32')
        crval2p = np.zeros(n_hdu, dtype='float32')
        cdelt1p = np.zeros(n_hdu, dtype='float32')
        cdelt2p = np.zeros(n_hdu, dtype='float32')

        for i in range(n_hdu):
github KeplerGO / lightkurve / lightkurve / correctors / cbvcorrector.py View on Github external
Returns
        -------
        ax : matplotlib.pyplot.Axes.AxesSubplot
            Matplotlib axis object
        '''
        with plt.style.context(MPLSTYLE):
            clip = np.in1d(np.arange(1, len(self.cbv_array)+1), np.asarray(cbvs))
            time_clip = np.in1d(self.cbv_cadenceno, self.lc.cadenceno)

            if ax is None:
                _, ax = plt.subplots(1)
            for idx, cbv in enumerate(self.cbv_array[clip, :][:, time_clip]):
                ax.plot(self.cbv_cadenceno[time_clip], cbv+idx/10., label='{}'.format(idx + 1))
            ax.set_yticks([])
            ax.set_xlabel('Time (MJD)')
            module, output = channel_to_module_output(self.lc.channel)
            if self.lc.mission == 'Kepler':
                ax.set_title('Kepler CBVs (Module : {}, Output : {}, Quarter : {})'
                             ''.format(module, output, self.lc.quarter))
            elif self.lc.mission == 'K2':
                ax.set_title('K2 CBVs (Module : {}, Output : {}, Campaign : {})'
                             ''.format(module, output, self.lc.campaign))
            ax.grid(':', alpha=0.3)
            ax.legend()
        return ax
github KeplerGO / lightkurve / lightkurve / correctors.py View on Github external
def _get_cbv_data(self, cbvs=[1, 2]):
        '''Gets the CBV data for a channel and module
        '''
        module, output = channel_to_module_output(self.lc.channel)
        cbv_file = pyfits.open(self.get_cbv_url())
        cbv_data = cbv_file['MODOUT_{0}_{1}'.format(module, output)].data
        quality_mask = np.in1d(cbv_data['CADENCENO'], self.lc.cadenceno)
        time = cbv_file['MODOUT_{0}_{1}'.format(module, output)].data['CADENCENO'][quality_mask]
        cbv_array = []
        for i in cbvs:
            cbv_array.append(cbv_data.field('VECTOR_{}'.format(i))[quality_mask])
        cbv_array = np.asarray(cbv_array)

        return cbv_array, time
github KeplerGO / lightkurve / lightkurve / correctors.py View on Github external
Returns
        -------
        ax : matplotlib.pyplot.Axes.AxesSubplot
            Matplotlib axis object
        '''
        with plt.style.context(MPLSTYLE):
            clip = np.in1d(np.arange(1, len(self.cbv_array)+1), np.asarray(cbvs))
            time_clip = np.in1d(self.cbv_cadenceno, self.lc.cadenceno)

            if ax is None:
                _, ax = plt.subplots(1)
            for idx, cbv in enumerate(self.cbv_array[clip, :][:, time_clip]):
                ax.plot(self.cbv_cadenceno[time_clip], cbv+idx/10., label='{}'.format(idx + 1))
            ax.set_yticks([])
            ax.set_xlabel('Time (MJD)')
            module, output = channel_to_module_output(self.lc.channel)
            if self.lc.mission == 'Kepler':
                ax.set_title('Kepler CBVs (Module : {}, Output : {}, Quarter : {})'
                             ''.format(module, output, self.lc.quarter))
            elif self.lc.mission == 'K2':
                ax.set_title('K2 CBVs (Module : {}, Output : {}, Campaign : {})'
                             ''.format(module, output, self.lc.campaign))
            ax.grid(':', alpha=0.3)
            ax.legend()
        return ax
github KeplerGO / lightkurve / lightkurve / correctors / cbvcorrector.py View on Github external
def _get_cbv_data(self, cbvs=(1, 2)):
        """Returns the CBV data for a channel and module."""
        module, output = channel_to_module_output(self.lc.channel)
        cbv_file = pyfits.open(self.get_cbv_url())
        cbv_data = cbv_file['MODOUT_{0}_{1}'.format(module, output)].data
        quality_mask = np.in1d(cbv_data['CADENCENO'], self.lc.cadenceno)
        time = cbv_file['MODOUT_{0}_{1}'.format(module, output)].data['CADENCENO'][quality_mask]
        cbv_array = []
        for i in cbvs:
            cbv_array.append(cbv_data.field('VECTOR_{}'.format(i))[quality_mask])
        cbv_array = np.asarray(cbv_array)

        return cbv_array, time