Code Monkey home page Code Monkey logo

diffpy.pdffit2's People

Contributors

8bitsam avatar briantoby avatar bryndin avatar cfarrow avatar dragonyanglong avatar pavoljuhas avatar rozyczko avatar sbillinge avatar sparks29032 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

diffpy.pdffit2's Issues

Revise the way outputs are printed to the console

This has been causing me some headaches:

def redirect_stdout(dst):

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:

  1. Simply use print, instead of redirecting stdout, allowing users to catch this in an outer context
  2. Allow the user to disable this block when initializing PdfFit.

Thanks!

Import Error

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.

v1.4.3 distributions for Mac Silicon and Noarch?

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!

Error when installing pdffit2 via conda-forge then running a fit on pdfgui

/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

py3.10 issue

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?

MSVC runtime dependencies in Windows conda package

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.