Esempio n. 1
0
def main():
    '''
        entry point
    '''

    from pychron.envisage.pychron_run import launch
    from pychron.core.helpers.logger_setup import logging_setup
    from pychron.paths import build_directories, paths

    # import application
    #    from pychron.applications.pyexperiment import PyExperiment as app
    from pychron.applications.pyview import PyView as app

    # build directories
    build_directories(paths)

    #    from pychron.core.helpers.paths import hidden_dir
    #    path = os.path.join(hidden_dir, 'version_info')
    #    a = VersionInfoDisplay(local_path=path,
    #                           src_path=os.path.join(SRC_DIR,
    #                           'version_info.txt'))
    #    a.check()
    logging_setup('pychron', level='DEBUG')

    #===============================================================================
    # test flag
    # set if you want to execute tests after startup
    # explicitly set the flag here once. mode is a readonly property
    #===============================================================================
    from pychron.globals import globalv
    globalv._test = False
    globalv.debug = DEBUG

    launch(app)
    os._exit(0)
Esempio n. 2
0
def main():
    '''
        entry point
    '''
    #     from pychron.envisage.pychron_run import launch
    from pychron.core.helpers.logger_setup import logging_setup
    from pychron.paths import build_directories, paths

    # build directories
    build_directories(paths)

    #

    #    from pychron.core.helpers.paths import hidden_dir
    #    path = os.path.join(hidden_dir, 'version_info')
    #    a = VersionInfoDisplay(local_path=path,
    #                           src_path=os.path.join(SRC_DIR,
    #                           'version_info.txt'))
    #    a.check()
    logging_setup('pychron', level='DEBUG')

    # ===============================================================================
    # test flag
    # set if you want to execute tests after startup
    # explicitly set the flag here once. mode is a readonly property
    # ===============================================================================
    #     from pychron.globals import globalv
    #     globalv._test = False

    #     launch()
    #     os._exit(0)
    from pychron.image.video_server import VideoServer
    s = VideoServer()
    s.configure_traits()
Esempio n. 3
0
def run():
    import argparse
    import os

    paths.build(os.getenv('PYCHRON_ROOT'))

    logging_setup('furnace_firmware', use_archiver=False)
    parser = argparse.ArgumentParser(description='Run NMGRL Furnace Firmware')

    # parser.add_argument('--host',
    #                     type=str,
    #                     default='127.0.0.1',
    #                     help='host')

    parser.add_argument('--port',
                        type=int,
                        default=4567,
                        help='TCP port to listen')

    # parser.add_argument('--debug',
    #                     action='store_true',
    #                     default=False,
    #                     help='run in debug mode')

    fm = Firmware()
    fm.bootstrap(**vars(parser.parse_args()))
Esempio n. 4
0
    def main():
        from pychron.paths import paths
        paths.build('_dev')
        from pychron.core.helpers.logger_setup import logging_setup
        from pychron.experiment.automated_run.spec import AutomatedRunSpec
        logging_setup('dvcdb')
        from pychron.dvc.dvc_database import DVCDatabase
        from itertools import groupby
        db = DVCDatabase(kind='mysql', host='localhost', username='******', name='pychronmeta', password='******')
        db.connect()
        identifiers = ['63290', '63291']
        runs = [AutomatedRunSpec(identifier='63290', repository_identifier='Cather_McIntoshd')]
        cr = ConflictResolver()
        experiments = {}
        cr.available_ids = db.get_repository_identifiers()
        eas = db.get_associated_repositories(identifiers)
        for idn, exps in groupby(eas, key=lambda x: x[1]):
            experiments[idn] = [e[0] for e in exps]
        conflicts = []
        for ai in runs:
            identifier = ai.identifier
            es = experiments[identifier]
            if ai.repository_identifier not in es:
                conflicts.append((ai, es))
        if conflicts:
            cr.add_conflicts('Foo', conflicts)

        if cr.conflicts:

            info = cr.edit_traits(kind='livemodal')
            if info.result:
                cr.apply()
Esempio n. 5
0
def setup():
    """
        entry point
    """

    from pychron.core.helpers.logger_setup import logging_setup
    from pychron.paths import build_directories, paths

    # import application
    #    from pychron.applications.pydiode import PyDiode as app
    from pychron.applications.pyexperiment import PyExperiment as app

    # build directories
    build_directories(paths)

    #

    #    from pychron.core.helpers.paths import hidden_dir
    #    path = os.path.join(hidden_dir, 'version_info')
    #    a = VersionInfoDisplay(local_path=path,
    #                           src_path=os.path.join(SRC_DIR,
    #                           'version_info.txt'))
    #    a.check()
    logging_setup('pychron', level='DEBUG')

    # #===============================================================================
    # # test flag
    # # set if you want to execute tests after startup
    # # explicitly set the flag here once. mode is a readonly property
    # #===============================================================================
    #     from pychron.globals import globalv
    #     globalv._test = False
    #     globalv.debug = DEBUG
    return app
Esempio n. 6
0
def main():
    '''
        entry point
    '''

    from pychron.envisage.pychron_run import launch
    from pychron.core.helpers.logger_setup import logging_setup
    from pychron.paths import build_directories, paths

    # import application
#    from pychron.applications.pyexperiment import PyExperiment as app
    from pychron.applications.pyview import PyView as app

    # build directories
    build_directories(paths)

#    from pychron.core.helpers.paths import hidden_dir
#    path = os.path.join(hidden_dir, 'version_info')
#    a = VersionInfoDisplay(local_path=path,
#                           src_path=os.path.join(SRC_DIR,
#                           'version_info.txt'))
#    a.check()
    logging_setup('pychron', level='DEBUG')

#===============================================================================
# test flag
# set if you want to execute tests after startup
# explicitly set the flag here once. mode is a readonly property
#===============================================================================
    from pychron.globals import globalv
    globalv._test = False
    globalv.debug = DEBUG

    launch(app)
    os._exit(0)
