How to use the stingray.simulator.simulator.Simulator 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
seed = None

                # N = max([(len(lc.time) + 1), int(math.ceil(segm_size * nsegm))])
                # logging.debug('get_bootstrap_results len(lc.time): ' + str((len(lc.time) + 1)))
                # logging.debug('get_bootstrap_results segm_size * nsegm: ' + str(int(math.ceil(segm_size * nsegm))))
                bins_per_segm = int(math.ceil(segm_size / dt))
                N = int(math.ceil(bins_per_segm / 1024) * 1024)  # max([ bins_per_segm, 1024 ])
                #logging.debug('get_bootstrap_results bins_per_segm: ' + str(bins_per_segm))
                #logging.debug('get_bootstrap_results N: ' + str(N))

                models_params = []
                powers = []

                for i in range(n_iter):
                    try:
                        the_simulator = simulator.Simulator(N=N, dt=dt, mean=mean,
                                                             rms=rms, red_noise=red_noise, random_state=seed)

                        sim_lc = the_simulator.simulate(fit_model)

                        if pds_type == 'Sng':
                            sim_pds = Powerspectrum(sim_lc, norm=norm, gti=gti)
                        else:
                            sim_pds = AveragedPowerspectrum(lc=sim_lc, segment_size=segm_size, norm=norm, gti=gti)

                        if sim_pds:

                            if df > 0:
                                pds = pds.rebin(df=df)

                            #sim_pds = rebin_spectrum_if_necessary(sim_pds)