SWIFTSIM / emulator

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

[JOSS review] Possible bug in plot_model #33

Closed JDonaldM closed 2 years ago

JDonaldM commented 2 years ago

Part of JOSS review.

I have been going through the Analysis tools examples and encountered the following error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Input In [9], in <cell line: 1>()
----> 1 model_parameters.plot_model(model_specification)

File ~/anaconda3/envs/JOSSrev3/lib/python3.8/site-packages/swiftemulator/backend/model_parameters.py:190, in ModelParameters.plot_model(self, model_specification, filename, corner_kwargs)
    187 if corner_kwargs is None:
    188     corner_kwargs = {}
--> 190 corner.corner(
    191     xs=corner_data,
    192     labels=model_specification.parameter_printable_names,
    193     range=model_specification.parameter_limits,
    194     plot_contours=False,
    195     plot_datapoints=True,
    196     plot_density=False,
    197     data_kwargs={"alpha": 1.0},
    198     **corner_kwargs,
    199 )
    201 if filename is None:
    202     plt.show()

TypeError: corner() missing 1 required positional argument: 'data'

I can achieve the desired plot is I change line 191 to pass corner_data as a positional argument rather than a keyword argument, but I'm not familiar enough with corner to know if there is a reason for passing corner_data as a keyword argument.

P.S. apologies if this issue appears more than once, there seemed to be an issue with GitHub service today!

Moyoxkit commented 2 years ago

Hey @JDonaldM,

Thanks for the comment, this was indeed a problem. the positional argument "xs" stems from an older version of corner and has since then been replaced by "data". In order to make the plotting work with both versions, it is now passed as a positional argument.

This should now be fixed in the latest master.