Beispiel #1
0
    def setup(self, parent):
        """
        Creates all the controls in the panel
        """
        super(XYSeriesFittingControls, self).setup(parent)

        data_selection_static_sizer = wx.StaticBoxSizer(
            wx.StaticBox(self, wx.ID_ANY, 'Data selection'), wx.VERTICAL)

        self.selection_panel = data_selection.DataRangeSelectionPanel(
            self, self.series)

        data_selection_static_sizer.Add(self.selection_panel, 1, wx.EXPAND)
        self.Add(data_selection_static_sizer,
                 0,
                 wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL | wx.ALL,
                 border=5)

        fit_type_static_sizer = wx.StaticBoxSizer(
            wx.StaticBox(self, wx.ID_ANY, 'Fitting'), wx.VERTICAL)

        self.fit_type = wx.Choice(
            self,
            wx.ID_ANY,
            choices=[ft.name for ft in fitting.get_fitting_tools()])
        fit_type_static_sizer.Add(self.fit_type, 1, wx.ALIGN_RIGHT)
        fit_button = wx.Button(self, -1, "Fit")
        fit_type_static_sizer.Add(fit_button, 0,
                                  wx.ALIGN_BOTTOM | wx.ALIGN_CENTER_HORIZONTAL)
        self.Add(fit_type_static_sizer,
                 0,
                 wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL | wx.ALL,
                 border=5)

        wx.EVT_BUTTON(self, fit_button.GetId(), self.on_fit)
        wx.EVT_CHOICE(self, self.fit_type.GetId(), self.on_tool_choice)

        stats_static_sizer = wx.StaticBoxSizer(
            wx.StaticBox(self, wx.ID_ANY, 'Statistics'), wx.VERTICAL)
        self.samples_txt = wx.StaticText(self, wx.ID_ANY, "\tNum. Samples:")
        self.mean_txt = wx.StaticText(self, wx.ID_ANY, "\tMean:")
        self.stddev_txt = wx.StaticText(self, wx.ID_ANY, "\tStd. Dev.:")
        self.min_txt = wx.StaticText(self, wx.ID_ANY, "\tMin. Value:")
        self.max_txt = wx.StaticText(self, wx.ID_ANY, "\tMax. Value:")
        stats_static_sizer.Add(self.samples_txt, 0, wx.ALIGN_LEFT)
        stats_static_sizer.Add(self.mean_txt, 0, wx.ALIGN_LEFT)
        stats_static_sizer.Add(self.stddev_txt, 0, wx.ALIGN_LEFT)
        stats_static_sizer.Add(self.min_txt, 0, wx.ALIGN_LEFT)
        stats_static_sizer.Add(self.max_txt, 0, wx.ALIGN_LEFT)
        self.calc_button = wx.Button(self, wx.ID_ANY, "Calculate")
        stats_static_sizer.Add(self.calc_button, 0, wx.ALIGN_CENTER_HORIZONTAL)
        self.Add(stats_static_sizer,
                 0,
                 wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL | wx.ALL,
                 border=5)

        wx.EVT_BUTTON(self, self.calc_button.GetId(), self.on_calculate)

        self.span = None
Beispiel #2
0
 def on_fit(self, evnt):
     
     mask = self.selection_panel.get_selection()
     selected_idxs = numpy.where(mask)
     raw_x, raw_y = self.series.get_data()
     
     fitting_tool = fitting.get_fitting_tools()[self.__current_tool_idx]
     
     fit_x_data, fit_y_data, fit_params = fitting_tool.fit(raw_x[selected_idxs], 
                                                           raw_y[selected_idxs])
     
     FitDataSeries(self.series, fit_x_data, fit_y_data, fit_params)
     self.series.update()
Beispiel #3
0
    def on_fit(self, evnt):

        mask = self.selection_panel.get_selection()
        selected_idxs = numpy.where(mask)
        raw_x, raw_y = self.series.get_data()

        fitting_tool = fitting.get_fitting_tools()[self.__current_tool_idx]

        fit_x_data, fit_y_data, fit_params = fitting_tool.fit(
            raw_x[selected_idxs], raw_y[selected_idxs])

        FitDataSeries(self.series, fit_x_data, fit_y_data, fit_params)
        self.series.update()
Beispiel #4
0
 def setup(self, parent):
     """
     Creates all the controls in the panel
     """
     super(XYSeriesFittingControls, self).setup(parent)
     
     data_selection_static_sizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, 'Data selection'), wx.VERTICAL)
     
     self.selection_panel = data_selection.DataRangeSelectionPanel(self, self.series)
     
     data_selection_static_sizer.Add(self.selection_panel,1, wx.EXPAND)
     self.Add(data_selection_static_sizer, 0, wx.EXPAND|wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, border=5)
     
     fit_type_static_sizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, 'Fitting'), wx.VERTICAL)
     
     self.fit_type = wx.Choice(self, wx.ID_ANY, choices=[ft.name for ft in fitting.get_fitting_tools()])
     fit_type_static_sizer.Add(self.fit_type,1, wx.ALIGN_RIGHT)
     fit_button = wx.Button(self, -1, "Fit")
     fit_type_static_sizer.Add(fit_button, 0, wx.ALIGN_BOTTOM | wx.ALIGN_CENTER_HORIZONTAL)
     self.Add(fit_type_static_sizer, 0, wx.EXPAND|wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, border=5)
     
     wx.EVT_BUTTON(self, fit_button.GetId(), self.on_fit)
     wx.EVT_CHOICE(self, self.fit_type.GetId(), self.on_tool_choice)
     
     stats_static_sizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, 'Statistics'), wx.VERTICAL)
     self.samples_txt = wx.StaticText(self, wx.ID_ANY, "\tNum. Samples:")
     self.mean_txt = wx.StaticText(self, wx.ID_ANY, "\tMean:")
     self.stddev_txt = wx.StaticText(self, wx.ID_ANY, "\tStd. Dev.:")
     self.min_txt = wx.StaticText(self, wx.ID_ANY, "\tMin. Value:")
     self.max_txt = wx.StaticText(self, wx.ID_ANY, "\tMax. Value:")
     stats_static_sizer.Add(self.samples_txt, 0, wx.ALIGN_LEFT)
     stats_static_sizer.Add(self.mean_txt, 0, wx.ALIGN_LEFT)
     stats_static_sizer.Add(self.stddev_txt, 0, wx.ALIGN_LEFT)
     stats_static_sizer.Add(self.min_txt, 0, wx.ALIGN_LEFT)
     stats_static_sizer.Add(self.max_txt, 0, wx.ALIGN_LEFT)
     self.calc_button = wx.Button(self, wx.ID_ANY, "Calculate")
     stats_static_sizer.Add(self.calc_button, 0, wx.ALIGN_CENTER_HORIZONTAL)
     self.Add(stats_static_sizer, 0, wx.EXPAND|wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, border=5)
     
     wx.EVT_BUTTON(self, self.calc_button.GetId(), self.on_calculate)
     
     self.span = None