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

Slider min and max values restrictions / Save values of the adjust parameters pop up window #16

Open
Clement-Nicollet opened this issue Feb 23, 2024 · 8 comments
Labels
enhancement New feature or request

Comments

@Clement-Nicollet
Copy link

Hi, I have been trying to use the app on my EIS data and I really like it so far but two things would make it much better in my opinion.
After loading the data, in the fitting tab I can easily create my equivalent circuit (love the node editor type feature!), but when it comes to adjusting the initial parameters there are two main issues:

  • The min and max values of the sliders are restricting the value we want to input, which is annoying if the said value is out of the slider’s range, because we have to manually change two values (slider min/max and input value). For example, I usually work on small resistances (less than 1 ohm) and the slider min for R is 100 Ohm. I really like the slider feature, it is a nice way to see how one parameter influences the impedance, but this restriction makes the fitting procedure painful. Is there a way to change the code so that the min and max of the sliders are not restrictive? At least they could match the min and max of the circuit element itself? A suggestion would be to have two other tabs on the slider for min and max that the user can move dynamically? Or that if we input a value that is out of the slider's range, it automatically updates the min (or max) value of the slider to match the input?
  • The second problem is that the “adjust parameter” window reinitializes to default values every time we open it. For example, if I input all my initial values, hit 'accept' and then go on with performing the fit, if for some reasons the fit is not good and I want to tweak some parameters to start over I can't because all the values are back to default. It would be great to have our initial parameters saved somehow so we can retry the fitting procedure several times without having to start from scratch each time.

I am not sure how hard those two suggestions would be to implement, but it is really what keeps me from using the app full time and finally ditch Zview for good!

@Clement-Nicollet Clement-Nicollet added the enhancement New feature or request label Feb 23, 2024
@Clement-Nicollet Clement-Nicollet changed the title save previous starting values in the fitting tab/ adjust parameters pop up window Slider min and max values restrictions / Save values of the adjust parameters pop up window Feb 23, 2024
@vyrjana
Copy link
Owner

vyrjana commented Feb 26, 2024

First issue

I've been meaning to get around to updating the Adjust parameters window to make it more convenient to use. The tricky part about using sliders is that the range of values must be reasonable or else each step will correspond to a large change in the value (e.g., 1 step could cause the value to go from 1000 to 5000). So the minimum and maximum cannot be too far apart (e.g., resistors have 0 ohm as the lower limit and no upper limit, which is not a reasonable or feasible range for a slider). Alternatively, the slider would have to be very wide to handle a large range. My initial approach, which is what is currently available in the latest public version, was to try to define the minimum and maximum values for the slider based on the initial value in such a way that the range of the slider is not too big (e.g., a 1000 ohm initial value results in a 100 ohm minimum and a 2000 ohm maximum).

The latest iteration of the GUI that I'm testing out has the following widgets (and the inputs and checkboxes for the lower and upper limits during fitting):

  • An input field that shows the initial value in scientific notation (e.g., 2.56e-5) on the first row.
  • The second row splits up the the initial value represented as m×10^n into a slider corresponding to log m (ranging from 0 to 3) and a drop-down list for selecting n (ranging from -30 to 30 in increments of 3, which would mean steps corresponding to SI prefixes). The example (2.56e-5) would correspond to something like log m = 1.408239965 on the slider and n = -6 (i.e., micro) on the drop-down list.

Typing a value into the input field updates the slider and the drop-down list on the second row, and moving the slider or selecting another SI prefix updates the input field. Making the slider represent log m might seem odd at first, but the step sizes end up being more practical. The numerical value of the slider is hidden so that it doesn't distract or confuse the user. Below is a screenshot I just took.

example

Any comments regarding this new approach?

You mentioned that you typically work with small resistances. One of the items on my list of things to add is a window where the user can change the default values of circuit elements (e.g., the default resistance could be set to 0.5 ohm).

Second issue

When you say that re-opening the Adjust parameters window resets the values back to their default values, do you mean that, e.g., a resistance is a) reset to the default 1000 ohm or b) reset to the value that you set it to before performing the fit (i.e., instead of the fitted value)? Or did you mean something else?

