Beispiel #1
0
def isotope_db_factory(path, remove=True):
    from pychron.database.adapters.isotope_adapter import IsotopeAdapter
    from pychron.database.orms.isotope.util import Base

    db = IsotopeAdapter()
    # db.verbose_retrieve_query = True
    db.trait_set(kind='sqlite', path=path)
    db.connect()

    if remove and os.path.isfile(db.path):
        os.remove(db.path)

    metadata = Base.metadata
    db.create_all(metadata)
    return db
Beispiel #2
0
def isotope_db_factory(path, remove=True):
    from pychron.database.adapters.isotope_adapter import IsotopeAdapter
    from pychron.database.orms.isotope.util import Base

    db = IsotopeAdapter()
    # db.verbose_retrieve_query = True
    db.trait_set(kind='sqlite', path=path)
    db.connect()

    if remove and os.path.isfile(db.path):
        os.remove(db.path)

    metadata = Base.metadata
    db.create_all(metadata)
    return db
Beispiel #3
0
                 resizable=True)
        return v


if __name__ == '__main__':

    class Detector(HasTraits):
        name = Str
        gain = Float

    class Spectrometer(HasTraits):
        detectors = List

    spec = Spectrometer()
    spec.detectors = [Detector(name='H1'), Detector(name='AX')]

    from pychron.database.adapters.isotope_adapter import IsotopeAdapter

    db = IsotopeAdapter(name='pychrondata_dev',
                        kind='mysql',
                        host='localhost',
                        username='******',
                        password='******')
    db.connect()
    # hist = [GainHistory(create_date=datetime.fromtimestamp(i),) for i in range(10)]
    gv = GainsModel(db=db, spectrometer=spec)
    gv.load_histories()
    gev = GainsEditView(model=gv)
    gev.configure_traits()
# ============= EOF =============================================
Beispiel #4
0
                 title='View Detector Gain Histories',
                 resizable=True)
        return v


if __name__ == '__main__':
    class Detector(HasTraits):
        name = Str
        gain = Float

    class Spectrometer(HasTraits):
        detectors = List

    spec = Spectrometer()
    spec.detectors = [Detector(name='H1'), Detector(name='AX')]

    from pychron.database.adapters.isotope_adapter import IsotopeAdapter

    db = IsotopeAdapter(name='pychrondata_dev',
                        kind='mysql',
                        host='localhost',
                        username='******',
                        password='******')
    db.connect()
    # hist = [GainHistory(create_date=datetime.fromtimestamp(i),) for i in range(10)]
    gv = GainsModel(db=db, spectrometer=spec)
    gv.load_histories()
    gev = GainsEditView(model=gv)
    gev.configure_traits()
# ============= EOF =============================================