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

Cannot extract single peak #5

Open
czhao9 opened this issue May 15, 2018 · 1 comment
Open

Cannot extract single peak #5

czhao9 opened this issue May 15, 2018 · 1 comment

Comments

@czhao9
Copy link

czhao9 commented May 15, 2018

I met a problem when I am trying the first example in the tutorial (i.e., single-peak extraction). The PDF of Ag can be successfully plotted without extracting peak. However, when I execute

srmise data/Ag_nyquist_qmax30.gr --plot --range 2 3.5 --baseline "Polynomial(degree=1)"

on my PC, following warning appears:

The input PDF appears to be missing information: The sampling interval of the input PDF (0.10471976036) is larger than the Nyquist interval (0.10471975512) defined by qmax=30.0. This information is irretrievable.
Traceback (most recent call last):
File "c:\programdata\anaconda2\lib\runpy.py", line 174, in _run_module_as_main
"main", fname, loader, pkg_name)
File "c:\programdata\anaconda2\lib\runpy.py", line 72, in run_code
exec code in run_globals
File "C:\ProgramData\Anaconda2\Scripts\srmise.exe_main
.py", line 9, in
File "c:\programdata\anaconda2\lib\site-packages\diffpy\srmise\applications\extract.py", line 388, in main
cov = ext.extract()
File "c:\programdata\anaconda2\lib\site-packages\diffpy\srmise\pdfpeakextraction.py", line 386, in extract
ext.fit() # Clean up parameters after resampling.
File "c:\programdata\anaconda2\lib\site-packages\diffpy\srmise\modelcluster.py", line 878, in fit
orig_qual = self.quality()
File "c:\programdata\anaconda2\lib\site-packages\diffpy\srmise\modelcluster.py", line 1112, in quality
evaluator_inst.evaluate(self, **kwds)
File "c:\programdata\anaconda2\lib\site-packages\diffpy\srmise\modelevaluators\aic.py", line 71, in evaluate
self.chisq = self.chi_squared(fit.value(), fit.y_cluster, fit.error_cluster)
File "c:\programdata\anaconda2\lib\site-packages\diffpy\srmise\modelcluster.py", line 1067, in value
return self.valuebl(r)+(self.model.value(self.r_data, self.slice)[self.slice])
File "c:\programdata\anaconda2\lib\site-packages\diffpy\srmise\modelparts.py", line 272, in value
total += p.value(r, range)
File "c:\programdata\anaconda2\lib\site-packages\diffpy\srmise\modelparts.py", line 468, in value
return self._owner.value(self, r, range)
File "c:\programdata\anaconda2\lib\site-packages\diffpy\srmise\peaks\terminationripples.py", line 226, in value
output[rng] = value[ext_slice][::segments]
TypeError: slice indices must be integers or None or have an index method

Can anyone help with this problem?

Thanks!

@JMSkelton
Copy link

This error appears to be due to a bug on line 216 in terminationripples.py:

segments = np.ceil(dr/dr_super)

At least in newer versions of NumPy, np.ceil() returns a floating-point value, which cannot be used as an array index.

An easy solution is to edit terminationripples.py and change the line to e.g. the following:

segments = int(np.ceil(dr/dr_super))

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