Closed bkloppenborg closed 11 years ago
Remember, when liboi simulates the flux, it simply adds up the pixel brightness levels. It does not know anything about the intrinsic brightness. We need to add some normalization information to the data so chi values are computed correctly.
The above solution is a solution, but I think the following is better. Lets completely abstract away the types of data from the minimizer's knowledge. This way, the minimizer can simply call GetChi()
(which would return the error function (x_i - x(theta)) / sigma_i
) and a GetError()
function (which would return an array of sigma_i
's). Then, the minimizer would be responsible for forming its own cost function (i.e. chi-squared, log_evidence).
In this scheme the public functions of the CL_GLThread would be:
GetChi()
GetChi(data_type)
GetChi(data_type, data_id)
GetErrors()
GetErrors(data_type)
GetErrors(data_type, data_id)
ModelAdd(...)
ModelDelete(...)
ModelsSetTime(...)
ModelsSetParams(...)
ModelsRender(framebuffer_target)
The CL_GLThread would probably just be a container object holding the models, data containers (IO, photometric, RV, polarization, etc.) and having exclusive access to OpenGL. The data containers would be responsible for evaluating GetChi according to the data they store. This means they will need to hold their own OpenGL, liboi, and/or other memory objects.
Access to the models will have forced serialization via. a std::recursive_mutex. This way once an object acquires the mutex (say by an externally exposed GetLock
function), the object can run OpenGL operations and/or change model parameters without affecting the other objects.
Completed prior to merge bf007d44e3c7408ddfd5d367e8a28dc53a550fee.
SIMTOI should be able to minimize over photometric data in addition to OI data. A proposed implementation method: