Ejemplo n.º 1
0
    def setup_graph(self, iso):
        self.is_good = None

        g = StackedRegressionGraph()
        g.new_plot(padding=[60, 10, 10, 40])
        if iso:
            g.new_series(iso.xs, iso.ys,
                         fit=iso.fit,
                         filter_outliers_dict=iso.filter_outliers_dict)
            g.set_x_limits(min_=0, max_=iso.xs[-1] * 1.1)
            g.set_y_title(iso.name)

        g.set_x_title('Time (s)')

        g.refresh()
        self.graph = g
Ejemplo n.º 2
0
    def setup_graph(self, iso):
        self.klass = None

        g = StackedRegressionGraph()
        g.new_plot(padding=[60, 10, 10, 40])
        if iso:
            g.new_series(iso.xs,
                         iso.ys,
                         fit=iso.fit,
                         filter_outliers_dict=iso.filter_outliers_dict)
            g.set_x_limits(min_=0, max_=iso.xs[-1] * 1.1)
            g.set_y_title(iso.name)

        g.set_x_title('Time (s)')

        g.refresh()
        self.graph = g
Ejemplo n.º 3
0
    def handle_show_iso_evo(self, obj):
        from pychron.graph.stacked_regression_graph import StackedRegressionGraph

        self.manager.load_raw_data(self.model)

        g = StackedRegressionGraph()
        for ni in obj[::-1]:
            iso = next((i for i in self.model.isotopes.itervalues() if i.name == ni.name), None)
            g.new_plot(padding=[60, 10, 10, 40])
            g.new_series(iso.xs, iso.ys,
                         fit=iso.fit,
                         filter_outliers_dict=iso.filter_outliers_dict)
            g.set_x_limits(min_=0, max_=iso.xs[-1] * 1.1)
            g.set_x_title('Time (s)')
            g.set_y_title(iso.name)

        g.refresh()
        g.window_title = '{} {}'.format(self.name, ','.join([i.name for i in obj]))
        self.manager.application.open_view(g)
Ejemplo n.º 4
0
    def handle_show_iso_evo(self, obj):
        from pychron.graph.stacked_regression_graph import StackedRegressionGraph

        self.manager.load_raw_data(self.model)

        g = StackedRegressionGraph()
        for ni in obj[::-1]:
            iso = next((i for i in self.model.isotopes.itervalues()
                        if i.name == ni.name), None)
            g.new_plot(padding=[60, 10, 10, 40])
            g.new_series(iso.xs,
                         iso.ys,
                         fit=iso.fit,
                         filter_outliers_dict=iso.filter_outliers_dict)
            g.set_x_limits(min_=0, max_=iso.xs[-1] * 1.1)
            g.set_x_title('Time (s)')
            g.set_y_title(iso.name)

        g.refresh()
        g.window_title = '{} {}'.format(self.name,
                                        ','.join([i.name for i in obj]))
        self.manager.application.open_view(g)
Ejemplo n.º 5
0
    def show_blank_time_series(self):
        g = StackedRegressionGraph(window_height=0.75)
        isotopes = self.blank_selected[0].isotopes
        keys = sort_isotopes([iso.isotope for iso in isotopes], reverse=False)
        _mi, _ma = None, None

        for k in keys:
            iso = next((i for i in isotopes if i.isotope == k))
            # print iso.analyses
            g.new_plot(padding_right=10)
            g.set_time_xaxis()
            g.set_y_title(iso.isotope)

            g.new_series([self.timestamp], [iso.value],
                         marker_size=3,
                         fit=False,
                         type='scatter',
                         marker_color='black')
            vs = iso.values
            if vs:
                ts = [vi.timestamp for vi in vs]
                _mi = min(ts)
                _ma = max(ts)
                g.new_series(ts, [vi.value for vi in vs],
                             yerror=ArrayDataSource([vi.error for vi in vs]),
                             marker_size=3,
                             fit=(iso.fit, 'SD'),
                             type='scatter',
                             marker_color='red')

        if not _mi:
            _mi, _ma = self.timestamp - 86400, self.timestamp + 86400

        g.set_x_limits(_mi, _ma, pad='0.1')
        g.refresh()

        g.set_x_title('Time', plotid=0)
        g.edit_traits()
Ejemplo n.º 6
0
    def show_blank_time_series(self):
        g = StackedRegressionGraph(window_height=0.75)
        isotopes = self.blank_selected[0].isotopes
        keys = sort_isotopes([iso.isotope for iso in isotopes], reverse=False)
        _mi, _ma = None, None

        for k in keys:
            iso = next((i for i in isotopes if i.isotope == k))
            # print iso.analyses
            g.new_plot(padding_right=10)
            g.set_time_xaxis()
            g.set_y_title(iso.isotope)

            g.new_series([self.timestamp], [iso.value],
                         marker_size=3,
                         fit=False,
                         type='scatter', marker_color='black')
            vs = iso.values
            if vs:
                ts = [vi.timestamp for vi in vs]
                _mi = min(ts)
                _ma = max(ts)
                g.new_series(ts,
                             [vi.value for vi in vs],
                             yerror=ArrayDataSource([vi.error for vi in vs]),
                             marker_size=3,
                             fit=(iso.fit, 'SD'),
                             type='scatter', marker_color='red')

        if not _mi:
            _mi, _ma = self.timestamp - 86400, self.timestamp + 86400

        g.set_x_limits(_mi, _ma, pad='0.1')
        g.refresh()

        g.set_x_title('Time', plotid=0)
        g.edit_traits()
Ejemplo n.º 7
0
def show_evolutions_factory(record_id, isotopes, show_evo=True, show_equilibration=False, show_baseline=False):
    if WINDOW_CNT > 20:
        information(None, 'You have too many Isotope Evolution windows open. Close some before proceeding')
        return

    from pychron.graph.stacked_regression_graph import StackedRegressionGraph

    if not show_evo:
        xmi = Inf
        xma = -Inf
    else:
        xmi, xma = 0, -Inf

    g = StackedRegressionGraph(resizable=True)
    g.plotcontainer.spacing = 10
    g.window_height = min(275 * len(isotopes), 800)
    g.window_x = OX + XOFFSET * WINDOW_CNT
    g.window_y = OY + YOFFSET * WINDOW_CNT

    isotopes = sort_isotopes(isotopes, reverse=False, key=lambda x: x.name)

    for i, iso in enumerate(isotopes):
        ymi, yma = Inf, -Inf

        p = g.new_plot(padding=[80, 10, 10, 40])
        g.add_limit_tool(p, 'x')
        g.add_limit_tool(p, 'y')
        g.add_axis_tool(p, p.x_axis)
        g.add_axis_tool(p, p.y_axis)

        p.y_axis.title_spacing = 50
        if show_equilibration:
            sniff = iso.sniff
            g.new_series(sniff.xs, sniff.ys,
                         type='scatter',
                         fit=None,
                         color='red')
            ymi, yma = min_max(ymi, yma, sniff.ys)
            xmi, xma = min_max(xmi, xma, sniff.xs)

        if show_evo:
            g.new_series(iso.xs, iso.ys,
                         fit=iso.fit,
                         filter_outliers_dict=iso.filter_outliers_dict,
                         color='black')
            ymi, yma = min_max(ymi, yma, iso.ys)
            xmi, xma = min_max(xmi, xma, iso.xs)

        if show_baseline:
            baseline = iso.baseline
            g.new_series(baseline.xs, baseline.ys,
                         type='scatter', fit=baseline.fit,
                         filter_outliers_dict=baseline.filter_outliers_dict,
                         color='blue')
            ymi, yma = min_max(ymi, yma, baseline.ys)
            xmi, xma = min_max(xmi, xma, baseline.xs)

        g.set_x_limits(min_=xmi, max_=xma, pad='0.025,0.05')
        g.set_y_limits(min_=ymi, max_=yma, pad='0.05', plotid=i)
        g.set_x_title('Time (s)', plotid=i)
        g.set_y_title('{} (fA)'.format(iso.name), plotid=i)

    g.refresh()
    g.window_title = '{} {}'.format(record_id, ','.join([i.name for i in reversed(isotopes)]))

    return g
Ejemplo n.º 8
0
def show_evolutions_factory(record_id,
                            isotopes,
                            show_evo=True,
                            show_equilibration=False,
                            show_baseline=False):
    if WINDOW_CNT > 20:
        information(
            None,
            'You have too many Isotope Evolution windows open. Close some before proceeding'
        )
        return

    from pychron.graph.stacked_regression_graph import StackedRegressionGraph

    if not show_evo:
        xmi = Inf
        xma = -Inf
    else:
        xmi, xma = 0, -Inf

    g = StackedRegressionGraph(resizable=True)
    g.plotcontainer.spacing = 10
    g.window_height = min(275 * len(isotopes), 800)
    g.window_x = OX + XOFFSET * WINDOW_CNT
    g.window_y = OY + YOFFSET * WINDOW_CNT

    isotopes = sort_isotopes(isotopes, reverse=False, key=lambda x: x.name)

    for i, iso in enumerate(isotopes):
        ymi, yma = Inf, -Inf

        p = g.new_plot(padding=[80, 10, 10, 40])
        g.add_limit_tool(p, 'x')
        g.add_limit_tool(p, 'y')
        g.add_axis_tool(p, p.x_axis)
        g.add_axis_tool(p, p.y_axis)

        p.y_axis.title_spacing = 50
        if show_equilibration:
            sniff = iso.sniff
            g.new_series(sniff.xs,
                         sniff.ys,
                         type='scatter',
                         fit=None,
                         color='red')
            ymi, yma = min_max(ymi, yma, sniff.ys)
            xmi, xma = min_max(xmi, xma, sniff.xs)

        if show_evo:
            g.new_series(iso.xs,
                         iso.ys,
                         fit=iso.fit,
                         filter_outliers_dict=iso.filter_outliers_dict,
                         color='black')
            ymi, yma = min_max(ymi, yma, iso.ys)
            xmi, xma = min_max(xmi, xma, iso.xs)

        if show_baseline:
            baseline = iso.baseline
            g.new_series(baseline.xs,
                         baseline.ys,
                         type='scatter',
                         fit=baseline.fit,
                         filter_outliers_dict=baseline.filter_outliers_dict,
                         color='blue')
            ymi, yma = min_max(ymi, yma, baseline.ys)
            xmi, xma = min_max(xmi, xma, baseline.xs)

        g.set_x_limits(min_=xmi, max_=xma, pad='0.025,0.05')
        g.set_y_limits(min_=ymi, max_=yma, pad='0.05', plotid=i)
        g.set_x_title('Time (s)', plotid=i)
        g.set_y_title('{} (fA)'.format(iso.name), plotid=i)

    g.refresh()
    g.window_title = '{} {}'.format(
        record_id, ','.join([i.name for i in reversed(isotopes)]))

    return g