Giter Club home page Giter Club logo

pyxrd's Introduction

PyXRD

PyXRD is a python implementation of the matrix algorithm for computer modeling of X-ray diffraction (XRD) patterns of disordered lamellar structures. It's goals are to:

  • provide an easy user-interface for end-users
  • provide basic tools for displaying and manipulating XRD patterns
  • produce high-quality (publication-grade) figures
  • make modelling of XRD patterns for mixed-layer clay minerals 'easy'
  • be free and open-source (open box instead of closed box model)

PyXRD was written with the multi-specimen full-profile fitting method in mind. A direct result is the ability to 'share' parameters among similar phases. This allows for instance to have an air-dry and a glycolated illite-smectite share their coherent scattering domain size, but still have different basal spacings and interlayer compositions for the smectite component. Or play with the di/tri-octahedral composition of a chlorite with ease.

Other features are (incomplete list):

  • Import/export several common XRD formats (.RD, .RAW, .CPI, ASCII)
  • Simple background subtraction/addition (linear or custom patterns)
  • Smoothing patterns and adding noise to patterns
  • Peak finding and annotating (markers)
  • Peak stripping and peak area calculation tools
  • Custom line colors, line widths, pattern positions, ...
  • Goniometer settings (wavelengths, geometry settings, ...)
  • Specimen settings (sample length, absorption, ...)
  • Automatic parameter refinement using several algorithms, e.g.:
    • L BFGS B
    • Brute Force
    • Covariation Matrix Adapation Evolutionary Strategy (CMA-ES; using DEAP 1.0)
    • Multiple Particle Swarm Optimization (MPSO; using DEAP 1.0)
    • Particle-swarm CMA-ES (PS-CMA-ES; using DEAP 1.0)
  • Scripting support

DISCLAIMER

PyXRD is still very much work in progress. Currently there is no strict development cycle as it is still a one-man project. This also means little time is going into testing and adding new tests for new features. Most of the codebase therefore remains untested at this point and Things May Break as a result.

If you encounter bugs please:

  • create a new issue or;
  • send me an e-mail

INSTALLATION

As of version 0.5.0 PyXRD (finally) supports standard python packaging, meaning it is available from the Python package index and has become very easy to install for most Python users once the dependencies are installed.

If you're not used to (installing) Python software, see below for specific instructions.

Dependencies

This is what should be present on your system.

  • Python 3.4 or later
  • Setuptools
  • GTK3 and pygobject 3.2 or later
  • cairocffi
  • Numpy 1.11 or later
  • Scipy 1.1 or later
  • Matplotlib 2.2 or later
  • Pyro4 4.41 or later
  • DEAP 1.0 or later

Additionally, to be able to run the unit tests, you'll need to install pyton-mock (>= 1.3.0). To just run PyXRD, you won't need it though.

Windows

PyXRD is developed on Ubuntu Linux, and thus has a number of dependencies which are not native to windows. Because of the difficulties in installing these correctly, from version 0.8 onwards an all-in-one stand alone installer is provided for windows users. Previous installations should not interfere, but it's better to remove them (including python, numpy, scipy and pygtk installed along with pre-v0.8 versions).

You can choose for a local installation or a portable (single-folder) installation. The latter is just a zip-file which can be extracted e.g. onto an usb-drive. The downside is you don't get start menu entries.

The installers are made available here:

https://github.com/mathijs-dumon/PyXRD/releases

After installation there should be a start menu entry available.

If PyXRD does not launch, run cmd.exe (the command prompt), enter the following and send me the output (right-click to copy after selecting):

"C:\Program Files (x86)\PyXRD\bin\python3.exe" -m pyxrd

Linux

It should be as easy as:

python3 -m ensurepip --upgrade
python3 -m pip install pyxrd

To run PyXRD:

python3 -m pyxrd

Mac OS X

Currently no support is given for iOS. If anyone is interested in getting this to work feel free to contact me.

CREDITS

  • xylib - Has been a great help at unravelling some common XRD formats

pyxrd's People

Contributors

mathijs-dumon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyxrd's Issues

Automatic updates

Should provide an option again to update PyXRD automatically. Tricky bit would be to solve numpy and scipy updates as well...

matching minerals raises a (benign) error

