How to use the stingray.Covariancespectrum function in stingray

To help you get started, we’ve selected a few stingray 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 StingraySoftware / dave / src / main / python / utils / dave_engine.py View on Github external
event_list = np.column_stack((time_vals, events_table.columns["E"].values))

                        band_width = energy_range[1] - energy_range[0]
                        band_step = band_width / n_bands
                        from_val = energy_range[0]
                        band_interest = []
                        for i in range(n_bands):
                            band_interest.extend([[energy_range[0] + (i * band_step), energy_range[0] + ((i + 1) * band_step)]])
                            energy_arr.extend([(energy_range[0] + (i * band_step) + energy_range[0] + ((i + 1) * band_step))/2])

                        if std < 0:
                            std = None

                        # Calculates the Covariance Spectrum
                        cs = Covariancespectrum(event_list, dt, band_interest=band_interest, ref_band_interest=ref_band_interest, std=std)

                        covariance_arr = nan_and_inf_to_num(cs.covar)
                        covariance_err_arr = nan_and_inf_to_num(cs.covar_error)

                    else:
                        logging.warn('get_covariance_spectrum: Lc duration must be greater than bin size!')
                        return common_error("LC duration must be greater than bin size")
                else:
                    logging.warn('get_covariance_spectrum: E column not found!')
                    return common_error("E column not found")
            else:
                logging.warn('get_covariance_spectrum: No events data!')
                return common_error('No events data')
        else:
            logging.warn('get_covariance_spectrum: Wrong dataset type!')
            return common_error("Wrong dataset type")