Beispiel #1
0
def test_copy_star(tmpdir):
    os.chdir(str(tmpdir))

    dir_ = os.path.join(pyfant.get_pfant_data_path(), 'arcturus')
    pyfant.copy_star(dir_)

    assert glob.glob("*") == ['abonds.dat', 'main.dat']
Beispiel #2
0
def test_run_parallel(tmpdir):
    os.chdir(str(tmpdir))

    pyfant.copy_star(pyfant.get_pfant_data_path('arcturus'))
    pyfant.link_to_data(pyfant.get_pfant_data_path("common"))

    cc = []

    c = pyfant.Combo()
    c.conf.flag_output_to_dir = True
    cc.append(c)
    c = pyfant.Combo()
    c.conf.flag_output_to_dir = True
    cc.append(c)

    pyfant.run_parallel(cc, flag_console=False)
"""Runs synthesis over large wavelength range, then plots continuum"""

import pyfant
import f311
import matplotlib.pyplot as plt
import a99

if __name__ == "__main__":
    # Copies files main.dat and abonds.dat to local directory (for given star)
    pyfant.copy_star(starname="sun-grevesse-1996")
    # Creates symbolic links to all non-star-specific files, such as atomic & molecular lines,
    # partition functions, etc.
    pyfant.link_to_data()

    # Creates object that will run the four Fortran executables (innewmarcs, hydro2, pfant, nulbad)
    obj = pyfant.Combo()
    oo = obj.conf.opt
    # synthesis interval start (angstrom)
    oo.llzero = 2500
    # synthesis interval end (angstrom)
    oo.llfin = 30000
    # savelength step (angstrom)
    oo.pas = 1.
    # Turns off hydrogen lines
    oo.no_h = True
    # Turns off atomic lines
    oo.no_atoms = True
    # Turns off molecular lines
    oo.no_molecules = True

    obj.run()
Beispiel #4
0
def test_run_combo(tmpdir):
    os.chdir(str(tmpdir))
    pyfant.copy_star(pyfant.get_pfant_data_path('arcturus'))
    pyfant.link_to_data(pyfant.get_pfant_data_path("common"))
    c = pyfant.Combo()
    c.run()
Beispiel #5
0
        sys.exit()
        
    # figures out the path to directory (dir_)
    if flag_menu:
        print("\nLooking into directory '{}'...".format(pyfant.get_pfant_data_path()))
        dirnames = pyfant.get_pfant_star_subdirs()
        dirnames.sort()
        choice = a99.menu("Choose a star", ["{}{}".format(x[0].upper(), x[1:]) for x in dirnames],
                      cancel_label="quit", flag_allow_empty=True, flag_cancel=False)
        if choice is None or choice <= 0:
            sys.exit()
        dir_ = os.path.join(pyfant.get_pfant_data_path(), dirnames[choice-1])
    else:
        if args.path:
            dir_ = args.directory
        else:
            dir_ = os.path.join(pyfant.get_pfant_data_path(), args.directory)
            
    if not os.path.isdir(dir_):
        print("'%s' is not a directory" % dir_)
        sys.exit(-1)
    pyfant.copy_star(dir_)

    # print("\n")
    # print("\n".join(a99.format_box("Attention")))
    # print("File 'dissoc.dat' may require revision!\n\n"
    #       "You may delete this file to assume atomic abundances in 'abonds.dat' for the molecules.\n\n"
    #       "(this message should be deleted when all files 'dissoc.dat' provided with PFANT\n"
    #       "finish being reviewed)\n\n"
    #       "(2017-11-28)\n")