Provide a "nogui" target in the installation.
It is possible to install msspec without gui, which reduces a lot the number of dependencies. It is still possible to export the results as *.png or to view the cluster with the ase gui.
This commit is contained in:
parent
583eb08924
commit
4aec48b4f6
5
Makefile
5
Makefile
|
@ -37,6 +37,11 @@ light: VENV_PATH = ./_venv
|
||||||
light: venv
|
light: venv
|
||||||
@$(INSIDE_VENV) pip install src/
|
@$(INSIDE_VENV) pip install src/
|
||||||
|
|
||||||
|
nogui: VENV_PATH = ./_venv
|
||||||
|
nogui: venv
|
||||||
|
@$(INSIDE_VENV) pip install --no-cache-dir --upgrade -r src/pip.freeze
|
||||||
|
@$(INSIDE_VENV) pip install -e src/
|
||||||
|
@+$(INSIDE_VENV) $(MAKE) -C src pybinding
|
||||||
|
|
||||||
_attrdict:
|
_attrdict:
|
||||||
# Check if virtualenv python version > 3.3.0
|
# Check if virtualenv python version > 3.3.0
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
# along with this msspec. If not, see <http://www.gnu.org/licenses/>.
|
# along with this msspec. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
# Source file : src/msspec/iodata.py
|
# Source file : src/msspec/iodata.py
|
||||||
# Last modified: Mon, 11 Mar 2024 09:51:47 +0100
|
# Last modified: Tue, 22 Oct 2024 12:39:54 +0200
|
||||||
# Committed by : Sylvain Tricot <sylvain.tricot@univ-rennes.fr>
|
# Committed by : Sylvain Tricot <sylvain.tricot@univ-rennes.fr>
|
||||||
|
|
||||||
|
|
||||||
|
@ -79,19 +79,26 @@ import ase.io
|
||||||
from ase.io.extxyz import read_xyz, write_xyz
|
from ase.io.extxyz import read_xyz, write_xyz
|
||||||
import h5py
|
import h5py
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import wx.grid
|
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
|
|
||||||
#from matplotlib.backends.backend_wxagg import FigureCanvasWx as FigureCanvas
|
#from matplotlib.backends.backend_wxagg import FigureCanvasWx as FigureCanvas
|
||||||
from matplotlib.backends.backend_agg import FigureCanvasAgg
|
from matplotlib.backends.backend_agg import FigureCanvasAgg
|
||||||
from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg
|
#from matplotlib.backends.backend_cairo import FigureCanvasCairo as FigureCanvasAgg
|
||||||
from matplotlib.figure import Figure
|
from matplotlib.figure import Figure
|
||||||
from terminaltables import AsciiTable
|
from terminaltables import AsciiTable
|
||||||
|
|
||||||
import msspec
|
import msspec
|
||||||
from msspec.msspecgui.msspec.gui.clusterviewer import ClusterViewer
|
|
||||||
from msspec.misc import LOGGER
|
from msspec.misc import LOGGER
|
||||||
|
|
||||||
|
try:
|
||||||
|
import wx.grid
|
||||||
|
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
|
||||||
|
from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg
|
||||||
|
from msspec.msspecgui.msspec.gui.clusterviewer import ClusterViewer
|
||||||
|
has_gui = True
|
||||||
|
except ImportError:
|
||||||
|
LOGGER.warning('No modules for GUI')
|
||||||
|
has_gui = False
|
||||||
|
|
||||||
|
|
||||||
def cols2matrix(x, y, z, nx=88*1+1, ny=360*1+1):
|
def cols2matrix(x, y, z, nx=88*1+1, ny=360*1+1):
|
||||||
# mix the values of existing theta and new theta and return the
|
# mix the values of existing theta and new theta and return the
|
||||||
|
@ -796,11 +803,17 @@ class Data(object):
|
||||||
"""Pops up a grphical window to show all the defined views of the Data object.
|
"""Pops up a grphical window to show all the defined views of the Data object.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
if has_gui:
|
||||||
app = wx.App(False)
|
app = wx.App(False)
|
||||||
app.SetAppName('MsSpec Data Viewer')
|
app.SetAppName('MsSpec Data Viewer')
|
||||||
frame = _DataWindow(self)
|
frame = _DataWindow(self)
|
||||||
frame.Show(True)
|
frame.Show(True)
|
||||||
app.MainLoop()
|
app.MainLoop()
|
||||||
|
else:
|
||||||
|
print('**** INFORMATION ****')
|
||||||
|
print('You can not use the Data.view() method since ther is no')
|
||||||
|
print('graphical user interface available in this version of MsSpec.')
|
||||||
|
print("Install WxPython if you need it or use Data.export(...) method instead.")
|
||||||
|
|
||||||
|
|
||||||
class _DataSetView(object):
|
class _DataSetView(object):
|
||||||
|
@ -895,7 +908,8 @@ class _DataSetView(object):
|
||||||
axes.set_yticks(R_ticks)
|
axes.set_yticks(R_ticks)
|
||||||
axes.set_yticklabels(theta_ticks)
|
axes.set_yticklabels(theta_ticks)
|
||||||
|
|
||||||
figure.colorbar(im)
|
cbar = figure.colorbar(im)
|
||||||
|
#im.set_clim(0, 0.0275)
|
||||||
|
|
||||||
elif proj == 'polar':
|
elif proj == 'polar':
|
||||||
values[0] = np.radians(values[0])
|
values[0] = np.radians(values[0])
|
||||||
|
@ -918,6 +932,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_axis_off()
|
||||||
#axes.set_pickradius(5)
|
#axes.set_pickradius(5)
|
||||||
if label:
|
if label:
|
||||||
axes.legend()
|
axes.legend()
|
||||||
|
@ -1008,6 +1023,7 @@ class _DataSetView(object):
|
||||||
s += '\tconditions : %s\n' % str(self._selection_conditions)
|
s += '\tconditions : %s\n' % str(self._selection_conditions)
|
||||||
return s
|
return s
|
||||||
|
|
||||||
|
if has_gui:
|
||||||
class _GridWindow(wx.Frame):
|
class _GridWindow(wx.Frame):
|
||||||
def __init__(self, dset, parent=None):
|
def __init__(self, dset, parent=None):
|
||||||
title = 'Data: ' + dset.title
|
title = 'Data: ' + dset.title
|
||||||
|
|
|
@ -3,7 +3,7 @@ PYMAJ = 3
|
||||||
PYMIN = 5
|
PYMIN = 5
|
||||||
|
|
||||||
FC = gfortran
|
FC = gfortran
|
||||||
F2PY = f2py3 --f77exec=$(FC) --f90exec=$(FC)
|
F2PY = f2py --f77exec=$(FC) --f90exec=$(FC)
|
||||||
|
|
||||||
NO_VENV = 0
|
NO_VENV = 0
|
||||||
DEBUG = 0
|
DEBUG = 0
|
||||||
|
|
Loading…
Reference in New Issue