Esempio n. 1
0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ===============================================================================

# ============= enthought library imports =======================
from chaco.ticks import AbstractTickGenerator
from numpy import array
# ============= standard library imports ========================
# ============= local library imports  ==========================
from pychron.experiment.utilities.identifier import ANALYSIS_MAPPING_INTS, \
    ANALYSIS_MAPPING_UNDERSCORE_KEY

TICKS = array(sorted(ANALYSIS_MAPPING_INTS.values()))


class StaticTickGenerator(AbstractTickGenerator):
    def get_ticks(self, *args, **kw):
        return TICKS


KEYS = [
    v[0] for v in sorted(ANALYSIS_MAPPING_INTS.items(), key=lambda x: x[1])
]
TICK_KEYS = [ANALYSIS_MAPPING_UNDERSCORE_KEY[v] for v in KEYS]


def tick_formatter(x):
    try:
Esempio n. 2
0
from enable.tools.drag_tool import DragTool
from numpy import array, where
from traits.api import HasTraits, Instance, List, Int, Bool, on_trait_change, Button, Str, Any, Float, Event
from traitsui.api import View, Controller, UItem, HGroup, VGroup, Item, spring

from pychron.core.helpers.iterfuncs import groupby_key
from pychron.experiment.utilities.identifier import ANALYSIS_MAPPING_INTS
from pychron.graph.graph import Graph
from pychron.graph.tools.analysis_inspector import AnalysisPointInspector
from pychron.graph.tools.point_inspector import PointInspectorOverlay
from pychron.graph.tools.rect_selection_tool import RectSelectionTool, RectSelectionOverlay
from pychron.pychron_constants import BLANK_TYPES

REVERSE_ANALYSIS_MAPPING = {
    v: k.replace('_', ' ')
    for k, v in ANALYSIS_MAPPING_INTS.items()
}


def get_analysis_type(x):
    return REVERSE_ANALYSIS_MAPPING[math.floor(x)]


def analysis_type_func(analyses, mapping, offset=True):
    """
    convert analysis type to number

    if offset is True
    use analysis_mapping_ints to convert atype to integer
    then add a fractional value to indicate position in list
    e.g first unknown 1, second unknown 1.1
Esempio n. 3
0
from traitsui.api import View, Controller, UItem, HGroup, CheckListEditor, VGroup, Item, HSplit
from chaco.tools.api import RangeSelection, RangeSelectionOverlay
from chaco.scales.api import CalendarScaleSystem
from chaco.scales_tick_generator import ScalesTickGenerator
from chaco.tools.broadcaster import BroadcasterTool
# ============= standard library imports ========================
from numpy import array
import math
# ============= local library imports  ==========================
from pychron.graph.graph import Graph
from pychron.processing.plotters.series.ticks import tick_formatter, StaticTickGenerator, TICKS
from pychron.experiment.utilities.identifier import ANALYSIS_MAPPING_INTS, ANALYSIS_MAPPING
from pychron.graph.tools.analysis_inspector import AnalysisPointInspector
from pychron.graph.tools.point_inspector import PointInspectorOverlay

REVERSE_ANALYSIS_MAPPING = {v: k.replace('_', ' ') for k, v in ANALYSIS_MAPPING_INTS.items()}


def get_analysis_type(x):
    return REVERSE_ANALYSIS_MAPPING[math.floor(x)]


def analysis_type_func(analyses, offset=True):
    """
    convert analysis type to number

    if offset is True
    use analysis_mapping_ints to convert atype to integer
    then add a fractional value to indicate position in list
    e.g first unknown 1, second unknown 1.1
    fractional value is normalized to 1 so that there is no overlap
Esempio n. 4
0
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ===============================================================================

# ============= enthought library imports =======================
from __future__ import absolute_import
from chaco.ticks import AbstractTickGenerator
from numpy import array
# ============= standard library imports ========================
# ============= local library imports  ==========================
from pychron.experiment.utilities.identifier import ANALYSIS_MAPPING_INTS, \
    ANALYSIS_MAPPING_UNDERSCORE_KEY

TICKS = array(sorted(ANALYSIS_MAPPING_INTS.values()))


class StaticTickGenerator(AbstractTickGenerator):
    def get_ticks(self, *args, **kw):
        return TICKS


KEYS = [v[0] for v in sorted(list(ANALYSIS_MAPPING_INTS.items()), key=lambda x: x[1])]
TICK_KEYS = [ANALYSIS_MAPPING_UNDERSCORE_KEY[v] for v in KEYS]


def tick_formatter(x):
    try:
        v = TICK_KEYS[int(x)]
    except IndexError: