Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expected arguments for pref function in resolution_function_SMA inconsistent with ResLib documentation #55

Closed
js54434 opened this issue Mar 7, 2016 · 1 comment

Comments

@js54434
Copy link

js54434 commented Mar 7, 2016

The neutronpy resolution code seems to expect arguments of the form pref(H, K, L, EXP, p) for the pref function, but the ResLib 3.4 manual says W should be included, as in pref(H, K, L, W, EXP, p). On the other hand, their source code omits the W argument and seems inconsistent with their documentation. Is there a need to be able to specify the energy-dependence for a pref function?

@pseudocubic
Copy link
Contributor

The documentation of ResLib does not reflect its source code in this case. In the source only H,K,L are passed to the prefactor function, the relevant matlab source is

if isempty(pref)
   prefactor=ones(modes,points);
   bgr=0;
else 
    switch nargout(pref)
    case 2
        [prefactor,bgr]=feval(pref,H,K,L,EXP,p);
    case 1        
        prefactor=feval(pref,H,K,L,EXP,p);
        bgr=0;
    otherwise 
        error('Fata error: invalid number or output arguments in prefactor function');           
    end
end;

Even in PrefDemo.m, where the documentation points to as the example of how this function should be defined, W is left out:

function [prefactor,bgr]=PrefDemo(H,K,L,EXP,p)

From the ResLib documentation, the pref function is described as being a slowly varying function which does not change within a resolution ellipse. Although the equation P(Q,w,p) is used to represent this function, the examples for the function are given as a magnetic form factor or polarization factor, which are static.

I took this to mean that the pref function should have no energy dependence and left out W as an argument.

That being said, if you can think of a situation in which having W is necessary in the pref function, it should be fairly trivial to make this change without breaking anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants