Exemplo n.º 1
0
def test_star_init():
    """Test the init of the star class
    
    Notes
    -----
    If adding more star inits, remember to os.rmdir(st.path) to clean up after
    the test. 
    
    
    """
    pg = lk.periodogram.Periodogram(np.array([1,1])*units.microhertz, units.Quantity(np.array([1,1]), None))
    st = star('thisisatest', pg, (220.0, 3.0), (16.97, 0.05), (4750, 250), (1.34, 0.1))
    
    # simple check to see if all the attributes are there compared to the time
    # of test creation.
    atts = ['ID', '_fill_diag', '_log_obs', '_make_prior_corner', '_obs', 
            '_outpath', '_plot_offdiag', '_save_my_fig', '_set_outpath', 
            'bp_rp', 'dnu', 'f', 'numax', 'path', 'pg', 'plot_corner', 
            'plot_echelle', 'plot_prior', 'plot_spectrum', 'plot_start', 
            'prior_file', 'run_asy_peakbag', 'run_kde', 'run_peakbag', 
            's', 'teff']

    pbt.assert_hasattributes(st, atts)

    # cleanup
    os.rmdir(st.path)
Exemplo n.º 2
0
def test_asymp_spec_model_init():
    """Tests for the init of the asymptotic relation spectrum model"""

    # setup
    mod = asymp_spec_model(cs.st.f, cs.pars['norders'])
    attributes = ['_P_envelope', '_asymptotic_relation', '_get_enns', 
                  '_get_nmax', '_lor', '_pair', 'f', 'model', 'norders']

    # check that all attributes/methods are assigned
    pbt.assert_hasattributes(mod, attributes)
Exemplo n.º 3
0
def test_asymptotic_fit_init():
    """Tests for the init of asy_fit"""

    # setup
    st = cs.st
    asymptotic_fit(st, norders=cs.pars['norders'])
    attributes = [
        '_asymptotic_relation', '_fill_diag', '_get_asy_start', '_get_enns',
        '_get_freq_range', '_get_nmax', '_get_summary_stats', '_log_obs',
        '_lor', '_make_prior_corner', '_obs', '_pair', '_plot_offdiag',
        '_save_my_fig', 'f', 'get_modeIDs', 'kde', 'likelihood', 'model',
        'norders', 'par_names', 'pg', 'plot_corner', 'plot_echelle',
        'plot_prior', 'plot_spectrum', 'plot_start', 'prior', 'prior_file',
        's', 'sel', 'start', 'start_samples', '_P_envelope'
    ]

    # check that all attributes/methods are assigned
    pbt.assert_hasattributes(st.asy_fit, attributes)