Esempio n. 7
0
def initialize_version(appname, debug):
    root = os.path.dirname(__file__)

    if not debug:
        add_eggs(root)
    else:
        build_sys_path()

    # from pychron.environment.util import get_environment
    # env = get_environment(appname)
    from pychron.envisage.user_login import get_user
    args = get_user()
    if args is None:
        return False
    else:
        user, env = args

    if not env:
        return False

    set_application_home(appname, env)

    from pychron.paths import paths
    logger.debug('using Pychron environment: {}'.format(env))
    paths.build(env)

    from configparser import ConfigParser, NoSectionError
    cp = ConfigParser()
    pref_path = os.path.join(ETSConfig.application_home, 'preferences.ini')
    cp.read(pref_path)
    try:
        cp.set('pychron.general', 'environment', env)
    except NoSectionError:
        cp.add_section('pychron.general')
        cp.set('pychron.general', 'environment', env)

    root = os.path.dirname(pref_path)
    if not os.path.isdir(root):
        os.mkdir(root)

    with open(pref_path, 'w') as wfile:
        cp.write(wfile)

    # build globals
    build_globals(user, debug)

    from pychron.core.helpers.logger_setup import logging_setup
    from pychron.paths import build_directories

    # build directories
    build_directories()
    paths.write_defaults()

    # setup logging. set a basename for log files and logging level
    logging_setup('pychron', level='DEBUG')

    from pychron.core.helpers.exception_helper import set_exception_handler
    set_exception_handler()

    return env
Esempio n. 8
0
def main():
    '''
        entry point
    '''
#     from pychron.envisage.pychron_run import launch
    from pychron.core.helpers.logger_setup import logging_setup
    from pychron.paths import build_directories, paths

    # build directories
    build_directories(paths)

    #

#    from pychron.core.helpers.paths import hidden_dir
#    path = os.path.join(hidden_dir, 'version_info')
#    a = VersionInfoDisplay(local_path=path,
#                           src_path=os.path.join(SRC_DIR,
#                           'version_info.txt'))
#    a.check()
    logging_setup('pychron', level='DEBUG')

# ===============================================================================
# test flag
# set if you want to execute tests after startup
# explicitly set the flag here once. mode is a readonly property
# ===============================================================================
#     from pychron.globals import globalv
#     globalv._test = False

#     launch()
#     os._exit(0)
    from pychron.image.video_server import VideoServer
    s = VideoServer()
    s.configure_traits()
Esempio n. 9
0
def suite():
    # set env. variables
    os.environ['MassSpecDBVersion'] = '16'

    from pychron.paths import paths
    paths.build('_dev')

    if use_logger:
        from pychron.core.helpers.logger_setup import logging_setup
        logging_setup('unittests')

    from pychron.canvas.canvas2D.tests.calibration_item import CalibrationObjectTestCase
    from pychron.stage.tests.stage_map import StageMapTestCase, \
        TransformTestCase
    from pychron.entry.tests.sample_loader import SampleLoaderTestCase
    from pychron.core.helpers.tests.floatfmt import FloatfmtTestCase
    from pychron.processing.tests.analysis_modifier import AnalysisModifierTestCase
    from pychron.experiment.tests.backup import BackupTestCase
    from pychron.core.xml.tests.xml_parser import XMLParserTestCase
    from pychron.entry.tests.analysis_loader import XLSAnalysisLoaderTestCase
    from pychron.entry.tests.irradiation_loader import XLSIrradiationLoaderParseTestCase, \
        XLSIrradiationLoaderLoadTestCase
    from pychron.entry.tests.massspec_irrad_export import MassSpecIrradExportTestCase
    from pychron.core.regression.tests.regression import OLSRegressionTest, MeanRegressionTest, \
        FilterOLSRegressionTest, OLSRegressionTest2
    from pychron.experiment.tests.frequency_test import FrequencyTestCase, FrequencyTemplateTestCase
    from pychron.experiment.tests.position_regex_test import XYTestCase
    from pychron.experiment.tests.renumber_aliquot_test import RenumberAliquotTestCase

    from pychron.external_pipette.tests.external_pipette import ExternalPipetteTestCase
    from pychron.processing.tests.plateau import PlateauTestCase
    from pychron.processing.tests.ratio import RatioTestCase
    from pychron.pyscripts.tests.extraction_script import WaitForTestCase
    from pychron.pyscripts.tests.measurement_pyscript import InterpolationTestCase, DocstrContextTestCase
    from pychron.experiment.tests.conditionals import ConditionalsTestCase, ParseConditionalsTestCase
    from pychron.experiment.tests.identifier import IdentifierTestCase
    from pychron.experiment.tests.comment_template import CommentTemplaterTestCase

    loader = unittest.TestLoader()
    suite = unittest.TestSuite()

    tests = (CalibrationObjectTestCase, StageMapTestCase, TransformTestCase,
             SampleLoaderTestCase, AnalysisModifierTestCase, BackupTestCase,
             MassSpecIrradExportTestCase, XMLParserTestCase,
             XLSIrradiationLoaderLoadTestCase,
             XLSIrradiationLoaderParseTestCase, XLSAnalysisLoaderTestCase,
             RatioTestCase, InterpolationTestCase, DocstrContextTestCase,
             OLSRegressionTest, OLSRegressionTest2, MeanRegressionTest,
             FilterOLSRegressionTest, PlateauTestCase, ExternalPipetteTestCase,
             WaitForTestCase, XYTestCase, FrequencyTestCase,
             FrequencyTemplateTestCase, RenumberAliquotTestCase,
             ConditionalsTestCase, ParseConditionalsTestCase,
             IdentifierTestCase, CommentTemplaterTestCase, FloatfmtTestCase)

    for t in tests:
        suite.addTest(loader.loadTestsFromTestCase(t))

    return suite
Esempio n. 10
0
def main():
    paths.build('_dev')

    global log
    if not log:
        logging_setup('heapy')
        log = True

    return run()
Esempio n. 11
0
def main():
    paths.build('_dev')

    global log
    if not log:
        logging_setup('heapy')
        log = True

    return run()
Esempio n. 12
0
def initialize_version(appname, debug):
    root = os.path.dirname(__file__)

    if not debug:
        add_eggs(root)
    else:
        build_sys_path()

    # can now use pychron.
    from pychron.paths import paths

    # paths.bundle_root = root
    # if '-' in setup_ver:
    # setup_ver = setup_ver.split('-')[0]

    from pychron.envisage.user_login import get_user

    user = get_user()
    if not user:
        logger.info('user login failed')
        os._exit(0)

    if appname.startswith('py'):
        appname = appname[2:]

    pref_path = os.path.join(paths.base, '.enthought',
                             'pychron.{}.application.{}'.format(appname, user),
                             'preferences.ini')

    from ConfigParser import ConfigParser

    cp = ConfigParser()
    cp.read(pref_path)

    try:
        proot = cp.get('pychron.general', 'root_dir')
    except BaseException:
        proot = '/Users/ross/Pychron'

    paths.build(proot)

    # build globals
    build_globals(debug)

    from pychron.core.helpers.logger_setup import logging_setup
    from pychron.paths import build_directories

    # build directories
    build_directories()

    # setup logging. set a basename for log files and logging level
    logging_setup('pychron', level='DEBUG')

    return user
