Hi Matt and Hanyu

Thanks - the latest version of larch runs wrt 
ntot1 = param(expr='nO1+nO2', min=5.0, max=8.5, vary=True)

However, still getting odd gofs/errors:
[[Statistics]]
   nvarys, npts       = 6, 390
   n_independent      = 11.186
   chi_square         = 0.00080359
   reduced chi_square = 0.000154956
   r-factor           = 0.01850
   Akaike info crit   = -94.7257
   Bayesian info crit = -92.2378
....

  delrO1         =  0.132140 +/- unknown   (init=  0.150000)
   delrO2         = -0.446980 +/- unknown   (init= -0.500000)
   enot           = -4.125159 +/- unknown   (init=  0.000000)
   nO1            =  7.000000 +/- unknown   (init=  7.000000)
   nO2            =  0.929177 +/- unknown   (init=  1.000000)
   ntot1          =  7.929177 +/- unknown  = 'nO1+nO2'
   ssO1           =  0.006499 +/- unknown   (init=  0.003000)
 .....
(Please ignore the large init value.)

Running on a Mac 10.13.3.
Happy to send the script & output.
Thanks
Barb.






On Fri, 5 Oct 2018 at 23:02, Matt Newville <newville@cars.uchicago.edu> wrote:
Hi Hanyu, Barbara, 


On Fri, Oct 5, 2018 at 12:55 AM Hanyu Zhang <hxz269@case.edu> wrote:
Hi,

Thought I'd give my two cents before the experts chime in... I'm only a grad student right now though so make what you want out of it. I also haven't touched Larch for a while now since I got my xafs (Larch) functions working in python several months ago.

First off though, ntot1 = param(expr='nO1+nO2', min=5.0, max=8.5) ran without throwing an error in Larch for me... (See screenshot near the middle of this email) So I don't think anyone can really help without more details, but I want to comment on some things:
  1. The first thing is that you're missing a vary = True in the statement for ntot1. Since the default value for vary is False according to the website, I would add that in if you actually wanted it to be fitted for during the fitting process (https://xraypy.github.io/xraylarch/fitting/parameters.html).
  2. In addition, when you run ntot1 = param(expr='nO1+nO2', min=5.0, max=8.5), are nO1 and nO2 pre-defined? If not the computer's not going to know what to make of those variables.
  3. I'd recommend something along the lines of:
nO1 = param(7.0, min=5, max=7, vary=True)
nO2 = param(1, vary=True),
ntot1 = param(expr='nO1+nO2', min=5.0, max=8.5, vary=True)

I just tested this on my machine and it didn't throw any errors. (Though it also didn't throw any errors without the 2 fixes I recommended...):
Screen Shot 2018-10-05 at 12.55.59 AM.png
I didn't think to check when I took that screenshot but with that line, the vary is in fact set to false:

larch> ntot1.vary

False


In terms of the errors on error calculation --

  1. What's the reduced chi-sq? What do you mean by very small? In physics you want that to be as close to one as possible. Though in xafs the reduced chi-sq apparently is typically around 100-1000 so I'm confused as to what you mean by "small". Also, if you're having issues with errorbars to begin with, I wouldn't trust the chi-sq since that calculation relies on how big the errorbars are. If the errors are NAN, who knows what the computer would do to divide those numbers...
  2. What do you mean by "errors are not reported"? After the fit, it's returned in feffit.residual, or something along those lines (http://cars9.uchicago.edu/xraylarch/fitting/results.html#fitting-results-sec)... I haven't actually used this myself, so I can't say more.
  3. (Just a comment...) I don't know if this would help but my physics professor didn't let me trust the reduced chi-sq and gof values I was getting until I found out how the errors were calculated. By default, the errors are calculated by assuming that the noise is white in R-space and that there's no signal at high-R, so the "signal" near your rmax is the noise. (http://cars9.uchicago.edu/xraylarch/xafs/utilities.html#_xafs.estimate_noise, second to last paragraph)


Hope this was at least somewhat helpful,

----------
Hanyu (Alice) Zhang
Master's in Materials science | 2019
Research in utilizing XAFS to match current theory of metallic glasses to experimental data
Academic achievements:
MASMC/NWMSU: Associate of Science, 2014
CWRU: Bachelor's of Science in Engineering Physics, 2018
Honors societies: National Society of Collegiate Scholars | Tau Beta PiPi Mu Epsilon
Other interests:
Clubs: Case Origami Circle | Case Rocket TeamCWRUbotixCase Physics and Astronomy club | Math club
YouTubeChinese Operations Lead, Veritasium (5M subscribers) | Saturday Vlogs


On Thu, Oct 4, 2018 at 8:04 PM Barbara Etschmann <barbara.etschmann@monash.edu> wrote:
Hello

I'm trying to use larch to refine the coordination of Y in solution. I need to use 2xO paths to fit the first shell and would like to restrain the total coordination to be between 5.5 and 8.
 
I can apply the constraint to each nO, but not the total, i.e.
nO1 = param(7.0, min=5, max=7, vary=True),
nO2 = param(1, vary=True),
 but
ntot1 = param(expr='nO1+nO2', min=5.0, max=8.5)
does not work.
How can I restrain the total coordination?


I think that should work.  But I can also believe it doesn't ;).   It may require a recent version of Larch (0.39 or 0.40 and really lmfit).   I'll try to verify that over the next couple of days.


Also, having some problems with the gofs and errors - the chi square is rather small and often the errors are not reported and it is not clear why. 


Hm, not sure. Can you post an example?
Cheers, 

--Matt
_______________________________________________
Ifeffit mailing list
Ifeffit@millenia.cars.aps.anl.gov
http://millenia.cars.aps.anl.gov/mailman/listinfo/ifeffit
Unsubscribe: http://millenia.cars.aps.anl.gov/mailman/options/ifeffit