Skip to content

Updating data when fitting on a part of the plot #5

@vpicouet

Description

@vpicouet

Hello Geoffrey!
I was thinking about a way to improve the fitting with your tool.
Indeed, what can be annoying is that when you have loaded some points you are obliged to fit them...
What do you think about fitting only the points that are displayed on the plot (taking into account the xlim/ylim of the figure).
This would mean that you can zoom on the part of the plot that you want to fit but also zoom out if you want to use again the whole dataset... in this way it is just a new feature that can not be harmfulll.

A naive way to implement it is just to add to modify change the line self.model.fit(*self.data) by the following in the autoGUI class.

What do you think about adding that?

    def __fit_button_on_clicked(self, event):
        """Action to take when the 'Fit' button is pressed."""
        # call the model.fit with data
        axis = self.figure.axes[0]
        mask = (self.data[0]>axis.get_xlim()[0]) & (self.data[0]<axis.get_xlim()[1]) & (self.data[1]>axis.get_ylim()[0]) & (self.data[1]<axis.get_ylim()[1])
        xdata = self.data[0][mask]
        ydata = self.data[1][mask]
        self.model.fit(xdata,ydata)
#        self.model.fit(*self.data)
        self.__update_graph()
        self.__create_sliders(self.active_model.label)

Best

Vincent

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions