def __init__(self, *args, **kw): super(HeadlessLoggable, self).__init__(*args, **kw) if self.logger_name: name = self.logger_name elif self.name: name = self.name else: name = self.__class__.__name__ self.logger = new_logger(name)
def _add_logger(self): ''' ''' if self.logger_name: name = self.logger_name elif self.name: name = self.name else: name = self.__class__.__name__ self.logger = new_logger(name) c = color_name_gen.next() if c in ['gray', 'silver', 'greenyellow']: c = color_name_gen.next() self.logcolor = c
def _add_logger(self): """ """ if self.logger_name: name = self.logger_name elif self.name: name = self.name else: name = self.__class__.__name__ if self.logger is None: self.logger = new_logger(name) __gloggers__[name] = self.logger c = next(color_name_gen) if c in ['gray', 'silver', 'greenyellow']: c = next(color_name_gen) self.logcolor = c
def _add_logger(self): """ """ if self.logger_name: name = self.logger_name elif self.name: name = self.name else: name = self.__class__.__name__ if self.logger is None: self.logger = new_logger(name) __gloggers__[name] = self.logger c = color_name_gen.next() if c in ['gray', 'silver', 'greenyellow']: c = color_name_gen.next() self.logcolor = c
import yaml from pychron.core.helpers.isotope_utils import extract_mass from pychron.core.helpers.logger_setup import new_logger from pychron.paths import paths from pychron.processing.analyses.analysis_view import DBAnalysisView, AnalysisView from pychron.processing.analyses.changes import FitChange, BlankChange from pychron.processing.arar_age import ArArAge #from pychron.processing.analyses.summary import AnalysisSummary #from pychron.processing.analyses.db_summary import DBAnalysisSummary from pychron.experiment.utilities.identifier import make_runid, make_aliquot_step from pychron.processing.isotope import Isotope, Blank, Baseline, Sniff from pychron.core.helpers.formatting import calc_percent_error Fit = namedtuple('Fit', 'fit filter_outliers filter_outlier_iterations filter_outlier_std_devs error_type') logger = new_logger('Analysis') class Analysis(ArArAge): #analysis_summary_klass = AnalysisSummary #analysis_summary = Instance(AnalysisSummary) analysis_view_klass = AnalysisView analysis_view = Instance(AnalysisView) labnumber = Str aliquot = Int step = Str aliquot_step_str = Str is_plateau_step = False
# ============= enthought library imports ======================= from traits.api import Str, Int, Bool, Float, Property, \ Enum, on_trait_change, CStr, Long, HasTraits, Instance from pychron.core.helpers.filetools import remove_extension from pychron.core.helpers.logger_setup import new_logger from pychron.core.helpers.strtools import csv_to_ints, to_csv_str from pychron.core.utils import alphas, alpha_to_int from pychron.experiment.automated_run.result import AutomatedRunResult, AirResult, UnknownResult, BlankResult from pychron.experiment.utilities.identifier import get_analysis_type, make_rid, make_runid, is_special, \ convert_extract_device from pychron.experiment.utilities.position_regex import XY_REGEX from pychron.experiment.utilities.repository_identifier import make_references_repository_identifier from pychron.pychron_constants import SCRIPT_KEYS, SCRIPT_NAMES, DETECTOR_IC logger = new_logger('AutomatedRunSpec') class AutomatedRunSpec(HasTraits): """ this class is used to as a simple container and factory for an AutomatedRun. the AutomatedRun does the actual work. ie extraction and measurement """ run_klass = 'pychron.experiment.automated_run.automated_run.AutomatedRun' spectrometer_manager = Instance('pychron.spectrometer.base_spectrometer_manager.BaseSpectrometerManager') result = Instance(AutomatedRunResult, ()) state = Enum('not run', 'extraction', 'measurement', 'success', 'failed', 'truncated', 'canceled', 'invalid', 'test', 'aborted')
from pychron.core.helpers.isotope_utils import sort_isotopes from pychron.core.helpers.logger_setup import new_logger from pychron.envisage.view_util import open_view from pychron.experiment.utilities.identifier import make_runid, make_aliquot_step from pychron.graph.stacked_regression_graph import ColumnStackedRegressionGraph, StackedRegressionGraph from pychron.processing.arar_age import ArArAge from pychron.processing.arar_constants import ArArConstants from pychron.processing.isotope import Isotope from pychron.pychron_constants import PLUSMINUS, NULL_STR, AR_AR Fit = namedtuple( 'Fit', 'fit ' 'filter_outliers filter_outlier_iterations filter_outlier_std_devs ' 'error_type include_baseline_error, time_zero_offset') logger = new_logger('Analysis') def min_max(a, b, vs): return min(a, vs.min()), max(b, vs.max()) OX = 50 OY = 50 XOFFSET = 25 YOFFSET = 25 WINDOW_CNT = 0 class CloseHandler(Handler): def closed(self, info, is_ok):
from numpy import hstack # ============= local library imports ========================== from pychron.processing.argon_calculations import ( calculate_F, abundance_sensitivity_correction, age_equation, calculate_decay_factor, ) from pychron.processing.arar_constants import ArArConstants from pychron.processing.isotope import Isotope, Baseline from pychron.loggable import Loggable from pychron.core.helpers.isotope_utils import sort_isotopes logger = new_logger("ArArAge") # arar_constants = None class ArArAge(Loggable): j = Either(Variable, AffineScalarFunc) irradiation = Str irradiation_level = Str irradiation_pos = Str irradiation_time = Float irradiation_label = Property(depends_on="irradiation, irradiation_level,irradiation_pos") chron_segments = List interference_corrections = Dict production_ratios = Dict
# ============= enthought library imports ======================= from traits.api import Str, Int, Bool, Float, Property, \ Enum, on_trait_change, CStr, Long, HasTraits, Instance from pychron.core.helpers.filetools import remove_extension from pychron.core.helpers.logger_setup import new_logger from pychron.core.helpers.strtools import csv_to_ints, to_csv_str from pychron.experiment.automated_run.result import AutomatedRunResult, AirResult, UnknownResult, BlankResult from pychron.experiment.utilities.identifier import get_analysis_type, make_rid, make_runid, is_special, \ convert_extract_device from pychron.experiment.utilities.position_regex import XY_REGEX from pychron.experiment.utilities.repository_identifier import make_references_repository_identifier from pychron.pychron_constants import SCRIPT_KEYS, SCRIPT_NAMES, ALPHAS, DETECTOR_IC logger = new_logger('AutomatedRunSpec') class AutomatedRunSpec(HasTraits): """ this class is used to as a simple container and factory for an AutomatedRun. the AutomatedRun does the actual work. ie extraction and measurement """ run_klass = 'pychron.experiment.automated_run.automated_run.AutomatedRun' result = Instance(AutomatedRunResult, ()) state = Enum('not run', 'extraction', 'measurement', 'success', 'failed', 'truncated', 'canceled', 'invalid', 'test', 'aborted') skip = Bool(False)
from ConfigParser import ConfigParser from copy import copy import os #============= local library imports ========================== from pychron.processing.argon_calculations import calculate_F, abundance_sensitivity_correction, age_equation, \ calculate_decay_factor from pychron.processing.arar_constants import ArArConstants from pychron.processing.isotope import Isotope, Baseline from pychron.loggable import Loggable from pychron.core.helpers.isotope_utils import sort_isotopes from pychron.core.helpers.logger_setup import new_logger from pychron.paths import paths from pychron.pychron_constants import ARGON_KEYS logger = new_logger('ArArAge') # arar_constants = None class ArArAge(Loggable): j = Either(Variable, AffineScalarFunc) irradiation = Str irradiation_level = Str irradiation_pos = Str irradiation_time = Float production_name = Str irradiation_label = Property(depends_on='irradiation, irradiation_level,irradiation_pos') chron_segments = List chron_dosages = List
# ============= local library imports ========================== from pychron.core.helpers.filetools import remove_extension from pychron.core.helpers.logger_setup import new_logger from pychron.experiment.utilities.identifier import ( get_analysis_type, make_rid, make_runid, is_special, convert_extract_device, ) from pychron.experiment.utilities.position_regex import XY_REGEX from pychron.pychron_constants import SCRIPT_KEYS, SCRIPT_NAMES, ALPHAS logger = new_logger("AutomatedRunSpec") class AutomatedRunSpec(HasTraits): """ this class is used to as a simple container and factory for an AutomatedRun. the AutomatedRun does the actual work. ie extraction and measurement """ state = Enum( "not run", "extraction", "measurement", "success", "failed", "truncated",
from traits.api import HasTraits, Dict, Property, Instance, Float, Str, List, Either from pychron.core.helpers.logger_setup import new_logger from pychron.paths import paths from pychron.pychron_constants import ARGON_KEYS #============= standard library imports ======================== from uncertainties import ufloat, Variable, AffineScalarFunc from numpy import hstack #============= local library imports ========================== from pychron.processing.argon_calculations import calculate_F, abundance_sensitivity_correction, age_equation, calculate_decay_factor from pychron.processing.arar_constants import ArArConstants from pychron.processing.isotope import Isotope, Baseline from pychron.loggable import Loggable from pychron.core.helpers.isotope_utils import sort_isotopes logger=new_logger('ArArAge') # arar_constants = None class ArArAge(Loggable): j = Either(Variable, AffineScalarFunc) irradiation = Str irradiation_level = Str irradiation_pos = Str irradiation_time = Float irradiation_label = Property(depends_on='irradiation, irradiation_level,irradiation_pos') chron_segments = List interference_corrections = Dict production_ratios = Dict
context = {'analysis_type': 'blank' if 'blank' in name else 'unknown'} task.execute_script(name, root, delay_start=1, on_completion=lambda: manager.info(info('Finished Procedure "{}"'.format(name))), context=context) def procedure_action(name, application): a = ProcedureAction(id='procedures.action.{}'.format(name), name=name.capitalize(), application=application, script_path=os.path.join(paths.procedures_dir, name)) return lambda: a logger = new_logger('ExtractionLinePlugin') class ExtractionLinePlugin(BaseTaskPlugin): id = 'pychron.extraction_line' # manager = Instance(ExtractionLineManager) def _my_task_extensions_default(self): ex = [TaskExtension(actions=[SchemaAddition(id='refresh_canvas', factory=RefreshCanvasAction, path='MenuBar/tools.menu')])] if self.application.get_plugin('pychron.pyscript.plugin'): actions = [] for f in list_directory2(paths.procedures_dir, extension='.py', remove_extension=True): actions.append(SchemaAddition(id='procedure.{}'.format(f),
# limitations under the License. #=============================================================================== #============= enthought library imports ======================= from envisage.core_plugin import CorePlugin from envisage.api import Plugin #============= standard library imports ======================== #============= local library imports ========================== from pyface.message_dialog import warning from pychron.displays.gdisplays import gTraceDisplay from pychron.envisage.tasks.tasks_plugin import myTasksPlugin from pychron.core.helpers.logger_setup import new_logger from pychron.logger.tasks.logger_plugin import LoggerPlugin from pychron.initialization_parser import InitializationParser logger = new_logger('launcher') try: from pychron.updater.tasks.update_plugin import UpdatePlugin except ImportError: logger.warning('Git is required to use UpdatePlugin') UpdatePlugin=None PACKAGE_DICT = dict( ExperimentPlugin='pychron.experiment.tasks.experiment_plugin', LoadingPlugin='pychron.loading.loading_plugin', ExtractionLinePlugin='pychron.extraction_line.tasks.extraction_line_plugin', VideoPlugin='pychron.image.tasks.video_plugin', # CanvasDesignerPlugin='pychron.canvas.plugins.canvas_designer_plugin',
from traits.api import List, on_trait_change from envisage.plugin import Plugin #============= standard library imports ======================== import os from git import Repo #============= local library imports ========================== from pychron import version from pychron.applications.util.installer import Builder from pychron.core.helpers.filetools import to_bool from pychron.core.helpers.logger_setup import new_logger from pychron.loggable import confirmation_dialog from pychron.paths import paths, r_mkdir from pychron.updater.tasks.update_preferences import UpdatePreferencesPane logger = new_logger('UpdatePlugin') def gen_commits(log): def _gen(): lines=iter(log.split('\n')) commit=None while 1: try: if not commit: commit=lines.next() author=lines.next() date=lines.next() message=[] while 1: line=lines.next()
# limitations under the License. # =============================================================================== # ============= enthought library imports ======================= # ============= standard library imports ======================== # ============= local library imports ========================== from traits.has_traits import MetaHasTraits from pychron.core.helpers.logger_setup import new_logger from pychron.core.helpers.strtools import camel_case, to_list REGISTRY = {} FUNC_REGISTRY = {} logger = new_logger('DeviceFunctionRegistry') class DeviceFunctionRegistry(object): def __init__(self, name=None, camel_case=False, postprocess=None): self.postprocess = postprocess self.name = name self.camel_case = camel_case def __call__(self, func): name = self.name if name is None: name = func.func_name if self.camel_case: name = camel_case(name)
# See the License for the specific language governing permissions and # limitations under the License. # =============================================================================== # ============= enthought library imports ======================= # ============= standard library imports ======================== # ============= local library imports ========================== from traits.has_traits import MetaHasTraits from pychron.core.helpers.logger_setup import new_logger from pychron.core.helpers.strtools import camel_case REGISTRY = {} FUNC_REGISTRY = {} logger = new_logger('DeviceFunctionRegistry') class DeviceFunctionRegistry(object): def __init__(self, name=None, camel_case=False, postprocess=None): self.postprocess = postprocess self.name = name self.camel_case = camel_case def __call__(self, func): name = self.name if name is None: name = func.func_name if self.camel_case: name = camel_case(name)
from traits.api import List, on_trait_change from envisage.plugin import Plugin #============= standard library imports ======================== import os from git import Repo #============= local library imports ========================== from pychron import version from pychron.applications.util.installer import Builder from pychron.core.helpers.filetools import to_bool from pychron.core.helpers.logger_setup import new_logger from pychron.loggable import confirmation_dialog from pychron.paths import paths, r_mkdir from pychron.updater.tasks.update_preferences import UpdatePreferencesPane logger = new_logger('UpdatePlugin') def gen_commits(log): def _gen(): lines = iter(log.split('\n')) commit = None while 1: try: if not commit: commit = lines.next() author = lines.next() date = lines.next() message = [] while 1: