diffpy / diffpy.pdffit2 Goto Github PK
View Code? Open in Web Editor NEWreal space structure refinement to atomic PDF
License: Other
real space structure refinement to atomic PDF
License: Other
This has been causing me some headaches:
diffpy.pdffit2/diffpy/pdffit2/output.py
Line 28 in c4a2989
Every time PdfFit
is instantiated, there is a block of text printed to the console. This similarly happens in other situations. I cannot catch this output because within the PdfFit.__init__
there is another line that globally overwrites stdout, making it impossible for me to redirect using e.g. a context manager. I'm not sure this is good practice: is there any particular reason this is done? I understand that it's important to the authors to display the copyright statements and whatnot, but surely it's reasonable to allow the user to disable this?
I have two suggestions:
PdfFit
.Thanks!
Hi,
I have installed the pdffit2 package through conda
However, I got the following error: by running
from diffpy.pdffit2 import PdfFit
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-7a601dee4ee8> in <module>
----> 1 from diffpy.pdffit2 import PdfFit
~/miniconda3/envs/pdf/lib/python3.7/site-packages/diffpy/pdffit2/__init__.py in <module>
23
24 from diffpy.pdffit2.version import __version__, __date__
---> 25 from diffpy.pdffit2.pdffit import PdfFit
26 from diffpy.pdffit2.output import redirect_stdout
27 from diffpy.pdffit2.pdffit2 import is_element
~/miniconda3/envs/pdf/lib/python3.7/site-packages/diffpy/pdffit2/pdffit.py in <module>
27 # crash with AttributeError when executed during imports of
28 # parent packages.
---> 29 from diffpy.pdffit2 import pdffit2
30 from diffpy.pdffit2 import output
31
ImportError: cannot import name 'pdffit2' from 'diffpy.pdffit2'
I used python=3.7.16
Could you please point me to a solution? Thanks.
Evan needs to the github workflow
Hi there,
It looks like the latest version, v1.4.3, is not available for Mac Silicon and noarch. Are there plans for this release? I seemingly cannot use this code due to the following error in v1.4.0 (which I'm not actually sure is due to v1.4.0 or not):
$ conda create -n py3.10-Local-Structure-Modeling python=3.10 -y
$ conda activate py3.10-Local-Structure-Modeling
$ conda install -c conda-forge diffpy.pdffit2
$ pip install ipython
$ ipython
In [1]: from diffpy.pdffit2 import PdfFit
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
Cell In[1], line 1
----> 1 from diffpy.pdffit2 import PdfFit
File ~/miniforge3/envs/py3.10-Local-Structure-Modeling/lib/python3.10/site-packages/diffpy/pdffit2/__init__.py:25
16 """PDFfit2 - real space structure refinement program.
17 Classes:
18 PdfFit
19 Routines:
20 redirect_stdout
21 """
24 from diffpy.pdffit2.version import __version__, __date__
---> 25 from diffpy.pdffit2.pdffit import PdfFit
26 from diffpy.pdffit2.output import redirect_stdout
27 from diffpy.pdffit2.pdffit2 import is_element
File ~/miniforge3/envs/py3.10-Local-Structure-Modeling/lib/python3.10/site-packages/diffpy/pdffit2/pdffit.py:29
23 import six
25 # Load pdffit2 and output modules to the current namespace.
26 # Note that "import diffpy.pdffit2.output as output" would
27 # crash with AttributeError when executed during imports of
28 # parent packages.
---> 29 from diffpy.pdffit2 import pdffit2
30 from diffpy.pdffit2 import output
32 # helper routines
ImportError: cannot import name 'pdffit2' from partially initialized module 'diffpy.pdffit2' (most likely due to a circular import) (/Users/mc/miniforge3/envs/py3.10-Local-Structure-Modeling/lib/python3.10/site-packages/diffpy/pdffit2/__init__.py)
Any help would be appreciated! Thanks!
/home/sam/miniconda3/envs/pdffit2_310/lib/python3.10/site-packages/diffpy/pdfgui/gui/extendedplotframe.py:182: UserWarning: marker is redundantly defined by the 'marker' keyword argument and the fmt string "." (-> marker='.'). The keyword argument will take precedence.
curveRef = self.subplot.plot(xData, yData, stylestr, **properties)[0]
Exception in thread Thread-2:
SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/sam/miniconda3/envs/pdffit2_310/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/home/sam/miniconda3/envs/pdffit2_310/lib/python3.10/site-packages/diffpy/pdfgui/control/fitting.py", line 97, in run
self.fitting.run()
File "/home/sam/miniconda3/envs/pdffit2_310/lib/python3.10/site-packages/diffpy/pdfgui/control/fitting.py", line 402, in run
if self.refine_step():
File "/home/sam/miniconda3/envs/pdffit2_310/lib/python3.10/site-packages/diffpy/pdfgui/control/fitting.py", line 686, in refine_step
finished = self.server.refine_step(self.tolerancy)
File "/home/sam/miniconda3/envs/pdffit2_310/lib/python3.10/site-packages/diffpy/pdffit2/pdffit.py", line 353, in refine_step
self.finished = pdffit2.refine_step(self._handle, toler)
SystemError: <built-in function refine_step> returned a result with an exception set
Exception in thread Thread-3:
SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/sam/miniconda3/envs/pdffit2_310/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/home/sam/miniconda3/envs/pdffit2_310/lib/python3.10/site-packages/diffpy/pdfgui/control/fitting.py", line 97, in run
self.fitting.run()
File "/home/sam/miniconda3/envs/pdffit2_310/lib/python3.10/site-packages/diffpy/pdfgui/control/fitting.py", line 402, in run
if self.refine_step():
File "/home/sam/miniconda3/envs/pdffit2_310/lib/python3.10/site-packages/diffpy/pdfgui/control/fitting.py", line 686, in refine_step
finished = self.server.refine_step(self.tolerancy)
File "/home/sam/miniconda3/envs/pdffit2_310/lib/python3.10/site-packages/diffpy/pdffit2/pdffit.py", line 353, in refine_step
self.finished = pdffit2.refine_step(self._handle, toler)
SystemError: <built-in function refine_step> returned a result with an exception set
Verify if IPython extension works in IPython 5.0. Update the code for the new API if necessary.
when run pdfgui in py3.10, the error shows:
SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\simon\miniconda3\envs\pdfgui310-new\lib\site-packages\diffpy\pdfgui\gui\errorwrapper.py", line 62, in _f
return func(*args, **kwargs)
File "C:\Users\simon\miniconda3\envs\pdfgui310-new\lib\site-packages\diffpy\pdfgui\gui\mainframe.py", line 1884, in onRun
self.control.start(IDlist)
File "C:\Users\simon\miniconda3\envs\pdfgui310-new\lib\site-packages\diffpy\pdfgui\control\pdfguicontrol.py", line 498, in start
calc.start()
File "C:\Users\simon\miniconda3\envs\pdfgui310-new\lib\site-packages\diffpy\pdfgui\control\calculation.py", line 125, in start
self.calculate()
File "C:\Users\simon\miniconda3\envs\pdfgui310-new\lib\site-packages\diffpy\pdfgui\control\calculation.py", line 183, in calculate
server.calc()
File "C:\Users\simon\miniconda3\envs\pdfgui310-new\lib\site-packages\diffpy\pdffit2\pdffit.py", line 315, in calc
pdffit2.calc(self._handle)
SystemError: <built-in function calc> returned a result with an exception set
We have tried to solve it by add #define PY_SSIZE_T_CLEAN
, see c62e0e3 and 72481c0 commits. But seems like it still fails?
Does not work on Ubuntu Xenial. Lib is located in /usr/lib/x86_64-linux-gnu
rather than in /usr/lib
.
The current Windows build environment links with MSVCR100.dll, MSVCP100.dll,
but Anaconda Python 2.7 provides their "90" version. Either rebuild with respect
to MSVC 9 or add requirement for the "100" runtime DLLs.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.