Traceback:
Traceback (most recent call last):

  File "/usr/lib/python3/dist-packages/gi/overrides/Gtk.py", line 103, _builder_connect_callback(builder=<Gtk.Builder object at 0x7f0a8bd7dca8 (GtkBuilder at 0x5787570)>, gobj=<Gtk.TreeView object at 0x7f0a8bc62438 (GtkTreeView at 0x7249370)>, signal_name='focus-in-event', handler_name='on_focusin', connect_obj=None, flags=<flags 0 of type GObject.ConnectFlags>, obj_or_map={'_Controller__autoconnect_signals': <bound method Controller.__autoconnect_signals o...arker_controllers.MatchMineralController object>>, '_Observer__original_observe': <bound method good_decorator_accepting_args.<loc...lers.marker_controllers.MatchMineralController'>>, '_Observer__register_notification': <bound method Observer.__register_notification o...arker_controllers.MatchMineralController object>>, '__class__': <class 'pyxrd.specimen.controllers.marker_controllers.MatchMineralController'>, '__create_adapters__': <bound method Controller.__create_adapters__ of ...arker_controllers.MatchMineralController object>>, '__delattr__': <method-wrapper '__delattr__' of MatchMineralController object>, '__dir__': <built-in method __dir__ of MatchMineralController object>, '__eq__': <method-wrapper '__eq__' of MatchMineralController object>, '__format__': <built-in method __format__ of MatchMineralController object>, '__ge__': <method-wrapper '__ge__' of MatchMineralController object>, ...})
    def _builder_connect_callback(builder, gobj, signal_name, handler_name, connect_obj, flags, obj_or_map):
        handler, args = _extract_handler_and_args(obj_or_map, handler_name)
  variables: {'handler': (None, []), '_extract_handler_and_args': ('global', <function _extract_handler_and_args at 0x7f0abf212950>), 'obj_or_map': ('local', {'on_keypress': <bound method DialogController.on_keypress of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, '_Observer__register_notification': <bound method Observer.__register_notification of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, '__subclasshook__': <built-in method __subclasshook__ of type object at 0x3b94fb8>, 'get_observing_method_kwargs': <bound method Observer.get_observing_method_kwargs of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, '__gt__': <method-wrapper '__gt__' of MatchMineralController object at 0x7f0a8bd8b7b8>, 'pop_status_msg': <bound method StatusBarMixin.pop_status_msg of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, '__setattr__': <method-wrapper '__setattr__' of MatchMineralController object at 0x7f0a8bd8b7b8>, '__le__': <method-wrapper '__le__' of MatchMineralController object at 0x7f0a8bd8b7b8>, 'register_adapters': <bound method MatchMineralController.register_adapters of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, '__repr__': <method-wrapper '__repr__' of MatchMineralController object at 0x7f0a8bd8b7b8>, 'selection_changed': <bound method MatchMineralController.selection_changed of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, 'reload_minerals': <bound method MatchMineralController.reload_minerals of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, 'register_view': <bound method MatchMineralController.register_view of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, 'observe': <function Observer.__init__.<locals>.__observe at 0x7f0a8bc63400>, '__reduce__': <built-in method __reduce__ of MatchMineralController object at 0x7f0a8bd8b7b8>, 'on_add_match_clicked': <bound method MatchMineralController.on_add_match_clicked of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, 'get_custom_observing_methods': <bound method Observer.get_observing_methods of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, 'observe_model': <bound method Observer.observe_model of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, 'close_callback': <function MarkersController.on_match_minerals_clicked.<locals>.close_cb at 0x7f0a8bc63488>, '_del_view': <bound method Controller._del_view of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, '_Observer__original_observe': <bound method good_decorator_accepting_args.<locals>.new_decorator of <class 'pyxrd.specimen.controllers.marker_controllers.MatchMineralController'>>, '__lt__': <method-wrapper '__lt__' of MatchMineralController object at 0x7f0a8bd8b7b8>, '__format__': <built-in method __format__ of MatchMineralController object at 0x7f0a8bd8b7b8>, '_del_model': <bound method Controller._del_model of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, 'relieve_model': <bound method Observer.relieve_model of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, 'remove_observing_method': <bound method Observer.remove_observing_method of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, '_find_widget_match': <bound method Controller._find_widget_match of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, '__ge__': <method-wrapper '__ge__' of MatchMineralController object at 0x7f0a8bd8b7b8>, 'is_observing_method': <bound method Observer.is_observing_method of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, '_idle_register_view': <bound method Controller._idle_register_view of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, '__init__': <bound method MatchMineralController.__init__ of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, '_set_view': <bound method Controller._set_view of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, '__eq__': <method-wrapper '__eq__' of MatchMineralController object at 0x7f0a8bd8b7b8>, '_set_model': <bound method Controller._set_model of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, '_get_handler_list': <bound method Controller._get_handler_list of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, 'adapt': <bound method Controller.adapt of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, 'notif_parameter_changed': <bound method MatchMineralController.notif_parameter_changed of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, '__weakref__': <weakref at 0x7f0a8bc5cdb8; to 'MatchMineralController' at 0x7f0a8bd8b7b8>, '__getattribute__': <method-wrapper '__getattribute__' of MatchMineralController object at 0x7f0a8bd8b7b8>, '__delattr__': <method-wrapper '__delattr__' of MatchMineralController object at 0x7f0a8bd8b7b8>, 'on_window_edit_dialog_delete_event': <bound method DialogController.on_window_edit_dialog_delete_event of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, 'status_message': <function StatusBarMixin.status_message at 0x7f0a91003378>, 'accepts_spurious_change': <bound method Observer.accepts_spurious_change of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, '_get_view': <bound method Controller._get_view of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, '__create_adapters__': <bound method Controller.__create_adapters__ of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, 'on_del_match_clicked': <bound method MatchMineralController.on_del_match_clicked of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, 'apply_callback': <function MarkersController.on_match_minerals_clicked.<locals>.apply_cb at 0x7f0a8bc63598>, 'get_observing_methods': <bound method Observer.get_observing_methods of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, '__reduce_ex__': <built-in method __reduce_ex__ of MatchMineralController object at 0x7f0a8bd8b7b8>, 'reload_matches': <bound method MatchMineralController.reload_matches of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, '_Controller__autoconnect_signals': <bound method Controller.__autoconnect_signals of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, '__dir__': <built-in method __dir__ of MatchMineralController object at 0x7f0a8bd8b7b8>, '__class__': <class 'pyxrd.specimen.controllers.marker_controllers.MatchMineralController'>, 'on_auto_match_clicked': <bound method MatchMineralController.on_auto_match_clicked of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, 'on_cancel': <bound method MatchMineralController.on_cancel of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, 'on_btn_ok_clicked': <bound method DialogController.on_btn_ok_clicked of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, '__sizeof__': <built-in method __sizeof__ of MatchMineralController object at 0x7f0a8bd8b7b8>, '__str__': <method-wrapper '__str__' of MatchMineralController object at 0x7f0a8bd8b7b8>, '_get_model': <bound method Controller._get_model of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, 'on_apply_clicked': <bound method MatchMineralController.on_apply_clicked of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, '__hash__': <method-wrapper '__hash__' of MatchMineralController object at 0x7f0a8bd8b7b8>, '_clear_adapters': <bound method Controller._clear_adapters of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, '__new__': <built-in method __new__ of type object at 0xa3ec60>, 'push_status_msg': <bound method StatusBarMixin.push_status_msg of <pyxrd.specimen.controllers.marker_controllers.MatchMineralController object at 0x7f0a8bd8b7b8>>, '__ne__': <method-wrapper '__ne__' of MatchMineralController object at 0x7f0a8bd8b7b8>}), 'handler_name': ('local', 'on_focusin'), 'args': (None, [])}
  File "/usr/lib/python3/dist-packages/gi/overrides/Gtk.py", line 83, _extract_handler_and_args(obj_or_map={'_Controller__autoconnect_signals': <bound method Controller.__autoconnect_signals o...arker_controllers.MatchMineralController object>>, '_Observer__original_observe': <bound method good_decorator_accepting_args.<loc...lers.marker_controllers.MatchMineralController'>>, '_Observer__register_notification': <bound method Observer.__register_notification o...arker_controllers.MatchMineralController object>>, '__class__': <class 'pyxrd.specimen.controllers.marker_controllers.MatchMineralController'>, '__create_adapters__': <bound method Controller.__create_adapters__ of ...arker_controllers.MatchMineralController object>>, '__delattr__': <method-wrapper '__delattr__' of MatchMineralController object>, '__dir__': <built-in method __dir__ of MatchMineralController object>, '__eq__': <method-wrapper '__eq__' of MatchMineralController object>, '__format__': <built-in method __format__ of MatchMineralController object>, '__ge__': <method-wrapper '__ge__' of MatchMineralController object>, ...}, handler_name='on_focusin')
        if handler is None:
            raise AttributeError('Handler %s not found' % handler_name)
  variables: {'AttributeError': ('builtin', <class 'AttributeError'>), 'handler_name': ('local', 'on_focusin')}
AttributeError: Handler on_focusin not found

Issue Matplotlib

Module works fine in recent Linux (Debian derivatives) distros. Matplotlib must be <=3.2.0!

add phases on Ubuntu

Dear Mathijs,
when generating phases the program (Linux version) crashes saying a programming error was detected.
Here I copied the error message.
Thanks a lot

Traceback (most recent call last):
File "/home/labcrescita/.local/lib/python3.8/site-packages/mvc/controller.py", line 157, _idle_register_view(self=<pyxrd.phases.controllers.CSDS_controllers.EditCSDSDistributionController object>, view=<pyxrd.phases.views.EditCSDSDistributionView object>)
self.register_view(self.view)
self.register_adapters()
variables: {'self.register_view': ('local', <bound method EditCSDSDistributionController.register_view of <pyxrd.phases.controllers.CSDS_controllers.EditCSDSDistributionController object at 0x7f36f7309cd0>>), 'self.view': ('local', <pyxrd.phases.views.EditCSDSDistributionView object at 0x7f3721f5c490>)}
File "/home/labcrescita/.local/lib/python3.8/site-packages/pyxrd/phases/controllers/CSDS_controllers.py", line 107, register_view(self=<pyxrd.phases.controllers.CSDS_controllers.EditCSDSDistributionController object>, view=<pyxrd.phases.views.EditCSDSDistributionView object>)
if self.model is not None:
self.reset_view()
variables: {'self.reset_view': ('local', <bound method EditCSDSDistributionController.reset_view of <pyxrd.phases.controllers.CSDS_controllers.EditCSDSDistributionController object at 0x7f36f7309cd0>>)}
File "/home/labcrescita/.local/lib/python3.8/site-packages/pyxrd/phases/controllers/CSDS_controllers.py", line 101, reset_view(self=<pyxrd.phases.controllers.CSDS_controllers.EditCSDSDistributionController object>)
)
self.view.update_figure(self.model.distrib[0])
self.register_adapters()
variables: {'self.view.update_figure': ('local', <bound method EditCSDSDistributionView.update_figure of <pyxrd.phases.views.EditCSDSDistributionView object at 0x7f3721f5c490>>), 'self.model.distrib': ('local', (array([0.00000000e+00, 4.22798362e-05, 4.14794680e-03, 2.40761188e-02,
5.54406161e-02, 8.35815096e-02, 1.00271239e-01, 1.05026084e-01,
1.00952692e-01, 9.16846847e-02, 8.01134260e-02, 6.81509294e-02,
5.68933190e-02, 4.68688067e-02, 3.82521482e-02, 3.10186349e-02,
2.50439457e-02, 2.01642327e-02, 1.62097649e-02, 1.30221002e-02,
1.04615344e-02, 8.40912194e-03, 6.76588131e-03, 5.45070933e-03,
4.39785745e-03, 3.55441673e-03]), 9.670586370099196))}
File "/home/labcrescita/.local/lib/python3.8/site-packages/pyxrd/phases/views.py", line 179, update_figure(self=<pyxrd.phases.views.EditCSDSDistributionView object>, distr=array([0.00000000e+00, 4.22798362e-05, 4.1479468...0933e-03,
4.39785745e-03, 3.55441673e-03]))
self.plot.cla()
self.plot.hist(list(range(len(distr))), len(distr), weights=distr, normed=1, ec='b', histtype='stepfilled')
self.plot.set_ylabel('')
variables: {'self.plot.hist': ('local', <bound method Axes.hist of AxesSubplot:>), 'list': ('builtin', <class 'list'>), 'range': ('builtin', <class 'range'>), 'len': ('builtin', ), 'distr': ('local', array([0.00000000e+00, 4.22798362e-05, 4.14794680e-03, 2.40761188e-02,
5.54406161e-02, 8.35815096e-02, 1.00271239e-01, 1.05026084e-01,
1.00952692e-01, 9.16846847e-02, 8.01134260e-02, 6.81509294e-02,
5.68933190e-02, 4.68688067e-02, 3.82521482e-02, 3.10186349e-02,
2.50439457e-02, 2.01642327e-02, 1.62097649e-02, 1.30221002e-02,
1.04615344e-02, 8.40912194e-03, 6.76588131e-03, 5.45070933e-03,
4.39785745e-03, 3.55441673e-03])), 'weights': (None, []), 'normed': (None, []), 'ec': (None, []), 'histtype': (None, [])}
File "/home/labcrescita/.local/lib/python3.8/site-packages/matplotlib/init.py", line 1361, inner(ax=AxesSubplot:, data=None, *args=([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, ...], 26), **kwargs={'ec': 'b', 'histtype': 'stepfilled', 'normed': 1, 'weights': array([0.00000000e+00, 4.22798362e-05, 4.1479468...0933e-03,
4.39785745e-03, 3.55441673e-03])})
if data is None:
return func(ax, *map(sanitize_sequence, args), **kwargs)
variables: {'func': ('local', <function Axes.hist at 0x7f3729a004c0>), 'ax': ('local', AxesSubplot:), 'map': ('builtin', <class 'map'>), 'sanitize_sequence': ('global', <function sanitize_sequence at 0x7f3751b5b790>), 'args': ('local', ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25], 26)), 'kwargs': ('local', {'weights': array([0.00000000e+00, 4.22798362e-05, 4.14794680e-03, 2.40761188e-02,
5.54406161e-02, 8.35815096e-02, 1.00271239e-01, 1.05026084e-01,
1.00952692e-01, 9.16846847e-02, 8.01134260e-02, 6.81509294e-02,
5.68933190e-02, 4.68688067e-02, 3.82521482e-02, 3.10186349e-02,
2.50439457e-02, 2.01642327e-02, 1.62097649e-02, 1.30221002e-02,
1.04615344e-02, 8.40912194e-03, 6.76588131e-03, 5.45070933e-03,
4.39785745e-03, 3.55441673e-03]), 'normed': 1, 'ec': 'b', 'histtype': 'stepfilled'})}
File "/home/labcrescita/.local/lib/python3.8/site-packages/matplotlib/axes/_axes.py", line 6911, hist(self=AxesSubplot:, x=array([ 0. , 0. , 0.96153846, 0...92307692, 0.96153846, 0.96153846, 0. ]), bins=array([ 0. , 0.96153846, 1.92307692, 2...2, 23.07692308,
24.03846154, 25. ]), range=<class 'range'>, density=False, weights=array([0.00000000e+00, 4.22798362e-05, 4.1479468...0933e-03,
4.39785745e-03, 3.55441673e-03]), cumulative=False, bottom=0, histtype='stepfilled', align='mid', orientation='vertical', rwidth=None, log=False, color=['#1f77b4'], label=None, stacked=False, **kwargs={'ec': 'b', 'normed': 1})
p = patch[0]
p.update(kwargs)
if lbl is not None:
variables: {'p.update': ('local', <bound method Artist.update of <matplotlib.patches.Polygon object at 0x7f3726d67820>>), 'kwargs': ('local', {'normed': 1, 'ec': 'b'})}
File "/home/labcrescita/.local/lib/python3.8/site-packages/matplotlib/artist.py", line 1062, update(self=<matplotlib.patches.Polygon object>, props={'ec': 'b', 'normed': 1})
if not callable(func):
raise AttributeError(f"{type(self).name!r} object "
f"has no property {k!r}")
variables: {'AttributeError': ('builtin', <class 'AttributeError'>)}
AttributeError: 'Polygon' object has no property 'normed'

New bug when starting "Refine"

New bug on UBUNTU

Traceback (most recent call last):
File "/home/labcrescita/.local/lib/python3.9/site-packages/pyxrd/refinement/controllers/refinement_controller.py", line 59, get_pb(column=<treeview_tools.PyXRDTreeViewColumn object at 0x...treeview_tools+PyXRDTreeViewColumn at 0xa8d71a0)>, cell=<Gtk.CellRendererPixbuf object at 0x7fdbb7abecc0 (GtkCellRendererPixbuf at 0xa4ef590)>, model=<object_tree_store.ObjectTreeStore object at 0x7...+object_tree_store+ObjectTreeStore at 0xa8b8120)>, itr=<Gtk.TreeIter object at 0x7fdbb7e1ae20 (GtkTreeIter at 0xa8b8b00)>, user_data=())
if not hasattr(ref_prop, "pb") or not ref_prop.pb:
ref_prop.pb = create_pb_from_mathtext(
ref_prop.title,
File "/home/labcrescita/.local/lib/python3.9/site-packages/pyxrd/generic/mathtext_support.py", line 44, create_pb_from_mathtext(text='Chlorite', align='left', weight='medium', color='b', style='normal')
parts, fontsize = _handle_customs(text)
variables: {'parts': (None, []), 'fontsize': (None, []), '_handle_customs': ('global', <function _handle_customs at 0x7fdbe91a54c0>), 'text': ('local', 'Chlorite')}
File "/home/labcrescita/.local/lib/python3.9/site-packages/pyxrd/generic/mathtext_support.py", line 113, _handle_customs(text='Chlorite')
def _handle_customs(text):
text = text.decode('utf-8')
variables: {'text': ('local', 'Chlorite')}
AttributeError: 'str' object has no attribute 'decode'

installation error in windows10

Dear Mathijs,
I tried to install PyXRD but I encountered some errors reported in this mail as you suggest. Unfortunately, I’m not expert of python and I’m not able to resolve them also if they, probably, are very simple problems to fix.
Thank for your help
Best whishes
Paolo

C:\Users\pmazz_j36fco8>"C:\Program Files (x86)\PyXRD\bin\python3.exe" -m pyxrd
C:\Program Files (x86)\PyXRD\lib\python3.8\site-packages\pyxrd\generic\outdated_init_.py:103: OutdatedPackageWarning: The package outdated is out of date. Your version is 0.1.2, the latest is 0.2.1.
warn('The package %s is out of date. Your version is %s, the latest is %s.'
pyxrd.generic.asynchronous.providers - INFO: Loading async server provider
pyxrd.generic.asynchronous.providers - INFO: Trying to load async server provider at pyxrd.server.provider.Pyro4AsyncServerProvider
pyxrd.generic.asynchronous.providers - INFO: Loaded async server provider '<class 'pyxrd.server.provider.Pyro4AsyncServerProvider'>'
root - INFO: Pyro4 PyXRD server not (yet) running!
root - INFO: Starting server using script: 'C:\Program Files (x86)\PyXRD\lib\python3.8\site-packages\pyxrd\server\run_server.py', logging to 'C:\Users\pmazz_j36fco8\AppData\Local\PyXRD\PyXRD\Logs\server.log'
root - INFO: Pyro4 PyXRD server not (yet) running!
root - INFO: Pyro4 PyXRD server not (yet) running!
root - INFO: Pyro4 PyXRD server not (yet) running!

Adding a phase in the match phases dialog raised an error

Traceback (most recent call last):
  File "/media/mathijs/LacieDocs/Projects/PyXRD/pyxrd/specimen/controllers/marker_controllers.py", line 326, in on_add_match_clicked
    self.model.add_match(name, abbreviation, peaks)
  File "/media/mathijs/LacieDocs/Projects/PyXRD/pyxrd/specimen/models/markers.py", line 96, in add_match
    matches = score_minerals(self.marker_peaks, [(name, abbreviation, peaks)])
  File "/media/mathijs/LacieDocs/Projects/PyXRD/pyxrd/calculations/peak_detection.py", line 53, in score_minerals
    epos, eint = find_closest(mpos, peak_list)
  File "/media/mathijs/LacieDocs/Projects/PyXRD/pyxrd/calculations/peak_detection.py", line 17, in find_closest
    nparray = np.array(zip(*array)[col])
TypeError: 'zip' object is not subscriptable
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.

Getting a NameError when setting AtomRatio's second atom

When creating a NEW AtomRatio, the first atom can be set without a problem, second atom raises this error:

Traceback (most recent call last):
File "/media/mathijs/LacieDocs/Projects/PyXRD/pyxrd/phases/controllers/atom_relation_controllers.py", line 76, in on_changed
setattr(self.model, combo.get_data('model_prop'), val)
NameError: free variable 'self' referenced before assignment in enclosing scope

After this error is raised, the dialog will no longer respond and cannot be closed. However, when creating the AtomRatio, changing its name and then setting the atoms does not raise the error. The dialog can then still not be closed.
Probably a reference issue (the main program losing reference to the controller or the view causing Gtk-Python to fail or something like that...)

New bug adding a phase

New bug on UBUNTU

Traceback (most recent call last):
File "/home/labcrescita/.local/lib/python3.9/site-packages/mvc/controller.py", line 157, _idle_register_view(self=<pyxrd.phases.controllers.CSDS_controllers.EditCSDSDistributionController object>, view=<pyxrd.phases.views.EditCSDSDistributionView object>)
self.register_view(self.view)
self.register_adapters()
variables: {'self.register_view': ('local', <bound method EditCSDSDistributionController.register_view of <pyxrd.phases.controllers.CSDS_controllers.EditCSDSDistributionController object at 0x7fdc1ae951c0>>), 'self.view': ('local', <pyxrd.phases.views.EditCSDSDistributionView object at 0x7fdc1ac8ea60>)}
File "/home/labcrescita/.local/lib/python3.9/site-packages/pyxrd/phases/controllers/CSDS_controllers.py", line 107, register_view(self=<pyxrd.phases.controllers.CSDS_controllers.EditCSDSDistributionController object>, view=<pyxrd.phases.views.EditCSDSDistributionView object>)
if self.model is not None:
self.reset_view()
variables: {'self.reset_view': ('local', <bound method EditCSDSDistributionController.reset_view of <pyxrd.phases.controllers.CSDS_controllers.EditCSDSDistributionController object at 0x7fdc1ae951c0>>)}
File "/home/labcrescita/.local/lib/python3.9/site-packages/pyxrd/phases/controllers/CSDS_controllers.py", line 101, reset_view(self=<pyxrd.phases.controllers.CSDS_controllers.EditCSDSDistributionController object>)
)
self.view.update_figure(self.model.distrib[0])
self.register_adapters()
variables: {'self.view.update_figure': ('local', <bound method EditCSDSDistributionView.update_figure of <pyxrd.phases.views.EditCSDSDistributionView object at 0x7fdc1ac8ea60>>), 'self.model.distrib': ('local', (array([0.00000000e+00, 4.22798362e-05, 4.14794680e-03, 2.40761188e-02,
5.54406161e-02, 8.35815096e-02, 1.00271239e-01, 1.05026084e-01,
1.00952692e-01, 9.16846847e-02, 8.01134260e-02, 6.81509294e-02,
5.68933190e-02, 4.68688067e-02, 3.82521482e-02, 3.10186349e-02,
2.50439457e-02, 2.01642327e-02, 1.62097649e-02, 1.30221002e-02,
1.04615344e-02, 8.40912194e-03, 6.76588131e-03, 5.45070933e-03,
4.39785745e-03, 3.55441673e-03]), 9.670586370099196))}
File "/home/labcrescita/.local/lib/python3.9/site-packages/pyxrd/phases/views.py", line 179, update_figure(self=<pyxrd.phases.views.EditCSDSDistributionView object>, distr=array([0.00000000e+00, 4.22798362e-05, 4.1479468...0933e-03,
4.39785745e-03, 3.55441673e-03]))
self.plot.cla()
self.plot.hist(list(range(len(distr))), len(distr), weights=distr, normed=1, ec='b', histtype='stepfilled')
self.plot.set_ylabel('')
variables: {'self.plot.hist': ('local', <bound method Axes.hist of AxesSubplot:>), 'list': ('builtin', <class 'list'>), 'range': ('builtin', <class 'range'>), 'len': ('builtin', ), 'distr': ('local', array([0.00000000e+00, 4.22798362e-05, 4.14794680e-03, 2.40761188e-02,
5.54406161e-02, 8.35815096e-02, 1.00271239e-01, 1.05026084e-01,
1.00952692e-01, 9.16846847e-02, 8.01134260e-02, 6.81509294e-02,
5.68933190e-02, 4.68688067e-02, 3.82521482e-02, 3.10186349e-02,
2.50439457e-02, 2.01642327e-02, 1.62097649e-02, 1.30221002e-02,
1.04615344e-02, 8.40912194e-03, 6.76588131e-03, 5.45070933e-03,
4.39785745e-03, 3.55441673e-03])), 'weights': (None, []), 'normed': (None, []), 'ec': (None, []), 'histtype': (None, [])}
File "/home/labcrescita/.local/lib/python3.9/site-packages/matplotlib/init.py", line 1361, inner(ax=AxesSubplot:, data=None, *args=([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, ...], 26), **kwargs={'ec': 'b', 'histtype': 'stepfilled', 'normed': 1, 'weights': array([0.00000000e+00, 4.22798362e-05, 4.1479468...0933e-03,
4.39785745e-03, 3.55441673e-03])})
if data is None:
return func(ax, *map(sanitize_sequence, args), **kwargs)
variables: {'func': ('local', <function Axes.hist at 0x7fdbe8855790>), 'ax': ('local', AxesSubplot:), 'map': ('builtin', <class 'map'>), 'sanitize_sequence': ('global', <function sanitize_sequence at 0x7fdc11b5f940>), 'args': ('local', ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25], 26)), 'kwargs': ('local', {'weights': array([0.00000000e+00, 4.22798362e-05, 4.14794680e-03, 2.40761188e-02,
5.54406161e-02, 8.35815096e-02, 1.00271239e-01, 1.05026084e-01,
1.00952692e-01, 9.16846847e-02, 8.01134260e-02, 6.81509294e-02,
5.68933190e-02, 4.68688067e-02, 3.82521482e-02, 3.10186349e-02,
2.50439457e-02, 2.01642327e-02, 1.62097649e-02, 1.30221002e-02,
1.04615344e-02, 8.40912194e-03, 6.76588131e-03, 5.45070933e-03,
4.39785745e-03, 3.55441673e-03]), 'normed': 1, 'ec': 'b', 'histtype': 'stepfilled'})}
File "/home/labcrescita/.local/lib/python3.9/site-packages/matplotlib/axes/_axes.py", line 6911, hist(self=AxesSubplot:, x=array([ 0. , 0. , 0.96153846, 0...92307692, 0.96153846, 0.96153846, 0. ]), bins=array([ 0. , 0.96153846, 1.92307692, 2...2, 23.07692308,
24.03846154, 25. ]), range=<class 'range'>, density=False, weights=array([0.00000000e+00, 4.22798362e-05, 4.1479468...0933e-03,
4.39785745e-03, 3.55441673e-03]), cumulative=False, bottom=0, histtype='stepfilled', align='mid', orientation='vertical', rwidth=None, log=False, color=['#1f77b4'], label=None, stacked=False, **kwargs={'ec': 'b', 'normed': 1})
p = patch[0]
p.update(kwargs)
if lbl is not None:
variables: {'p.update': ('local', <bound method Artist.update of <matplotlib.patches.Polygon object at 0x7fdc1ae8fe50>>), 'kwargs': ('local', {'normed': 1, 'ec': 'b'})}
File "/home/labcrescita/.local/lib/python3.9/site-packages/matplotlib/artist.py", line 1062, update(self=<matplotlib.patches.Polygon object>, props={'ec': 'b', 'normed': 1})
if not callable(func):
raise AttributeError(f"{type(self).name!r} object "
f"has no property {k!r}")
variables: {'AttributeError': ('builtin', <class 'AttributeError'>)}
AttributeError: 'Polygon' object has no property 'normed'

Status of macOS support unclear

Quoting the main README,

Mac OS X

Currently no support is given for iOS. If anyone is interested in getting this to work feel free to contact me.

Apple's iOS is their phone and tablet touchscreen operating system. I assuming that was a typo?

Apple have since rebranded Mac OS X as macOS, their desktop and laptop operating system.

I expect your tool to work there much like it works on Linux, providing the dependencies can be installed - but pygments and Gtk look like the first hurdles, cross reference conda-forge/pygobject-feedstock#20

Version 0.8.1 and 0.8.2 tag inconsistent on git

Current release is version 0.8.2, https://github.com/PyXRD/PyXRD/blob/master/pyxrd/__version.py

Most prior releases have a git tag with a leading v, e.g. v0.7.5 which is listed first by GitHub.

The recent 0.8.1 and 0.8.2 releases were tagged without the leading v, and therefore sort to the end of the list on GitHub, leaving the current latest release second from bottom.

I suggest re-tagging them as v0.8.1 and v0.8.2 for consistency and to avoid confusion.

Removing experimental data raises an error

Traceback (most recent call last):
  File "PyXRD/mvc/adapters/gtk_support/treemodels/generic_tree_model.py", line 66, wrapped_func(*args=(<xy_list_store.XYListStore object at 0x7feecc5f5...emodels+xy_list_store+XYListStore at 0x10f5c7a0)>, <Gtk.TreeIter object at 0x7feecc582be8 (GtkTreeIter at 0x1411b8c0)>), **kargs={})
                try:
                    return func(*args, **kargs)
                except:
  variables: {'func': ('local', <function GenericTreeModel.do_unref_node at 0x7feeba032a60>), 'kargs': ('local', {}), 'args': ('local', (<xy_list_store.XYListStore object at 0x7feecc5f53f0 (mvc+adapters+gtk_support+treemodels+xy_list_store+XYListStore at 0x10f5c7a0)>, <Gtk.TreeIter object at 0x7feecc582be8 (GtkTreeIter at 0x1411b8c0)>))}
  File "PyXRD/mvc/adapters/gtk_support/treemodels/generic_tree_model.py", line 303, do_unref_node(self=<xy_list_store.XYListStore object at 0x7feecc5f5...emodels+xy_list_store+XYListStore at 0x10f5c7a0)>, iter=<Gtk.TreeIter object at 0x7feecc582be8 (GtkTreeIter at 0x1411b8c0)>)
        def do_unref_node(self, iter):
            self.on_unref_node(self.get_user_data(iter))
  variables: {'self.get_user_data': ('local', <bound method GenericTreeModel.get_user_data of <xy_list_store.XYListStore object at 0x7feecc5f53f0 (mvc+adapters+gtk_support+treemodels+xy_list_store+XYListStore at 0x10f5c7a0)>>), 'self.on_unref_node': ('local', <bound method GenericTreeModel.on_unref_node of <xy_list_store.XYListStore object at 0x7feecc5f53f0 (mvc+adapters+gtk_support+treemodels+xy_list_store+XYListStore at 0x10f5c7a0)>>), 'iter': ('local', <Gtk.TreeIter object at 0x7feecc582be8 (GtkTreeIter at 0x1411b8c0)>)}
  File "PyXRD/mvc/adapters/gtk_support/treemodels/generic_tree_model.py", line 162, get_user_data(self=<xy_list_store.XYListStore object at 0x7feecc5f5...emodels+xy_list_store+XYListStore at 0x10f5c7a0)>, iter=<Gtk.TreeIter object at 0x7feecc582be8 (GtkTreeIter at 0x1411b8c0)>)
            else:
                return _get_user_data_as_pyobject(iter)
  variables: {'_get_user_data_as_pyobject': ('global', <function _get_user_data_as_pyobject at 0x7feeba09e400>), 'iter': ('local', <Gtk.TreeIter object at 0x7feecc582be8 (GtkTreeIter at 0x1411b8c0)>)}
  File "PyXRD/mvc/adapters/gtk_support/treemodels/generic_tree_model.py", line 52, _get_user_data_as_pyobject(iter=<Gtk.TreeIter object at 0x7feecc582be8 (GtkTreeIter at 0x1411b8c0)>)
            citer = _CTreeIter.from_iter(iter)
            return ctypes.cast(citer.contents.user_data, ctypes.py_object).value
  variables: {'value': (None, []), 'citer.contents.user_data': ('local', <mvc.adapters.gtk_support.treemodels.generic_tree_model._CTreeIter object at 0x7feecbf837b8>), 'ctypes.py_object': ('global', <class 'ctypes.py_object'>), 'ctypes.cast': ('global', <function cast at 0x7feef160ad90>)}
ValueError: PyObject is NULL

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.