@Clement-Nicollet
Copy link
Author

First Issue

So for the slider I apologize but I was doing it wrong. I did not see that the values for each component could be initialized in the circuit editor. With the initialization I think the slider range is plenty good as is.
Nevertheless, it makes me think that perhaps having to type the initial values inside the circuit editor window in not the best. That is because we can't see what the input value does to the diagram until we hit accept. Maybe it would be more ergonomic to merge the "adjust parameter" window and the "circuit editor" windows into one?
In the same line of comments, it feels odd that the initialized diagram (before fitting but after editing the circuit and adjusting the parameters) does not shows in the main window (in the fitting tab). Would it be possible to show the intialized diagram (as it appears in the "adjust parameter" window) on the graph of the main window?

Second Issue

What I meant is that the "adjust parameters" window is not updated with the fitting results. Most of the time, we would want to be able to try various combinations of parameters, fix some, etc. to yield the best fit through trial and error. This is much easier if we can run the fit once, then tweak some parameters (starting from the fit results), and run the fit again. Do you think it is possible to fetch the fitted values and update the intitial values in the adjust parameters window for a subsequent fit?

@vyrjana
Copy link
Owner

vyrjana commented Mar 4, 2024

First issue

I agree regarding the first point and I'm working on merging the Circuit editor and Adjust parameters windows. I'm not convinced about the second point though. The circuit preview and the plots in the Fitting tab are there to show past results rather than reflect to the current settings.

Second issue

The work-in-progress update includes an Apply fitted values as initial values button just below the Parameters table when viewing a previously performed fit, which does what you are asking for albeit it requires an extra step each time. However, I could also implement automatic updating of the circuit in the circuit editor window when a fit is successfully completed, which would remove the extra step. The button should still prove useful (e.g., if the user reopens the program and wants to restore a previously fitted circuit).

@Clement-Nicollet
Copy link
Author

OK for the responses of the first point, looking forward to testing the merged window.
For the second point I think that a button is actually better than an automatic update, since it gives the user a choice of accepting the fitting results. This would prove useful if the fit messes up for any reason.

@vyrjana
Copy link
Owner

vyrjana commented Mar 4, 2024

Merging the two windows will take a while to do since it makes the management of the state more complicated. At the moment, the implementation of the Adjust parameters window does not need to worry about the circuit changing suddenly when it is a separate window. The new implementation should ideally be able to handle adding/removing elements to/from the circuit without, e.g., resetting the parameters of any other elements in that circuit.

I already implemented the automatic updating, but I can easily revert that. It might be, as you stated, better to make the process of updating the initial values an explicit choice that requires an action by the user rather than doing it by default. The old Apply settings button will still continue to exist and can be used to revert the updated initial values.

You can copy the CDC - extended output of a fit result and paste it into the CDC input in the Fitting tab in order to update the initial values in the current public version. It isn't as convenient or obvious as a single button with an appropriate label, but it can be done already.

@vyrjana
Copy link
Owner

vyrjana commented Aug 30, 2024

I've been busy working on the next version of pyimpspec and a related article, but both of those have now been released and I'm now working on finishing up version 5.0.0 of DearEIS.

The ability to adjust parameters is now included in the Circuit editor window as a Parameters tab that appears once the circuit defined in the Diagram tab is valid. The circuit editing has also been updated a bit. Different types of elements are now listed to the left of the node editor and a new node can be added by either clicking on a type of element or by dragging a type of element onto the node editor. There is also a button for rearranging/tidying up the nodes in case they end up looking like a jumbled mess while connecting nodes that are spread around the node editor.

@vyrjana
Copy link
Owner

vyrjana commented Sep 3, 2024

Version 5.0.0 is now available.

@Clement-Nicollet
Copy link
Author

Hi Thank you for all your efforts! I will upgrade to 5.0.0 and give it a try as soon as I can and give you my feedback.

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

No branches or pull requests

2 participants