peng-lab / BaSiCPy

MIT License
62 stars 20 forks source link

Added predict method, does not include baseline estimation #29

Closed Nicholas-Schaub closed 2 years ago

Nicholas-Schaub commented 2 years ago

This PR implements a simple predict function. It only uses the flatfield and darkfield components, with no baseline correction for now.

There is room for optimization here, since the unshading function always subtracts out the darkfield component. This does not alter the correctness of the output, because darkfield is initialized to zero and is left unchanged unless BaSiC.get_darkfield==True. However, subtracting 0s from each pixel likely increases the computation time, so we should change this in the future.

I also added in a __call__ function, so you can do the following:

basic = BaSiC()
basic.fit(images)

# these two lines produce the same result
corrected = basic.predict(images)
corrected = basic(images)