Esempio n. 13
0
def main():
    """
        entry point
    """
    from pychron.envisage.pychron_run import launch
    from pychron.core.helpers.logger_setup import logging_setup
    from pychron.paths import build_directories, paths

    # build directories
    build_directories(paths)

#    from pychron.core.helpers.paths import hidden_dir
#    path = os.path.join(hidden_dir, 'version_info')
#    a = VersionInfoDisplay(local_path=path,
#                           src_path=os.path.join(SRC_DIR,
#                           'version_info.txt'))
#    a.check()
    logging_setup('pychron', level='DEBUG')

    from pychron.applications.pyexperiment import PyExperiment as app
    launch(app)
Esempio n. 14
0
def main():
    """
        entry point
    """
    from pychron.envisage.pychron_run import launch
    from pychron.core.helpers.logger_setup import logging_setup
    from pychron.paths import build_directories, paths

    # build directories
    build_directories(paths)

    #    from pychron.core.helpers.paths import hidden_dir
    #    path = os.path.join(hidden_dir, 'version_info')
    #    a = VersionInfoDisplay(local_path=path,
    #                           src_path=os.path.join(SRC_DIR,
    #                           'version_info.txt'))
    #    a.check()
    logging_setup('pychron', level='DEBUG')

    from pychron.applications.pyexperiment import PyExperiment as app
    launch(app)
Esempio n. 15
0
    def main():
        from pychron.paths import paths
        paths.build('_dev')
        from pychron.core.helpers.logger_setup import logging_setup
        from pychron.experiment.automated_run.spec import AutomatedRunSpec
        logging_setup('dvcdb')
        from pychron.dvc.dvc_database import DVCDatabase
        from itertools import groupby
        db = DVCDatabase(kind='mysql',
                         host='localhost',
                         username='******',
                         name='pychronmeta',
                         password='******')
        db.connect()
        identifiers = ['63290', '63291']
        runs = [
            AutomatedRunSpec(identifier='63290',
                             repository_identifier='Cather_McIntoshd')
        ]
        cr = ConflictResolver()
        experiments = {}
        with db.session_ctx():
            cr.available_ids = db.get_repository_identifiers()
            eas = db.get_associated_repositories(identifiers)
            for idn, exps in groupby(eas, key=lambda x: x[1]):
                experiments[idn] = [e[0] for e in exps]
            conflicts = []
            for ai in runs:
                identifier = ai.identifier
                es = experiments[identifier]
                if ai.repository_identifier not in es:
                    conflicts.append((ai, es))
            if conflicts:
                cr.add_conflicts('Foo', conflicts)

        if cr.conflicts:

            info = cr.edit_traits(kind='livemodal')
            if info.result:
                cr.apply()
Esempio n. 16
0
def main():
    """
        entry point
    """

    from pychron.envisage.pychron_run import launch
    from pychron.core.helpers.logger_setup import logging_setup
    from pychron.paths import build_directories, paths

    # import application
    from pychron.applications.pyexperiment import PyExperiment as app
    #     from pychron.applications.pyvalve import PyValve as app

    # build directories
    build_directories(paths)

    #    from pychron.core.helpers.paths import hidden_dir
    #    path = os.path.join(hidden_dir, 'version_info')
    #    a = VersionInfoDisplay(local_path=path,
    #                           src_path=os.path.join(SRC_DIR,
    #                           'version_info.txt'))
    #    a.check()
    logging_setup('pychron', level='DEBUG')

    # #===============================================================================
    # # test flag
    # # set if you want to execute tests after startup
    # # explicitly set the flag here once. mode is a readonly property
    # #===============================================================================
    #     from pychron.globals import globalv
    #     globalv._test = False
    #     globalv.debug = DEBUG

    #     from guppy import hpy
    #     app.hp = hp = hpy()
    try:
        launch(app)
    except RuntimeError:
        pass
Esempio n. 17
0
def main():
    """
        entry point
    """

    from pychron.envisage.pychron_run import launch
    from pychron.core.helpers.logger_setup import logging_setup
    from pychron.paths import build_directories, paths

    # import application
    from pychron.applications.pyexperiment import PyExperiment as app
#     from pychron.applications.pyvalve import PyValve as app

    # build directories
    build_directories(paths)

#    from pychron.core.helpers.paths import hidden_dir
#    path = os.path.join(hidden_dir, 'version_info')
#    a = VersionInfoDisplay(local_path=path,
#                           src_path=os.path.join(SRC_DIR,
#                           'version_info.txt'))
#    a.check()
    logging_setup('pychron', level='DEBUG')

# #===============================================================================
# # test flag
# # set if you want to execute tests after startup
# # explicitly set the flag here once. mode is a readonly property
# #===============================================================================
#     from pychron.globals import globalv
#     globalv._test = False
#     globalv.debug = DEBUG

#     from guppy import hpy
#     app.hp = hp = hpy()
    try:
        launch(app)
    except RuntimeError:
        pass
    #        v = View()
    #        for a in self._get_axes():
    #
    #            a.load_parameters_from_device()

    #        v = super(AerotechMotionControllerManager, self).traits_view()
    #        return v

    def _motion_controller_default(self):
        a = AerotechMotionController(name='unidex')

        return a

    def initialize(self, *args, **kw):
        self.motion_controller.bootstrap()
        return True


if __name__ == '__main__':
    from pychron.core.helpers.logger_setup import logging_setup
    logging_setup('amc')
    globalv.show_infos = False
    globalv.show_warnings = False
    paths.build('_experiment')

    amc = AerotechMotionControllerManager()
    amc.bootstrap()

    amc.configure_traits()
# ============= EOF ====================================
Esempio n. 19
0
        return b

#============= views ===================================
    def traits_view(self):
        v = View(
                 Item('control', show_label=False, style='custom'),
#                 VGroup(
#                        Item('laser_amps', format_str = '%0.2f', style = 'readonly'),
#                        Item('laser_temperature', format_str = '%0.2f', style = 'readonly'),
#                        Item('laser_power', format_str = '%0.2f', style = 'readonly'),
#                        Item('laser_voltage', format_str = '%0.2f', style = 'readonly'),
#                        ),
#                    handler = self.handler_klass,
                    width=500,
                    height=500,
                    resizable=True
                 )
        return v



if __name__ == '__main__':
    from pychron.core.helpers.logger_setup import logging_setup

    logging_setup('vue_metrix')
    v = VueMetrixManager()
    v.control.bootstrap()
    v.configure_traits()

#============= EOF ====================================
Esempio n. 20
0
# See the License for the specific language governing permissions and
# limitations under the License.
# ===============================================================================
from __future__ import absolute_import
from __future__ import print_function
import yaml
from mako.template import Template
from traitsui.handler import Controller

from pychron.core.ui import set_qt

set_qt()

from pychron.core.helpers.logger_setup import logging_setup

logging_setup('dcreator')
# ============= enthought library imports =======================
from traits.api import HasTraits, Str
from traitsui.api import View, Item

# ============= standard library imports ========================
# ============= local library imports  ==========================


class DeviceModel(HasTraits):
    name = Str

    def make_from_file(self):
        tmp = self.get_template()

        p = '/Users/ross/Sandbox/device_creator.yaml'
Esempio n. 21
0
from pychron.globals import globalv
from pychron.core.ui import set_toolkit

set_toolkit('qt4')

from pychron.paths import paths

paths.build('_unittest')
#build_directories(paths)

from pychron.core.helpers.logger_setup import logging_setup
from pychron.lasers.laser_managers.fusions_diode_manager import FusionsDiodeManager

logging_setup('arar')
import unittest

globalv.ignore_connection_warnings=True

class Diode(unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        cls.manager = FusionsDiodeManager()
        cls.manager.temperature_controller.bootstrap()

    def test_pid_bins_first(self):
        temp=300
        pd=self.manager._get_pid_bin(temp)
        self.assertEqual(pd, [0.0,0.0,0.0])

    def test_pid_bins(self):
Esempio n. 22
0
from pychron.core.ui import set_toolkit

set_toolkit('qt4')

from pychron.paths import paths

paths.build('_unittest')
#build_directories(paths)

from pychron.core.helpers.logger_setup import logging_setup

logging_setup('packager')

from test.database import isotope_manager_factory
from pychron.processing.vcs_data.packager import Packager



import unittest


class ArArAgeCase(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        cls.isotope_man = isotope_manager_factory(name='pychrondata_minnabluff')
        cls.isotope_man.db.connect()
        man = cls.isotope_man
        db = man.db
        with db.session_ctx():
            ans, tc = db.get_sample_analyses(['AF-72', ], ['Minna Bluff'])
            cls.analyses=man.make_analyses(ans)
Esempio n. 23
0
TEST_PARSE_XLS = False
DEBUGGING = False

# automatically disable debugging if running on a travis ci linux box.
import sys

if sys.platform != 'darwin':
    DEBUGGING = False

DBNAME = 'loader.db'

if DEBUGGING:
    from pychron.core.helpers.logger_setup import logging_setup

    logging_setup('irrad_loader')


def get_data_dir():
    op = 'pychron/entry/tests/data'
    return mget_data_dir(op)
    # if not os.path.isdir(op):
    #     op = os.path.join('.', 'data')
    # return op


def db_factory():
    path = os.path.join(get_data_dir(), DBNAME)
    db = dvc_db_factory(path)
    # from pychron.database.adapters.isotope_adapter import IsotopeAdapter
    # from pychron.database.orms.isotope.util import Base
Esempio n. 24
0
#         v = View(Item('records', show_label=False,
#                       editor=TabularEditor(adapter=SensitivityAdapter(),
#                                            operations=['edit'],
#                                            editable=True,
#                                            )
#                       ),
#
#                  HGroup(Item('add_button', show_label=False),
#                         Item('save_button', show_label=False)),
#                  resizable=True,
#                  width=500,
#                  height=200,
#                  title='Sensitivity Table'
#                  )
#         return v


class SensitivitySelector(SensitivityEntry):
    pass


if __name__ == '__main__':
    from pychron.core.helpers.logger_setup import logging_setup

    paths.build('_experiment')

    logging_setup('runid')
    m = SensitivityEntry()
    m.configure_traits()
# ============= EOF =============================================
Esempio n. 25
0
#                                                                         operations=[]
#                                                                         ),
#                         width=0.3,
#                         ),
                    Item('image_container', style='custom',
                         width=0.7,
                         show_label=False)
                       ),
#                    Item('container', show_label=False,
#                         width=0.7,
#                       editor=ComponentEditor())),
                 resizable=True,
                 height=800,
                 width=900
                 )
        return v


if __name__ == '__main__':
    from pychron.core.helpers.logger_setup import logging_setup
    logging_setup('image_viewer')
    im = ImageBrowser(cache_dir='/Users/ross/Sandbox/cache')
    im.load_remote_directory('')
#    im.load_from_remote_source('raster2.png')
#    im.load_remote_directory()
#    im.names = 'snapshot001.jpg,snapshot002.jpg,snapshot003.jpg,snapshot004.jpg'.split(',')
#    im.load_from_remote_source('foo')
#    im.load_image_from_file('/Users/ross/Sandbox/diodefailsnapshot.jpg')
    im.configure_traits()
#============= EOF =============================================
Esempio n. 26
0
        return py

    def _title_default(self):
        return 'Diode Manager'

    def _control_module_manager_default(self):
        v = VueMetrixManager()  # control = self.control_module)
        return v


if __name__ == '__main__':
    from pychron.core.helpers.logger_setup import logging_setup
    from pychron.initializer import Initializer


    logging_setup('fusions diode')
    f = FusionsDiodeManager()
    f.use_video = True
    f.record_brightness = True
    ini = Initializer()

    a = dict(manager=f, name='FusionsDiode')
    ini.add_initialization(a)
    ini.run()
    #    f.bootstrap()
    f.configure_traits()

