コード例 #1
0
ファイル: test_sme_structure.py プロジェクト: AWehrhahn/SME
def test_empty_structure():
    """Test that all properties behave well when nothing is set"""
    empty = SME_Struct()

    assert isinstance(empty.version, str)
    assert empty.teff is not None
    assert empty.logg is not None
    assert empty.vmic == 0
    assert empty.vmac == 0
    assert empty.vsini == 0

    assert empty.nseg == 0
    assert empty.wave is None
    assert empty.spec is None
    assert empty.uncs is None
    assert empty.synth is None
    assert empty.cont is None
    assert empty.mask is None
    assert empty.mask_good is None
    assert empty.mask_bad is None
    # assert empty.mask_line is None
    # assert empty.mask_continuum is None

    assert empty.cscale.shape == (0, 1)
    assert empty.vrad.shape == (0, )
    assert empty.cscale_flag == "none"
    assert empty.vrad_flag == "none"
    assert empty.cscale_degree == 0

    assert empty.mu is not None
    assert empty.nmu == 7

    # assert empty.md5 is not None

    assert empty.linelist is not None
    assert empty.species is not None
    assert len(empty.species) == 0
    assert empty.atomic is not None

    assert empty.monh == 0
    assert not np.isnan(empty["abund Fe"])
    assert empty.abund["H"] == 12
    assert not np.isnan(empty.abund()["Mg"])

    assert empty.system_info is not None
    assert empty.system_info.arch == ""

    assert len(empty.fitparameters) == 0
    assert empty.fitresults is not None
    assert empty.fitresults.covariance is None

    assert empty.atmo is not None
    assert empty.atmo.depth is None

    assert empty.nlte is not None
    assert empty.nlte.elements == []
コード例 #2
0
ファイル: test_sme_structure.py プロジェクト: AWehrhahn/SME
def test_cscale_degree():
    sme = SME_Struct()
    sme.cscale = 1

    flags = ["none", "fix", "constant", "linear", "quadratic"]
    degrees = [0, 0, 0, 1, 2]

    for f, d in zip(flags, degrees):
        sme.cscale_flag = f
        assert sme.cscale_degree == d
        assert sme.cscale.shape[0] == 0
        assert sme.cscale.shape[1] == d + 1
コード例 #3
0
ファイル: test_nlte.py プロジェクト: ellawang44/SME
def make_minimum_structure():
    sme = SME_Struct()
    sme.teff = 5000
    sme.logg = 4.4
    sme.vmic = 1
    sme.vmac = 1
    sme.vsini = 1
    sme.abund = Abund.solar()
    sme.linelist = ValdFile("{}/testcase3.lin".format((cwd)))
    sme.atmo.source = "marcs2012p_t2.0.sav"
    sme.atmo.method = "grid"

    sme.wran = [[6436, 6444]]

    return sme
コード例 #4
0
def sme_2segments():
    cwd = dirname(__file__)

    sme = SME_Struct()
    sme.teff = 5000
    sme.logg = 4.4
    sme.vmic = 1
    sme.vmac = 1
    sme.vsini = 1
    sme.abund = Abund(monh=0, pattern="asplund2009")
    sme.linelist = ValdFile("{}/testcase1.lin".format((cwd)))
    sme.atmo.source = "marcs2012p_t2.0.sav"
    sme.atmo.method = "grid"

    sme.wran = [[6550, 6560], [6560, 6574]]

    sme.vrad_flag = "none"
    sme.cscale_flag = "none"
    return sme
コード例 #5
0
ファイル: test_sme_structure.py プロジェクト: AWehrhahn/SME
def test_save_and_load_structure(filename):
    sme = SME_Struct()
    assert sme.teff is not None

    sme.teff = 5000
    sme.save(filename)
    del sme
    sme = SME_Struct.load(filename)
    assert sme.teff == 5000

    remove(filename)

    data = np.linspace(1000, 2000, 100)
    sme.wave = data
    sme.spec = data
    sme.save(filename)
    sme = SME_Struct.load(filename)
    assert np.all(sme.wave[0] == data)
    assert np.all(sme.spec[0] == data)
    assert sme.nseg == 1
コード例 #6
0
def sme_empty():
    sme = SME_Struct()
    return sme
コード例 #7
0
ファイル: test_sme_structure.py プロジェクト: AWehrhahn/SME
def test_fitresults():
    sme = SME_Struct()
    sme.fitresults.chisq = 100
    sme.fitresults.clear()
    assert sme.fitresults.chisq is None
コード例 #8
0
ファイル: test_sme_structure.py プロジェクト: AWehrhahn/SME
def test_idlver():
    sme = SME_Struct()
    sme.system_info.update()