Esempio n. 1
0
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Designer per il ciclo termico."""
from misura.canon.logger import get_module_logging
logging = get_module_logging(__name__)
from .. import _
from misura.canon.csutil import next_point, decode_cool_event
from PyQt4 import QtGui, QtCore
import row
import flags
import collections


def clean_curve(dat, events=True):
    """Convert `dat` model thermal cycle to a (time,Temp) list of points.
    Include `events` or try to convert them to numerical values."""
    crv = []
    # Event-based time correction
    time_correction = 0
    for index_row, ent in enumerate(dat):
        t, T = ent[:2]
        if None in ent:
            logging.debug('Skipping row', index_row)
            continue
        if isinstance(T, basestring):
            print 'Basestring', T
            logging.debug('EVENT', index_row)
            T = str(T)
            if events:
                t += time_correction
                crv.append([t * 60, T])
# System library imports.
from PyQt4 import QtGui
from pygments import formatters, lexer, lexers, styles
from .. import _
from misura.canon.logger import get_module_logging
logging = get_module_logging(__name__)


def get_tokens_unprocessed(self, text, stack=('root',)):
    """ Split ``text`` into (tokentype, text) pairs.

        Monkeypatched to store the final stack on the object itself.
    """
    pos = 0
    tokendefs = self._tokens
    if hasattr(self, '_saved_state_stack'):
        statestack = list(self._saved_state_stack)
    else:
        statestack = list(stack)
    statetokens = tokendefs[statestack[-1]]
    while 1:
        for rexmatch, action, new_state in statetokens:
            m = rexmatch(text, pos)
            if m:
                if type(action) is lexer._TokenType:
                    yield pos, action, m.group()
                else:
                    for item in action(self, m):
                        yield item
                pos = m.end()
                if new_state is not None:
Esempio n. 3
0
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tools and plugins for Veusz, providing Misura Thermal Analysis functionality"""
import veusz.plugins as plugins
import veusz.document as document
import numpy as np
import SmoothDatasetPlugin

from misura.canon.logger import get_module_logging
logging = get_module_logging(__file__)

class CoefficientPlugin(plugins.DatasetPlugin):

    """Calculate a coefficient"""
    # tuple of strings to build position on menu
    menu = ('Misura', 'Coefficient')
    # internal name for reusing plugin later
    name = 'Coefficient'
    # string which appears in status bar
    description_short = 'Calculate coefficient'

    # string goes in dialog box
    description_full = (
        'Calculate a coefficient between a fixed start value and any subsequent value in a curve')

    def __init__(self, ds_x='', ds_y='', start=50., percent=0., factor=1., 
                 reconfigure='Stop', smooth=5, smode='X and Y', linearize=150, ds_out='coeff'):
        """Define input fields for plugin."""
        self.fields = [
            plugins.FieldDataset('ds_x', 'X Dataset', default=ds_x),
            plugins.FieldDataset('ds_y', 'Y Dataset', default=ds_y),