Opened 5 years ago

Last modified 5 years ago

#1171 new enhancement

Expose volume calculation in SasModels

Reported by: toqduj Owned by: pkienzle
Priority: major Milestone: SasView 5.0.0
Component: sasmodels Keywords: sasmodels, mcsas
Cc: pkienzle Work Package: McSAS Integration Project


McSAS relies on the ability to weigh the contributions based on their volume in its optimisation routine. This means that we need to be able to get a volume for a given contribution from SasModels?.

At the moment, the kernel can be queried for the volume of the last-calculated iteration:


Paul Kienzle commented on this a while back:
For your case (without dispersion) the form_volume is already computed by the kernel and returned as the final element in the result. You should be able to grab it using kernel.result[kernel.q_input.nq] after calculating the kernel. This is a side-effect of the current implementation and not part of the formal interface; it will not work for pure python models, but should work for C models run as dll or as OpenCL.


If we were to make this a formal interface, we would need to generalize it to the case of dispersion-weighted volume average by additionally accumulating the sum of the weights in result[nq+1], then defining self.average_volume = result[nq]/result[nq+1]. Something similar could be done in the python kernel loop.

Change History (1)

comment:1 Changed 5 years ago by pkienzle

This is available in the beta_approx branch, PR #90

from sasmodels.direct_model import call_Fq

F, Fsq, Reff, V, Vratio = call_Fq(kernel, pars)
Note: See TracTickets for help on using tickets.