simonsobs / fgspectra

Foreground SED and power spectrum library for building cross frequency power spectrum models
BSD 3-Clause "New" or "Revised" License
8 stars 7 forks source link

Accessing parameters #18

Closed mabitbol closed 5 years ago

mabitbol commented 5 years ago

I'm wondering if we can add support to the cross spectrum class that will allow us to see and access the SED and power spectrum parameters easily, like how it is done in FGBuster.

dpole commented 5 years ago

Yes, this is something we should decide about asap in order to freeze the high level API. The easiest option I see is to force all the parameters of the __call__ methods to be keyword arguments and change the default value at construction time, whenever we want to fix any of them. The mechanism would be similar to functools.partial (or we could use directly that library)

Pros: easy to implement, transparent, foolproof (I think, despite my explanation might be unclear) Cons: Everything is a keyword argument, which means extra typing for the users

Other ideas?

dpole commented 5 years ago

20 address this following my previous proposal...but it was not as easy as expected

dpole commented 5 years ago

With #20 you can now print the objects to get an insight on it, including defaults parameters. About setting parameters, you can access the defaults with the Model.defaults attribute, change them and set the with Model.set_defaults. Defaults can be also set at construction time.