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
|
||||
@$(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:
|
||||
# Check if virtualenv python version > 3.3.0
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
# along with this msspec. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# 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>
|
||||
|
||||
|
||||
|
@ -79,19 +79,26 @@ import ase.io
|
|||
from ase.io.extxyz import read_xyz, write_xyz
|
||||
import h5py
|
||||
import numpy as np
|
||||
import wx.grid
|
||||
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_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 terminaltables import AsciiTable
|
||||
|
||||
import msspec
|
||||
from msspec.msspecgui.msspec.gui.clusterviewer import ClusterViewer
|
||||
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):
|
||||
# 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.
|
||||
|
||||
"""
|
||||
if has_gui:
|
||||
app = wx.App(False)
|
||||
app.SetAppName('MsSpec Data Viewer')
|
||||
frame = _DataWindow(self)
|
||||
frame.Show(True)
|
||||
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):
|
||||
|
@ -895,7 +908,8 @@ class _DataSetView(object):
|
|||
axes.set_yticks(R_ticks)
|
||||
axes.set_yticklabels(theta_ticks)
|
||||
|
||||
figure.colorbar(im)
|
||||
cbar = figure.colorbar(im)
|
||||
#im.set_clim(0, 0.0275)
|
||||
|
||||
elif proj == 'polar':
|
||||
values[0] = np.radians(values[0])
|
||||
|
@ -918,6 +932,7 @@ class _DataSetView(object):
|
|||
axes.set_ylabel(opts['ylabel'])
|
||||
axes.set_xlim(*opts['xlim'])
|
||||
axes.set_ylim(*opts['ylim'])
|
||||
#axes.set_axis_off()
|
||||
#axes.set_pickradius(5)
|
||||
if label:
|
||||
axes.legend()
|
||||
|
@ -1008,7 +1023,8 @@ class _DataSetView(object):
|
|||
s += '\tconditions : %s\n' % str(self._selection_conditions)
|
||||
return s
|
||||
|
||||
class _GridWindow(wx.Frame):
|
||||
if has_gui:
|
||||
class _GridWindow(wx.Frame):
|
||||
def __init__(self, dset, parent=None):
|
||||
title = 'Data: ' + dset.title
|
||||
wx.Frame.__init__(self, parent, title=title, size=(640, 480))
|
||||
|
@ -1022,7 +1038,7 @@ class _GridWindow(wx.Frame):
|
|||
for iv, v in enumerate(dset[c]):
|
||||
grid.SetCellValue(iv, ic, str(v))
|
||||
|
||||
class _ParametersWindow(wx.Frame):
|
||||
class _ParametersWindow(wx.Frame):
|
||||
def __init__(self, dset, parent=None):
|
||||
title = 'Parameters: ' + dset.title
|
||||
wx.Frame.__init__(self, parent, title=title, size=(400, 480))
|
||||
|
@ -1050,7 +1066,7 @@ class _ParametersWindow(wx.Frame):
|
|||
tree.ExpandAll()
|
||||
tree.SelectItem(root)
|
||||
|
||||
class _DataWindow(wx.Frame):
|
||||
class _DataWindow(wx.Frame):
|
||||
def __init__(self, data):
|
||||
assert isinstance(data, (Data, DataSet))
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ PYMAJ = 3
|
|||
PYMIN = 5
|
||||
|
||||
FC = gfortran
|
||||
F2PY = f2py3 --f77exec=$(FC) --f90exec=$(FC)
|
||||
F2PY = f2py --f77exec=$(FC) --f90exec=$(FC)
|
||||
|
||||
NO_VENV = 0
|
||||
DEBUG = 0
|
||||
|
|
Loading…
Reference in New Issue