#======================= EOF ============================
#    def get_laser_amps(self):
#        '''
#        '''
Esempio n. 27
0
                            Item('tru_tune_band', label='Band'),
                            Item('tru_tune_gain',
                                 label='Gain',
                                 tooltip='1:Most overshot, 6:Least overshoot'),
                            enabled_when='enable_tru_tune'),
                        show_border=True,
                        label='TRU-TUNE+'),
                 title='Autotune Configuration',
                 kind='livemodal')
        return v

    def control_view(self):
        return View(self.get_control_group())

    def configure_view(self):
        return View(self.get_configure_group())

    def _get_autotune_label(self):
        return 'On' if self.autotuning else 'Off'


if __name__ == '__main__':
    from pychron.core.helpers.logger_setup import logging_setup

    logging_setup('watlowezzone')
    w = WatlowEZZone(name='temperature_controller',
                     configuration_dir_name='diode')
    w.bootstrap()
    w.configure_traits(view='configure_view')
# ============================== EOF ==========================
Esempio n. 28
0
#             klass = VideoStageManager
#         else:
#             klass = StageManager
#
#         args['parent'] = self
#         sm = klass(**args)
#         return sm
#     def _power_calibration_manager_default(self):
#         return PowerCalibrationManager(
#                                        parent=self,
#                                        db=self.get_power_calibration_database(),
#                                        application=self.application
#                                        )


if __name__ == '__main__':
    from pychron.core.helpers.logger_setup import logging_setup
    logging_setup('calib')
    lm = LaserManager(name='FusionsDiode')
    lm.set_laser_power(10)
#    from pychron.lasers.power.power_calibration_manager import PowerCalibrationManager, PowerCalibrationObject
#
#    pc=PowerCalibrationObject()
#    pc.coefficients=[0.84,-13.76]
#
#    pm=PowerCalibrationManager(parent=lm)
#    pm._dump_calibration(pc)

#    lm.set_laser_power(10)
#============= EOF ====================================
Esempio n. 29
0
from pychron.core.ui import set_toolkit

set_toolkit('qt4')

from pychron.processing.autoupdate_parser import AutoupdateParser
from test.database import isotope_manager_factory

ISOTOPE_MANAGER = isotope_manager_factory(name='pychrondata_minnabluff')
ISOTOPE_MANAGER.connect()

SKIP_BLANKS = False, 'skip blanks'
SKIP_SIGNALS = False, 'skip signals'
SKIP_FITS = False, 'skip fits'

logging_setup('arar_diff')


class MassSpecPychronIsotopeTestCase(object):
    def setUp(self):
        pass

    def get_expected_value(self, k):
        p = self.parser

        s = p.samples[self.sample_id]
        an = s.analyses[self.analysis_id]
        ev = getattr(an, k)

        sev = str(ev)
        if '.' in sev:
Esempio n. 30
0
        loc.test_image = self.test_image

        dx, dy = loc.find(im, frame, dim * self.pxpermm)
#         print dx, dy
    def setup_image(self):
        frame = self.new_image_frame()
        im = self.new_image(frame)
        self.view_image(im)
        return im

def test1():
    from pychron.image.video import Video
    from pychron.globals import globalv
    globalv.video_test = True
    globalv.video_test_path = '/Users/ross/Sandbox/pos_err/snapshot007.jpg'
#    globalv.video_test_path = '/Users/ross/Sandbox/pos_err/pos_err_53002.jpg'
    globalv.video_test_path = '/Users/ross/Sandbox/pos_err/pos_err_221_0-005.jpg'

#    globalv.video_test_path = '/Users/ross/Sandbox/pos_err/diodefailsnapshot.jpg'
    video = Video()
    video.open()
    mv = MachineVisionManager(video=video)
    mv.configure_traits()


if __name__ == '__main__':
    from pychron.core.helpers.logger_setup import logging_setup
    logging_setup('mv')
    test()
#============= EOF =============================================
    r_mkdir(ldir)
    paths.log_dir = ldir
    paths.root = root


if __name__ == '__main__':

    root = os.path.dirname(__file__)
    from helpers import add_eggs
    add_eggs(root)

    build_directories()
    from pychron.core.helpers.logger_setup import logging_setup
    from pychron.managers.remote_hardware_server_manager import RemoteHardwareServerManager

    logging_setup('server')
    s = RemoteHardwareServerManager()  # handler_klass=AppHandler)
    s.load()
    s.configure_traits()
    os._exit(0)

#    launch()
# ============= EOF ====================================
#
# def read_configuration():
#    '''
#         read the server initialization file in the initialization dir.
#
#         ex
#         [General]
#         servers= server_names
Esempio n. 32
0
        # p = '/Users/ross/Sandbox/pos_err/pos_err_200_0-002.jpg'
        p = '/Users/ross/Sandbox/poserror/pos_err_221_0-007.jpg'
        p = '/Users/ross/Sandbox/poserror/snapshot009.jpg'
        # p = '/Users/argonlab3/Pychron_co2/data/snapshots/pos_err_220_0--001.jpg'

        globalv.video_test_path = p
        globalv.video_test = True

    def _test1_button_fired(self):
        self._set_test_image()
        self._test1()


if __name__ == '__main__':

    logging_setup('mv', use_archiver=False, use_file=False)
    t = TestAutocenter()
    t.configure_traits(view=View(UItem('test1_button')))

# ============= EOF =============================================

# class TestMVManager(MachineVisionManager):
#     step = Button
#     test_image = Instance(MVImage, ())
#
#     def _step_fired(self):
#         self.step_signal.set()
#
#     def traits_view(self):
#         return View(Item('test'),
#                     Item('step'),
Esempio n. 33
0
#                           Item('image', show_label=False,
#                             editor=ImageEditor())
#                           ),
#                         x=0.05,
#                         y=0.1,
#                         #386365
#                         width=1000,
#                         height=700,
#                         resizable=True,
#                         title=self.title
#                         )

if __name__ == '__main__':
    from pychron.core.helpers.logger_setup import logging_setup

    logging_setup('video')
    vm = VideoManager()

    # p = '/Users/fargo2/Desktop/laser_tray_50.tiff'

    # vm.process_image(p, crop=(0, 0, 250, 250))
    vm.start()
    vm.configure_traits()  # view='image_view')



# ================== EOF ========================
# def process_image_dir(self, root):
#        '''
#            @type root: C{str}
#            @param root:
Esempio n. 34
0
from pychron.core.helpers.iterfuncs import partition
from pychron.core.ui import set_qt


set_qt()
# ============= enthought library imports =======================

# ============= standard library imports ========================
# ============= local library imports  ==========================
from pychron.paths import paths
from pychron.geo.shape_file_writer import ShapeFileWriter
from pychron.core.helpers.logger_setup import logging_setup
from pychron.geo.processor import GeoProcessor

paths.build('_dev')
logging_setup('geo')

SamplePoint = namedtuple('SamplePoint', 'x,y,sample,material,labnumber')

src = pyproj.Proj(init='EPSG:4326')
dest = pyproj.Proj(init='EPSG:3031')  #,proj='utm', zone='58')
# ellps='WGS84')

def proj_pt(lat, long):
    x, y = pyproj.transform(src, dest, long, lat)
    return x, y


def get_processor(database='pychrondata_dev'):
    geo = GeoProcessor(bind=False, connect=False)
    geo.db.trait_set(username='******', host='localhost',
Esempio n. 35
0
                         default_directory=paths.irradiation_tray_maps_dir)
        if dlg.open() == OK:
            if dlg.path:
                # verify this is a valid irradiation map file
                if parse_irradiation_tray_map(dlg.path) is not None:
                    db = self.db
                    with db.session_ctx():
                        load_irradiation_map(db,
                                             dlg.path,
                                             os.path.basename(dlg.path),
                                             overwrite_geometry=True)


if __name__ == '__main__':
    paths.build('_dev')
    logging_setup('le')
    from pychron.dvc.dvc_database import DVCDatabase

    dbt = DVCDatabase(kind='sqlite',
                      path='/Users/ross/Programming/test3.sqlite')
    dbt.connect()
    # from pychron.dvc.meta_repo import MetaRepo

    mr = MetaRepo()
    mr.open_repo(paths.meta_root)

    class Demo(HasTraits):
        test = Button
        traits_view = View('test')

        def _test_fired(self):
Esempio n. 36
0
#         print dx, dy

    def setup_image(self):
        frame = self.new_image_frame()
        im = self.new_image(frame)
        self.view_image(im)
        return im


def test1():
    from pychron.image.video import Video
    from pychron.globals import globalv
    globalv.video_test = True
    globalv.video_test_path = '/Users/ross/Sandbox/pos_err/snapshot007.jpg'
    #    globalv.video_test_path = '/Users/ross/Sandbox/pos_err/pos_err_53002.jpg'
    globalv.video_test_path = '/Users/ross/Sandbox/pos_err/pos_err_221_0-005.jpg'

    #    globalv.video_test_path = '/Users/ross/Sandbox/pos_err/diodefailsnapshot.jpg'
    video = Video()
    video.open()
    mv = MachineVisionManager(video=video)
    mv.configure_traits()


if __name__ == '__main__':
    from pychron.core.helpers.logger_setup import logging_setup
    logging_setup('mv')
    test()
#============= EOF =============================================
Esempio n. 37
0
        self._set(0)

    def _set(self, v):
        self.handle.ask('Set {} {}'.format(self.name, v))

class RemotePyScriptRunner(PyScriptRunner):
    handle = None
    def __init__(self, host, port, kind, *args, **kw):
        super(RemotePyScriptRunner, self).__init__(*args, **kw)
        self.handle = EthernetCommunicator()
        self.handle.host = host
        self.handle.port = port
        self.handle.kind = kind
#        self.handle.open()

    def _get_resource(self, name):
        r = RemoteResource()
        r.name = name
        r.handle = self.handle
        return r

    def connect(self):
        return self.handle.open()

if __name__ == '__main__':
    logging_setup('py_runner')
    p = PyScriptRunner()

    p.configure_traits()
#============= EOF ====================================
Esempio n. 38
0
import os
import shutil
import sys

from pychron.core.test_helpers import isotope_db_factory, get_data_dir as mget_data_dir, massspec_db_factory
from pychron.experiment.utilities.identifier import make_runid
from pychron.processing.analysis_modifier import AnalysisModifier

__author__ = 'ross'

import unittest

if sys.platform == 'darwin':
    from pychron.core.helpers.logger_setup import logging_setup

    logging_setup('amod')


def get_data_dir():
    op = 'pychron/processing/tests/data'
    return mget_data_dir(op)


def pychron_source_factory():
    src = os.path.join(get_data_dir(), 'opychrondata.db')
    dest = os.path.join(get_data_dir(), 'pychrondata.db')

    # duplicate the original database
    shutil.copyfile(src, dest)

    db = isotope_db_factory(dest, remove=False)
Esempio n. 39
0
#                           Item('image', show_label=False,
#                             editor=ImageEditor())
#                           ),
#                         x=0.05,
#                         y=0.1,
#                         #386365
#                         width=1000,
#                         height=700,
#                         resizable=True,
#                         title=self.title
#                         )

if __name__ == '__main__':
    from pychron.core.helpers.logger_setup import logging_setup

    logging_setup('video')
    vm = VideoManager()

    # p = '/Users/fargo2/Desktop/laser_tray_50.tiff'

    # vm.process_image(p, crop=(0, 0, 250, 250))
    vm.start()
    vm.configure_traits()  # view='image_view')

#================== EOF ========================
# def process_image_dir(self, root):
#        '''
#            @type root: C{str}
#            @param root:
#        '''
#        A = 60
Esempio n. 40
0
# ===============================================================================
#    _temp_position = None
#    def _get_temp_position(self):
#        return self._temp_position
#
#    def _set_temp_position(self, v):
#        self._temp_position = v
#
#    temp_position = property(fget=_get_temp_position,
#                           fset=_set_temp_position)


if __name__ == '__main__':
    from pychron.core.helpers.logger_setup import logging_setup

    logging_setup('stage_manager')
    name = 'diode'
    s = StageManager(
        name='{}stage'.format(name),
        configuration_dir_name=name,
        # parent = DummyParent(),
        window_width=945,
        window_height=545

    )
    #    from pychron.initializer import Initializer
    #
    #    i = Initializer()
    #    i.add_initialization(dict(name = 'stage_manager',
    #                              manager = s
    #                              ))
Esempio n. 41
0
    def traits_view(self):
        grp = HGroup()
        for controller in self.get_controller_names():
            grp.content.append(
                Item(controller, show_label=False, style='custom'))

        v = View(grp)
        return v

    def get_controller_names(self):
        return ['pumpcontroller{}'.format(i + 1) for i in range(4)]

    def get_controllers(self):
        return [getattr(self, name) for name in self.get_controller_names()]

    def load_controllers(self):
        for controller in self.get_controller_names():
            p = PumpController(name=controller,
                               configuration_dir_name='pumping')
            p.bootstrap()
            setattr(self, controller, p)


if __name__ == '__main__':
    from pychron.core.helpers.logger_setup import logging_setup
    logging_setup(name='pumpman')
    c = PumpManager()
    c.load_controllers()
    c.configure_traits()
Esempio n. 42
0
    # ===============================================================================
    # deleters
    # ===============================================================================
    @delete_one
    def delete_analysis(self, rid):
        return AnalysesTable, 'RID'

    # ===============================================================================
    # private
    # ===============================================================================
    def _get_fittype(self, value):
        return self._retrieve_item(FittypeTable, value, key='Label', )

    def _add_analysis_position(self, analysis, pi, po):
        a = AnalysisPositionTable(Hole=pi, PositionOrder=po)
        analysis.positions.append(a)


if __name__ == '__main__':
    from pychron.core.helpers.logger_setup import logging_setup

    logging_setup('ia')
    ia = MassSpecDatabaseAdapter()
    ia.connect()

    #    ia.selector_factory()
    # dbs = ia.selector
    # dbs.load_recent()
    # dbs.configure_traits()
# ==================EOF======================================================
Esempio n. 43
0
#        '''
#        v = View()
#        for a in self._get_axes():
#
#            a.load_parameters_from_device()

#        v = super(AerotechMotionControllerManager, self).traits_view()
#        return v

    def _motion_controller_default(self):
        a = AerotechMotionController(name='unidex')

        return a

    def initialize(self, *args, **kw):
        self.motion_controller.bootstrap()
        return True

if __name__ == '__main__':
    from pychron.core.helpers.logger_setup import logging_setup
    logging_setup('amc')
    globalv.show_infos = False
    globalv.show_warnings = False
    paths.build('_experiment')

    amc = AerotechMotionControllerManager()
    amc.bootstrap()

    amc.configure_traits()
# ============= EOF ====================================
Esempio n. 44
0
import time

from uncertainties import ufloat

from pychron.core.ui import set_toolkit

set_toolkit('qt4')

from pychron.paths import paths, build_directories

paths.build('_unittest')
build_directories(paths)

from pychron.core.helpers.logger_setup import logging_setup

logging_setup('peak_hop')

from threading import Thread
from pychron.experiment.utilities.mass_spec_database_importer import MassSpecDatabaseImporter
from pychron.processing.arar_age import ArArAge
from pychron.spectrometer.ion_optics.ion_optics_manager import IonOpticsManager
from pychron.spectrometer.thermo.manager.argus import ArgusSpectrometerManager
from pychron.experiment.automated_run.automated_run import AutomatedRun
from pychron.experiment.automated_run.spec import AutomatedRunSpec

import unittest

#HOPS = [('Ar40:H1:10,     Ar39:AX,     Ar36:CDD', 5, 1),
#        #('Ar40:L2,     Ar39:CDD',                   5, 1)
#        #('Ar38:CDD',                                5, 1)
#        ('Ar37:CDD', 5, 1)
Esempio n. 45
0
        # p = '/Users/ross/Sandbox/pos_err/pos_err_200_0-002.jpg'
        p = '/Users/ross/Sandbox/poserror/pos_err_221_0-007.jpg'
        p = '/Users/ross/Sandbox/poserror/snapshot009.jpg'
        p = '/Users/ross/Sandbox/graintest/image0269.png'
        # p = '/Users/argonlab3/Pychron_co2/data/snapshots/pos_err_220_0--001.jpg'

        globalv.video_test_path = p
        globalv.video_test = True

    def _test1_button_fired(self):
        self._set_test_image()
        self._test1()


if __name__ == '__main__':
    logging_setup('mv', use_archiver=False, use_file=False)
    t = TestAutocenter()
    t.init()
    t.configure_traits(
        view=View(UItem('test1_button'),
                  UItem('object.display_image.source_frame',
                        width=254,
                        height=254,
                        editor=ImageEditor(
                            refresh='object.display_image.refresh_needed')),
                  width=500,
                  height=300))

# ============= EOF =============================================

# class TestMVManager(MachineVisionManager):
Esempio n. 46
0
            f, s = '<h', 2

        m = 2 ** nbits - 1

        def vfunc(v):
            nd = int(math.log10(m))
            return round(v / float(m) * self.max_voltage, nd)

        return [vfunc(struct.unpack(f, resp[i:i + s])[0])
                for i in range(0, nbytes, s)]


if __name__ == '__main__':
    from pychron.core.helpers.logger_setup import logging_setup

    logging_setup('adc')
    from pychron.paths import paths

    paths.build('_dev')

    a = ProXRADC(name='ProXRADC')
    #a = MultiBankADCExpansion(name='proxr_adc')
    a.bootstrap()
    #print 'read bank', a.read_bank()
    a.read_bank(nbits=12)
    a.read_bank(1, nbits=12)
    a.read_bank(2, nbits=12)

    #print a._communicator.handle
    #a.read_device_info()
    #print 'read channel 0',a.read_channel(0, nbits=8)
Esempio n. 47
0
TEST_PARSE_XLS = False
DEBUGGING = False

# automatically disable debugging if running on a travis ci linux box.
import sys

if sys.platform != 'darwin':
    DEBUGGING = False

DBNAME = 'loader.db'

if DEBUGGING:
    from pychron.core.helpers.logger_setup import logging_setup

    logging_setup('irrad_loader')


def get_data_dir():
    op = 'pychron/entry/tests/data'
    return mget_data_dir(op)
    # if not os.path.isdir(op):
    #     op = os.path.join('.', 'data')
    # return op


def db_factory():
    path = os.path.join(get_data_dir(), DBNAME)
    db = isotope_db_factory(path)
    # from pychron.database.adapters.isotope_adapter import IsotopeAdapter
    # from pychron.database.orms.isotope.util import Base
Esempio n. 48
0
        return state

    def _load_tests(self):
        p = os.path.join(paths.root_dir, 'qa_env', 'config.yaml')
        if os.path.isfile(p):
            with open(p, 'r') as rfile:
                return yaml.load(rfile)
        else:
            self.warning_dialog('No tests. Config file at "{}" required'.format(p))

    def _do_test(self, state, test):
        self.info('doing test {}'.format(test))
        qatest = self._get_test(test)

    def _get_test(self, test):
        mod = __import__('pychron.qa.test', fromlist=[test])
        return getattr(mod, test)()


