Skip to content

Conversation

@pbeaucage
Copy link
Contributor

Simple little implementation of #2299. Added a config option for users who might prefer the earlier behavior of pre-selecting a model.

Copy link
Member

@butlerpd butlerpd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is going to require some discussion. However some first comments (ignoring the preferences issues since that really is another PR):

  • The current implementation does not do what is really desired here. It basically implements a Create New call. Once I change a parameter and click compute a whole new set of 3 windows opens up. The point of the immediate plotting is for that first plot to be the one where the model fit also appears. In other words it should be the plot window tied to the fitpage.
  • This is attempting to implement the same for sending of multiple data and even for sending a batch fit. There is a ticket somewhere to allow multiple data sets to be sent to a single fitting plot with the data and their models all showing up together, but again this just does the same as Create New and creates a plot with all the data that is divorced from fitting.
  • Likewise the batch mode, which does not normally throw up plots (for obvious reasons I think), by default now gets a graph (not where fits go). This may in fact be a useful feature but not sure it should be tied to the same preference?
    I would suggest that maybe one should try to limit to use case 1 for starters as perhaps the biggest bang for the buck? So just implement for a single file sent to fitting. @rozyczko seems to think isolating to only single file sends to fit should be trivial but the tying to the fit panel may be trickier?

@butlerpd
Copy link
Member

and here is the issue I was thinking of ... interestingly it is a feature parity issue! #1685

…into-the-fitting-perspective' into 2299-sending-single-data-to-fitting-should-automatically-open-the-data-chart
Copy link
Member

@rozyczko rozyczko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a new attribute is not necessary. We can already differentiate between data and model/data plots.
Data plots have their plot_role property set to 0, while model plots have 1.
It's probably enough to add a plot_role check.

self._perspective().swapData(selected_items[0])
if self._perspective().name == 'Fitting':
if config.FITTING_PLOT_ON_SEND_DATA:
self.newPlot() #todo sort out where the plot should go.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this TODO explains why I get a separate data+model chart on Compute/plot.
Up to @butlerpd to decide if this is what we want the plots to behave.

p1

if self.chkSwap.isChecked():
self._perspective().swapData(selected_items[0])
if self._perspective().name == 'Fitting':
if config.FITTING_PLOT_ON_SEND_DATA:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using and to concatenate the two conditionals looks slightly better as there is less levels of indentation.
Here and in the other cases

…into-the-fitting-perspective' into 2299-sending-single-data-to-fitting-should-automatically-open-the-data-chart
@pbeaucage pbeaucage marked this pull request as draft October 29, 2022 16:03
#QtWidgets.QApplication.processEvents()
tab.showPlot()
#QtWidgets.QApplication.processEvents()
#time.sleep(2)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Playing with processEvents means there were issues with plot lifetimes? What did you observe?

#time.sleep(2)
tab._model_model.clear()
tab.cmdPlot.setEnabled(False)
tab.SASModelToQModel('porod')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you choose "porod" here, and not the currently active model?

super(FittingPreferencesWidget, self).__init__("Fitting Settings")
self.addCheckBox(title="Auto-plot data when sent to fitting perspective",
callback=config_value_setter_generator('FITTING_PLOT_ON_SEND_DATA', dtype=bool),
checked=config.FITTING_PLOT_ON_SEND_DATA) No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs porting to the new way of describing preferences

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

Successfully merging this pull request may close these issues.

Sending single data to Fitting should automatically open the Data chart

6 participants