SWIFTSIM / emulator

The SWIFT simulation cosmological emulator (swift-emulator)
GNU Lesser General Public License v3.0
5 stars 2 forks source link

Interactive plot #46

Closed robjmcgibbon closed 1 month ago

robjmcgibbon commented 7 months ago

I added a method to allow for visualisation of the effect of varying parameter values on the emulator predictions. Maybe visualisation.py would be a better place to put it though.

Screenshot from 2024-02-06 11-45-17

I tested this by adding a single line (schecter_emulator.interactive_plot(predict_x, xlabel='Stellar mass', ylabel='dn/dlogM')) to the end of the getting started example. If you decide to merge this then I'd need to add it an example somewhere in the documentation.

The plot is pretty responsive for me when testing with two parameters. For a large emulator model this might not be the case though, as the emulator has to make a prediction every time you move the slider.

The axis limits of the plot are set by the initial values. This means that the line can move off the plot, but I think resizing the plot would make it more difficult to see the effect of varying the parameters.

It would be nice to save the plot as an html/javascript for sharing. In the past I've used the bokeh package for these kind of plots, but I didn't want to add another dependency.

robjmcgibbon commented 7 months ago

Running the formatter also edited multi_gaussian_process.py and swift.py

Moyoxkit commented 7 months ago

Just thinking about it now, just like for the parameter sweeps it might be nice to be able to give it a reference set of parameters (in case you have already done a fit for example). Not super important for when you compare with external points, but it could provide a nicer "default" comparison line

Moyoxkit commented 7 months ago

@EvgeniiChaikin maybe this is also interesting for you to look at and see if you have suggestions

robjmcgibbon commented 7 months ago

Just thinking about it now, just like for the parameter sweeps it might be nice to be able to give it a reference set of parameters (in case you have already done a fit for example). Not super important for when you compare with external points, but it could provide a nicer "default" comparison line

I've implemented that, along with the documentation changes you suggested

JBorrow commented 1 month ago

Thanks for this!