21cmfast/21CMMC

[Feature Req.] Composable data reader

Opened this issue · 0 comments

Is your feature request related to a problem? Please describe.

Currently, if any data is required for a given likelihood from a file, the LikelihoodBaseFile class is used, but then the user has to sub-class this class to implement their own method for actually reading the data. This causes a problem, not only because that's annoying to do, but because we can't provide any more than one default reader without causing combinatorial explosion of subclasses.

Describe the solution you'd like

It would be much more desirable to let the user pass in a reader of their own -- a callable that takes a single argument datafile (which could be a list of files), and returns an object that must match whatever checks the particular likelihood describes.

Describe alternatives you've considered

The data reader could also be a class, but it's probably much simpler just to receive any callable with the correct signature.

This will break the API. Therefore we should decide before v1.0.0