How to use the stingray.DynamicalPowerspectrum 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
# Check if there is only one GTI and tries to split it by segm_size
        if gti is not None and len(gti) == 1:
            logging.debug("Only one GTI found, splitting by segm_size")
            new_gtis = DsHelper.get_splited_gti(gti[0], segm_size)
            if new_gtis is not None:
                gti = new_gtis
                warnmsg = ["@WARN@GTIs obtained by splitting with segment length"]
            else:
                warnmsg = ["@WARN@The GTI is not splitable by segment length"]
                logging.warn("Can't create splitted gtis from segm_size")

        # Creates the power density spectrum
        logging.debug("Create dynamical spectrum")

        pds = DynamicalPowerspectrum(lc=lc, segment_size=segm_size, norm=norm, gti=gti)

        if pds:

            if df > 0:
                pds.rebin_frequency(df)

            filtered_indexes = np.where((pds.freq >= freq_range[0]) & (pds.freq <= freq_range[1]))[0]
            freq = pds.freq[filtered_indexes]
            time = pds.time
            for tmp_pds in np.transpose(pds.dyn_ps):
                power_all = push_to_results_array(power_all, tmp_pds[filtered_indexes])

            duration = [lc.tseg]

            if gti is not None and len(gti) == 0 and DsHelper.hasGTIGaps(lc.time):
                warnmsg = ["@WARN@GTI gaps found on LC"]