Beispiel #1
0
def test_bursts(n_bursts, run=1, batch=281, source='biggrid2', plot=True):
    """Test burst_analyser when model has zero bursts
    """
    model_ref = burst_analyser.BurstRun(run,
                                        batch=batch,
                                        source=source,
                                        analyse=False,
                                        plot=False,
                                        reload=False,
                                        load_bursts=True,
                                        load_summary=True,
                                        load_lum=False)
    model_test = burst_analyser.BurstRun(run,
                                         batch=batch,
                                         source=source,
                                         analyse=False,
                                         plot=False,
                                         reload=False,
                                         load_bursts=False,
                                         load_summary=False,
                                         load_lum=True)

    pre_idx = model_ref.bursts['t_pre_i'][n_bursts]
    model_test.lum = model_test.lum[:pre_idx]
    model_test.analyse()

    if plot:
        model_test.plot()
        model_test.plot_convergence()
Beispiel #2
0
def check_n_bursts(batches, source, kgrid):
    """Compares n_bursts detected with kepler_analyser against burstfit_1808
    """
    mismatch = np.zeros(4)
    filename = f'mismatch_{source}_{batches[0]}-{batches[-1]}.txt'
    filepath = os.path.join(GRIDS_PATH, filename)

    for batch in batches:
        summ = kgrid.get_summ(batch)
        n_runs = len(summ)

        for i in range(n_runs):
            run = i + 1
            n_bursts1 = summ.iloc[i]['num']
            sys.stdout.write(f'\r{source}_{batch} xrb{run:02}')

            model = burst_analyser.BurstRun(run, batch, source, verbose=False)
            model.analyse()
            n_bursts2 = model.n_bursts

            if n_bursts1 != n_bursts2:
                m_new = np.array((batch, run, n_bursts1, n_bursts2))
                mismatch = np.vstack((mismatch, m_new))

        np.savetxt(filepath, mismatch)
    return mismatch
Beispiel #3
0
def save_all_average_lightcurves(batches,
                                 source,
                                 align='t_peak',
                                 reload=False):
    """Saves all lightcurve files for each model in given batches
    """
    for batch in batches:
        n_runs = grid_tools.get_nruns(batch, source=source)
        for run in range(1, n_runs + 1):
            model = burst_analyser.BurstRun(run,
                                            batch=batch,
                                            source=source,
                                            reload=reload)
            model.save_average_lightcurve(align=align)