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
pybinding: venv
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
install: pybinding
install: venv pybinding
@+. $(VENV_PATH)/bin/activate && $(MAKE) -C src sdist
@+. $(VENV_PATH)/bin/activate && $(MAKE) -C src frontend
@+. $(VENV_PATH)/bin/activate && pip install src/dist/msspec-$(VERSION).tar.gz
@ -36,7 +36,7 @@ install: pybinding
devel: VENV_PATH = ./_venv
devel: pybinding venv
devel: venv pybinding
@. $(VENV_PATH)/bin/activate && pip install -e src/

View File

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

View File

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

View File

@ -1,14 +1,13 @@
ase==3.19.1
h5py==2.10.0
ipython==7.13.0
lxml==4.5.0
matplotlib==2.1.1
numpy==1.18.2
Pint==0.11
#pip==20.0.2
pycairo==1.19.1
scipy==1.4.1
setuptools-scm==3.5.0
terminaltables==3.1.0
ase
h5py
ipython
lxml
matplotlib
numpy
Pint
pycairo
scipy
setuptools-scm
terminaltables
#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