if __name__ == '__main__':
    from pychron.core.helpers.logger_setup import logging_setup
    from pychron.paths import paths

    paths.build('_dev')
    logging_setup('qa')

    qar = QARunner()
    qar.run()

# ============= EOF =============================================
Esempio n. 49
0
                #        n = len(s)
                #        if n % 2 != 0:
                #            sn = s[:n / 2 * 2]
                #        else:
                #            sn = s
                #        s = ''.join(self.states)
            self.info('states = {}'.format(s))
            return s

            #    v = ValveManager()
            #    p = os.path.join(paths.extraction_line_dir, 'valves.xml')
            #    v._load_valves_from_file(p)

    from pychron.core.helpers.logger_setup import logging_setup

    logging_setup('foo')
    f = Foo()
    for i in range(10):
        r = f.get_states()
        time.sleep(2)
        # print r, len(r)

#==================== EOF ==================================
#     def _get_system_address(self, name):
#         return next((h for k, h in self.systems.iteritems() if k == name), None)
#
#     def _load_system_dict(self):
# #        config = self.configparser_factory()
#
#         from pychron.core.helpers.parsers.initialization_parser import InitializationParser
# #        ip = InitializationParser(os.path.join(setup_dir, 'initialization.xml'))
Esempio n. 50
0
            configuration_dir_name=self.configuration_dir_name)
        return py

    def _title_default(self):
        return 'Diode Manager'

    def _control_module_manager_default(self):
        v = VueMetrixManager()  # control = self.control_module)
        return v


if __name__ == '__main__':
    from pychron.core.helpers.logger_setup import logging_setup
    from pychron.initializer import Initializer

    logging_setup('fusions diode')
    f = FusionsDiodeManager()
    f.use_video = True
    f.record_brightness = True
    ini = Initializer()

    a = dict(manager=f, name='FusionsDiode')
    ini.add_initialization(a)
    ini.run()
    #    f.bootstrap()
    f.configure_traits()

#======================= EOF ============================
#    def get_laser_amps(self):
#        '''
#        '''
Esempio n. 51
0
    r_mkdir(ldir)
    paths.log_dir = ldir
    paths.root = root


if __name__ == '__main__':

    root = os.path.dirname(__file__)
    from .helpers import add_eggs
    add_eggs(root)

    build_directories()
    from pychron.core.helpers.logger_setup import logging_setup
    from pychron.managers.remote_hardware_server_manager import RemoteHardwareServerManager

    logging_setup('server')
    s = RemoteHardwareServerManager()  # handler_klass=AppHandler)
    s.load()
    s.configure_traits()
    os._exit(0)

#    launch()
# ============= EOF ====================================
#
# def read_configuration():
#    '''
#         read the server initialization file in the initialization dir.
#
#         ex
#         [General]
#         servers= server_names
Esempio n. 52
0
if __name__ == '__main__':

    class PermutatorView(HasTraits):
        test = Button

        def _test_fired(self):
            # self.permutator.fits_permutation()
            self.permutator.ic_permutation()

        def traits_view(self):
            v = View('test')
            return v

    p = Permutator()
    p.path = './tests/data/config.yaml'
    logging_setup('perm')

    from pychron.database.isotope_database_manager import IsotopeDatabaseManager

    class Record(object):
        analysis_type = 'unknown'

        def __init__(self, u):
            self.uuid = u

    man = IsotopeDatabaseManager(bind=False, connect=False)
    db = man.db
    db.trait_set(kind='mysql',
                 host='localhost',
                 name='pychrondata_dev',
                 username='******',
Esempio n. 53
0
    def _load_tests(self):
        p = os.path.join(paths.root_dir, 'qa_env', 'config.yaml')
        if os.path.isfile(p):
            with open(p, 'r') as rfile:
                return yaml.load(rfile)
        else:
            self.warning_dialog(
                'No tests. Config file at "{}" required'.format(p))

    def _do_test(self, state, test):
        self.info('doing test {}'.format(test))
        qatest = self._get_test(test)

    def _get_test(self, test):
        mod = __import__('pychron.qa.test', fromlist=[test])
        return getattr(mod, test)()


if __name__ == '__main__':
    from pychron.core.helpers.logger_setup import logging_setup
    from pychron.paths import paths

    paths.build('_dev')
    logging_setup('qa')

    qar = QARunner()
    qar.run()

# ============= EOF =============================================
Esempio n. 54
0
#
#        return args

#    def _update_parameter_list(self, names, s, l):
#        '''
#
#        '''
#        resp = self._send_query(s, l)
#        if resp is not None:
#            args = self._parse_parameter_answers(resp, s, l)
#    #        kw = dict()
#            for n, a in zip(names, args):
#                v = int(a, 16)
#                if isinstance(n, tuple):
#                    v = n[1](v)
#                    n = n[0]
#                self.trait_set(n=v)
#            kw[n] = v
#        self.trait_set(**kw)


if __name__ == '__main__':
    from pychron.core.helpers.logger_setup import logging_setup

    logging_setup('atl')
    a = ATLLaserControlUnit(name='ATLLaserControlUnit',
                            configuration_dir_name='fusions_uv')
    a.bootstrap()
    a.laser_off()
# ============= EOF ====================================
Esempio n. 55
0
# limitations under the License.
# ===============================================================================
from pychron.hardware.core.data_helper import make_bitarray
'''
    National Control Devices
    
   http://www.controlanything.com/ 
   
   The Complete ProXR Command Set:
   http://www.controlanything.com/Relay/Device/A0010
   http://assets.controlanything.com/manuals/ProXR.pdf
'''

from pychron.paths import paths
from pychron.core.helpers.logger_setup import logging_setup
logging_setup('prox')
paths.build('_prox')

# ============= enthought library imports =======================
# ============= standard library imports ========================
# ============= local library imports  ==========================
from pychron.hardware.ncd import ON_MAP, OFF_MAP, STATE_MAP
from pychron.hardware.ncd.ncd_device import NCDDevice


class ProXR(NCDDevice):
    '''
        implement the actuator interface
        open_channel
        close_channel
        get_channel_state