예제 #1
0
def create_base_db(db_fname, zeta_fname):
    """
    Create a database

    Parameters
    ----------
    db_fname : str
        Filename for the database
    zeta_fname : str
        Filename for the Zeta file
    """

    session = init_db(db_fname)
    session.commit()

    # Ingest atomic weights
    weightscomp_ingester = NISTWeightsCompIngester(session)
    weightscomp_ingester.ingest()
    session.commit()

    # Ingest ionization energies
    ioniz_energies_ingester = NISTIonizationEnergiesIngester(session,
                                                             spectra="h-zn")
    ioniz_energies_ingester.ingest(ionization_energies=True,
                                   ground_levels=True)
    session.commit()

    zeta_ingester = KnoxLongZetaIngester(session, zeta_fname)
    zeta_ingester.ingest()
    session.commit()

    return session
def create_test_db(db_fname, gfall_fname, zeta_fname):
    """
    Create a database

    Parameters
    ----------
    db_fname : str
        Filename for the database
    gfall_fname : str
        Filename for the GFALL file
    """

    session = init_db(db_fname)
    session.commit()

    # Ingest atomic weights
    weightscomp_ingester = NISTWeightsCompIngester(session)
    weightscomp_ingester.ingest()
    session.commit()

    # Ingest ionization energies
    ioniz_energies_ingester = NISTIonizationEnergiesIngester(
            session,
            spectra="h-zn"
            )
    ioniz_energies_ingester.ingest(
            ionization_energies=True,
            ground_levels=True
            )
    session.commit()

    # Ingest kurucz levels and lines
    gfall_ingester = GFALLIngester(session, gfall_fname, ions='H-Zn')
    gfall_ingester.ingest(levels=True, lines=True)
    session.commit()

    # Ingest chianti levels, lines and electron collisions
    # H I, He I-II
    chianti_ingester = ChiantiIngester(session, ions='H-He')
    chianti_ingester.ingest(levels=True, lines=True, collisions=True)
    session.commit()

    zeta_ingester = KnoxLongZetaIngester(session, zeta_fname)
    zeta_ingester.ingest()

    session.close()
예제 #3
0
def create_test_db(db_fname, gfall_fname, zeta_fname):
    """
    Create a database

    Parameters
    ----------
    db_fname : str
        Filename for the database
    gfall_fname : str
        Filename for the GFALL file
    """

    session = init_db(db_fname)
    session.commit()

    # Ingest atomic weights
    weightscomp_ingester = NISTWeightsCompIngester(session)
    weightscomp_ingester.ingest()
    session.commit()

    # Ingest ionization energies
    ioniz_energies_ingester = NISTIonizationEnergiesIngester(session,
                                                             spectra="h-zn")
    ioniz_energies_ingester.ingest(ionization_energies=True,
                                   ground_levels=True)
    session.commit()

    # Ingest kurucz levels and lines
    gfall_ingester = GFALLIngester(session, gfall_fname, ions='H-Zn')
    gfall_ingester.ingest(levels=True, lines=True)
    session.commit()

    # Ingest chianti levels, lines and electron collisions
    # H I, He I-II
    chianti_ingester = ChiantiIngester(session, ions='H-He')
    chianti_ingester.ingest(levels=True, lines=True, collisions=True)
    session.commit()

    zeta_ingester = KnoxLongZetaIngester(session, zeta_fname)
    zeta_ingester.ingest()

    session.close()
예제 #4
0
def create_base_db(db_fname, zeta_fname):
    """
    Create a database

    Parameters
    ----------
    db_fname : str
        Filename for the database
    zeta_fname : str
        Filename for the Zeta file
    """

    session = init_db(db_fname)
    session.commit()

    # Ingest atomic weights
    weightscomp_ingester = NISTWeightsCompIngester(session)
    weightscomp_ingester.ingest()
    session.commit()

    # Ingest ionization energies
    ioniz_energies_ingester = NISTIonizationEnergiesIngester(
            session,
            spectra="h-zn"
            )
    ioniz_energies_ingester.ingest(
            ionization_energies=True,
            ground_levels=True
            )
    session.commit()

    zeta_ingester = KnoxLongZetaIngester(session, zeta_fname)
    zeta_ingester.ingest()
    session.commit()

    return session
예제 #5
0
def weightscomp_ingester(memory_session):
    ingester = NISTWeightsCompIngester(memory_session)
    ingester.parser(test_input)
    return ingester
예제 #6
0
def test_weightscomp_ingest_default_count(memory_session):
    weightscomp_ingester = NISTWeightsCompIngester(memory_session)
    weightscomp_ingester.ingest(atomic_weights=True)
    assert memory_session.query(AtomWeight).\
               filter(AtomWeight.data_source==weightscomp_ingester.data_source).count() == 94
예제 #7
0
def weightscomp_ingester(memory_session):
    ingester = NISTWeightsCompIngester(memory_session)
    ingester.parser(test_input)
    return ingester
예제 #8
0
def test_weightscomp_ingest_default_count(memory_session):
    weightscomp_ingester = NISTWeightsCompIngester(memory_session)
    weightscomp_ingester.ingest(atomic_weights=True)
    assert memory_session.query(AtomWeight).\
               filter(AtomWeight.data_source==weightscomp_ingester.data_source).count() == 94
예제 #9
0
def weightscomp_ingester():
    ingester = NISTWeightsCompIngester()
    ingester.parser(test_input)
    return ingester