Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
vpicouet opened this issue Nov 19, 2020 · 1 comment
Open

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

vpicouet opened this issue Nov 19, 2020 · 1 comment

Comments

@vpicouet
Copy link

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

@glentner
Copy link
Owner

Hi Vincent.

I think the concept in general is not a bad idea. Indeed, this AutoGUI will fit whatever data you pass. Some kind of selector tool could conceivably be added to the interface.

The idea here though is that you can plot whatever you like (including higher resolution, full range datasets) and then over-plot a smaller, more targeted sample over a shorter range, and that is what you pass into the AutoGUI.

For 1D data like this, I think a cleaner approach, instead of taking the data viewable in the window, would instead be to add in two vertical range-based line selectors. A vertical line at the "start" and the vertical line at the "stop" that you can drag to a preferred x value, and it would display the x value next to the line as an annotation while you moved it.

Your suggestion is interesting, and a really simple implementation. For now, I don't know that it's a prudent move because it significantly alters the behavior of the tool in a way that would likely be non-intuitive to many people, especially considering I don't yet have any real documentation or user guide in place.

If you want to work on some of these things, I would be happy to review and possibly merge a pull request though. I unfortunately don't have much spare time these days to work on my hobby projects like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants