Update msspec against its dependencies.
epsi-builds/msspec_python3/pipeline/head This commit looks good Details

MsSpec is now compatible with latest version of WX, of numpy,
scipy, matplotlib...
This commit is contained in:
Sylvain Tricot 2021-02-19 08:22:47 +01:00
parent 4096a5f738
commit ebb450024b
4 changed files with 47 additions and 32 deletions

View File

@ -19,7 +19,7 @@ endif
.PHONY: pybinding install devel venv doc clean .PHONY: pybinding install devel venv doc clean
pybinding: venv pybinding:
@+. $(VENV_PATH)/bin/activate && $(MAKE) -C src pybinding @+. $(VENV_PATH)/bin/activate && $(MAKE) -C src pybinding
@ -28,7 +28,7 @@ venv:
@. $(VENV_PATH)/bin/activate && pip install --upgrade pip && pip install -r src/pip.freeze @. $(VENV_PATH)/bin/activate && pip install --upgrade pip && pip install -r src/pip.freeze
install: pybinding install: venv pybinding
@+. $(VENV_PATH)/bin/activate && $(MAKE) -C src sdist @+. $(VENV_PATH)/bin/activate && $(MAKE) -C src sdist
@+. $(VENV_PATH)/bin/activate && $(MAKE) -C src frontend @+. $(VENV_PATH)/bin/activate && $(MAKE) -C src frontend
@+. $(VENV_PATH)/bin/activate && pip install src/dist/msspec-$(VERSION).tar.gz @+. $(VENV_PATH)/bin/activate && pip install src/dist/msspec-$(VERSION).tar.gz
@ -36,7 +36,7 @@ install: pybinding
devel: VENV_PATH = ./_venv devel: VENV_PATH = ./_venv
devel: pybinding venv devel: venv pybinding
@. $(VENV_PATH)/bin/activate && pip install -e src/ @. $(VENV_PATH)/bin/activate && pip install -e src/

View File

@ -59,6 +59,7 @@ from subprocess import Popen
import ase.atom import ase.atom
import ase.atoms import ase.atoms
import ase.data import ase.data
from ase.io.extxyz import write_xyz
import numpy as np import numpy as np
from ase.calculators.calculator import Calculator from ase.calculators.calculator import Calculator
from terminaltables.ascii_table import AsciiTable from terminaltables.ascii_table import AsciiTable
@ -548,7 +549,8 @@ class _MSCALCULATOR(Calculator):
def add_cluster_to_dset(self, dset): def add_cluster_to_dset(self, dset):
clusbuf = StringIO() clusbuf = StringIO()
self.atoms.info['absorber'] = self.atoms.absorber self.atoms.info['absorber'] = self.atoms.absorber
self.atoms.write(clusbuf, format='xyz') #self.atoms.write(clusbuf, format='xyz')
write_xyz(clusbuf, self.atoms)
dset.add_parameter(group='Cluster', name='cluster', value=clusbuf.getvalue(), hidden="True") dset.add_parameter(group='Cluster', name='cluster', value=clusbuf.getvalue(), hidden="True")
def shutdown(self): def shutdown(self):
@ -756,10 +758,11 @@ class _PED(_MSCALCULATOR):
legend=r'$\Re(f(\theta))$') legend=r'$\Re(f(\theta))$')
# save the cluster # save the cluster
clusbuf = StringIO() #clusbuf = StringIO()
self.atoms.info['absorber'] = self.atoms.absorber #self.atoms.info['absorber'] = self.atoms.absorber
self.atoms.write(clusbuf, format='xyz') #self.atoms.write(clusbuf, format='xyz')
dset.add_parameter(group='Cluster', name='cluster', value=clusbuf.getvalue(), hidden="True") #dset.add_parameter(group='Cluster', name='cluster', value=clusbuf.getvalue(), hidden="True")
self.add_cluster_to_dset(dset)
LOGGER.info('%s scan computing done!', scan_type) LOGGER.info('%s scan computing done!', scan_type)

View File

@ -75,6 +75,7 @@ from io import StringIO
from datetime import datetime from datetime import datetime
import ase.io import ase.io
from ase.io.extxyz import read_xyz, write_xyz
import h5py import h5py
import numpy as np import numpy as np
import wx.grid import wx.grid
@ -180,8 +181,8 @@ class DataSet(object):
float: '{:<20.10e}', complex: 's'} float: '{:<20.10e}', complex: 's'}
self._formats = ((np.integer, '{:<20d}'), self._formats = ((np.integer, '{:<20d}'),
(np.floating, '{:<20.10e}'), (np.floating, '{:<20.10e}'),
(np.complex, '({0.real:<.10e} {0.imag:<.10e}j)'), (complex, '({0.real:<.10e} {0.imag:<.10e}j)'),
(np.bool, '{:s}'), (bool, '{:s}'),
(str, '{:s}')) (str, '{:s}'))
@ -395,9 +396,13 @@ class DataSet(object):
:return: The cluster :return: The cluster
:rtype: :py:class:`ase.Atoms` :rtype: :py:class:`ase.Atoms`
""" """
p = self.get_parameter(group='Cluster', name='cluster')['value']
s = StringIO() s = StringIO()
s.write(self.get_parameter(group='Cluster', name='cluster')['value']) s.write(self.get_parameter(group='Cluster', name='cluster')['value'])
return ase.io.read(s, format='xyz') s.seek(0)
#return ase.io.read(s, format='xyz')
cluster = list(read_xyz(s))[-1]
return cluster
def select(self, *args, **kwargs): def select(self, *args, **kwargs):
@ -730,13 +735,13 @@ class Data(object):
dset = output.add_dset(dset_name) dset = output.add_dset(dset_name)
dset.notes = fd['DATA'][dset_name].attrs['notes'] dset.notes = fd['DATA'][dset_name].attrs['notes']
for h5dset in fd['DATA'][dset_name]: for h5dset in fd['DATA'][dset_name]:
dset.add_columns(**{h5dset: fd['DATA'][dset_name][h5dset].value}) dset.add_columns(**{h5dset: fd['DATA'][dset_name][h5dset][...]})
try: try:
vfile = LooseVersion(fd['MsSpec viewer metainfo'].attrs['version']) vfile = LooseVersion(fd['MsSpec viewer metainfo'].attrs['version'])
if vfile > LooseVersion(msspec.__version__): if vfile > LooseVersion(msspec.__version__):
raise NameError('File was saved with a more recent format') raise NameError('File was saved with a more recent format')
xml = fd['MsSpec viewer metainfo']['info'].value.tostring() xml = fd['MsSpec viewer metainfo']['info'][...].tobytes()
root = etree.fromstring(xml) root = etree.fromstring(xml)
for elt0 in root.iter('parameters'): for elt0 in root.iter('parameters'):
dset_name = elt0.attrib['dataset'] dset_name = elt0.attrib['dataset']
@ -868,7 +873,8 @@ class _DataSetView(object):
if np.shape(values)[0] == 1: if np.shape(values)[0] == 1:
xvalues = list(range(len(values[0]))) xvalues = list(range(len(values[0])))
axes.bar(xvalues, values[0], label=label, axes.bar(xvalues, values[0], label=label,
picker=5) # picker=5
)
axes.set_xticks(xvalues) axes.set_xticks(xvalues)
else: else:
if proj in ('ortho', 'stereo'): if proj in ('ortho', 'stereo'):
@ -890,7 +896,7 @@ class _DataSetView(object):
elif proj == 'polar': elif proj == 'polar':
values[0] = np.radians(values[0]) values[0] = np.radians(values[0])
axes.plot(*values, label=label, picker=5, axes.plot(*values, label=label, #picker=5,
marker=opts['marker']) marker=opts['marker'])
else: else:
if scale == 'semilogx': if scale == 'semilogx':
@ -901,7 +907,7 @@ class _DataSetView(object):
pltcmd = axes.loglog pltcmd = axes.loglog
else: else:
pltcmd = axes.plot pltcmd = axes.plot
pltcmd(*values, label=label, picker=5, pltcmd(*values, label=label, #picker=5,
marker=opts['marker']) marker=opts['marker'])
axes.grid(opts['grid']) axes.grid(opts['grid'])
axes.set_title(opts['title']) axes.set_title(opts['title'])
@ -909,6 +915,7 @@ class _DataSetView(object):
axes.set_ylabel(opts['ylabel']) axes.set_ylabel(opts['ylabel'])
axes.set_xlim(*opts['xlim']) axes.set_xlim(*opts['xlim'])
axes.set_ylim(*opts['ylim']) axes.set_ylim(*opts['ylim'])
#axes.set_pickradius(5)
if label: if label:
axes.legend() axes.legend()
axes.autoscale(enable=opts['autoscale']) axes.autoscale(enable=opts['autoscale'])
@ -1221,9 +1228,14 @@ class _DataWindow(wx.Frame):
cluster_viewer = ClusterViewer(win, size=wx.Size(480, 340)) cluster_viewer = ClusterViewer(win, size=wx.Size(480, 340))
dset = self.data[self._current_dset] dset = self.data[self._current_dset]
s = StringIO() #s = StringIO()
s.write(dset.get_parameter(group='Cluster', name='cluster')['value']) #s.write(dset.get_parameter(group='Cluster', name='cluster')['value'])
atoms = ase.io.read(s, format='xyz') #_s = dset.get_parameter(group='Cluster', name='cluster')['value']
#print(_s)
# rewind to the begining of the string
#s.seek(0)
#atoms = ase.io.read(s, format='xyz')
atoms = dset.get_cluster()
cluster_viewer.set_atoms(atoms, rescale=True, center=True) cluster_viewer.set_atoms(atoms, rescale=True, center=True)
cluster_viewer.rotate_atoms(0., 180.) cluster_viewer.rotate_atoms(0., 180.)
cluster_viewer.rotate_atoms(-45., -45.) cluster_viewer.rotate_atoms(-45., -45.)
@ -1388,7 +1400,8 @@ class _DataWindow(wx.Frame):
menu = self.GetMenuBar().GetMenu(menu_id) menu = self.GetMenuBar().GetMenu(menu_id)
for item in menu.GetMenuItems(): for item in menu.GetMenuItems():
if item.IsChecked(): if item.IsChecked():
sb.SetStatusText("%s" % item.GetText(), 1) #sb.SetStatusText("%s" % item.GetText(), 1)
sb.SetStatusText("%s" % item.GetItemLabelText(), 1)
break break
def update_title(self): def update_title(self):

View File

@ -1,14 +1,13 @@
ase==3.19.1 ase
h5py==2.10.0 h5py
ipython==7.13.0 ipython
lxml==4.5.0 lxml
matplotlib==2.1.1 matplotlib
numpy==1.18.2 numpy
Pint==0.11 Pint
#pip==20.0.2 pycairo
pycairo==1.19.1 scipy
scipy==1.4.1 setuptools-scm
setuptools-scm==3.5.0 terminaltables
terminaltables==3.1.0
#wxPython@https://extras.wxpython.org/wxPython4/extras/linux/gtk3/debian-10/wxPython-4.1.0-cp37-cp37m-linux_x86_64.whl #wxPython@https://extras.wxpython.org/wxPython4/extras/linux/gtk3/debian-10/wxPython-4.1.0-cp37-cp37m-linux_x86_64.whl
#wxPython@https://extras.wxpython.org/wxPython4/extras/linux/gtk3/debian-9/wxPython-4.0.7.post2-cp35-cp35m-linux_x86_64.whl #wxPython@https://extras.wxpython.org/wxPython4/extras/linux/gtk3/debian-9/wxPython-4.0.7.post2-cp35-cp35m-linux_x86_64.whl