GeoMop / MLMC

5 stars 2 forks source link

Set workdir just as sampling pool parameter #194

Open jbrezmorf opened 1 year ago

jbrezmorf commented 1 year ago

Goal: unify pool workdir and directory and file name of the HDF file of the storage. Proposal: Pass to the Sampler a factory to produce the storage. Sampler then call this factory with the workdir taken from the SamplingPool.

Basic usage is that the factory is the constructor of the storage, e.g.

class StorageHDF:
    def __intit__(filename, options=None, ...)

Sampler(storage=StorageHDF)

storage=fntools.partial(StorgageHDF(options=123)
Sampler(storage=storage)

storage=lambda f: StorgageHDF(f, options=123)
Sampler(storage=storage)

def storage(f:str):
    return StorgageHDF(f, options=123)
Sampler(storage=storage)