ICSM / ampere

A tool to fit the SED and spectra of dusty objects to constrain, among other things, the dust properties and mineralogy
6 stars 2 forks source link

re-write Data objects (and everything else) around dependency-injection pattern #73

Open pscicluna opened 1 year ago

pscicluna commented 1 year ago

ampere is primarily designed around a DI pattern, even though I didn't know that's what is was when we started - Model and Data instances are dependencies that are injected into the inference objects as attributes. This can be extended to 'DI all the way down', which will particularly make Data classes much more flexible. At minimum, Data classes would have the following mandatory dependences,

  1. Data-generating process (i.e. how do you go from the model to a noise-free observable);
  2. Noise model (i.e. how to you characterise the covariances of the data);
  3. Likelihood (i.e. how are data distributed given 1 and 2);

plus some optional things like plotting, reading and writing data, but it might be possible to cover some of that through clever defaults.

We can take advantage of work on this issue to also contribute to https://github.com/ICSM/ampere/issues/67 and convert everything to instances of the equivalent of Modules in one of the JAX modelling libraries, making it easier to track things, optimise code and run more advanced inference algorithms.