mirror of https://github.com/abinit/abipy.git
Fix flak8 warnings, make ipython hard-dep
This commit is contained in:
parent
084fa939a0
commit
313703278b
|
@ -356,7 +356,7 @@ def software_stack(as_dataframe=False):
|
|||
try:
|
||||
mod = import_module(pkg_name)
|
||||
return mod.__version__
|
||||
except:
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
try:
|
||||
|
|
|
@ -749,7 +749,7 @@ def structure_from_abistruct_fmt(string):
|
|||
v = xred[iatom]
|
||||
lines.append("%.16f %.16f %.16f" % (v[0], v[1], v[2]))
|
||||
|
||||
s = "\n".join(head) + "\n" + "\n".join(lines) #; print(s)
|
||||
s = "\n".join(head) + "\n" + "\n".join(lines) #; print(s)
|
||||
|
||||
return AbinitInputFile.from_string(s).structure
|
||||
|
||||
|
|
|
@ -1503,7 +1503,7 @@ def conduc_kerange_from_inputs(scf_input, nscf_input, tmesh, ddb_ngqpt, eph_ngqp
|
|||
sigma_kerange[0] += epad
|
||||
if e_range > 0:
|
||||
sigma_kerange[1] += epad
|
||||
|
||||
|
||||
# Modify the second nscf input to get a task that calculate the kpt in the sigma interval (Kerange.nc file)
|
||||
multi[2].set_vars(optdriver=8, wfk_task='"wfk_kpts_erange"', kptopt=1,
|
||||
sigma_ngkpt=sigma_ngkpt, einterp=einterp, sigma_erange=sigma_kerange)
|
||||
|
|
|
@ -1138,7 +1138,7 @@ class KpointList(collections.abc.Sequence):
|
|||
|
||||
def plotly(self, fig=None, **kwargs):
|
||||
"""Plot k-points with plotly."""
|
||||
from abipy.tools.plotting import plotly_wigner_seitz, plotly_brillouin_zone
|
||||
from abipy.tools.plotting import plotly_brillouin_zone
|
||||
fold = False
|
||||
if self.is_path:
|
||||
labels = {k.name: k.frac_coords for k in self if k.name}
|
||||
|
|
|
@ -729,6 +729,7 @@ abilab.enable_notebook(with_seaborn=True)
|
|||
nbformat.write(nb, fh)
|
||||
return nbpath
|
||||
|
||||
|
||||
class NotebookWriter(HasNotebookTools, metaclass=abc.ABCMeta):
|
||||
"""
|
||||
Mixin class for objects that are able to generate jupyter_ notebooks.
|
||||
|
@ -850,7 +851,7 @@ class NotebookWriter(HasNotebookTools, metaclass=abc.ABCMeta):
|
|||
This function *generates* a predefined list of plotly figures with minimal input from the user.
|
||||
Relies on yield_plotly_figs implemented by the subclass to generate the figures.
|
||||
"""
|
||||
print("in plotly expose")
|
||||
#print("in plotly expose")
|
||||
|
||||
pn, template = self._get_panel_and_template()
|
||||
pn.config.sizing_mode = 'stretch_width'
|
||||
|
|
|
@ -1315,7 +1315,6 @@ class Structure(pmg_Structure, NotebookWriter):
|
|||
Args:
|
||||
with_cart_coords: True if Cartesian coordinates should be added as well.
|
||||
"""
|
||||
from collections import defaultdict
|
||||
if with_cart_coords:
|
||||
group = {symb: {"site_idx": [], "frac_coords": [], "cart_coords": []} for symb in self.symbol_set}
|
||||
else:
|
||||
|
@ -1339,8 +1338,8 @@ class Structure(pmg_Structure, NotebookWriter):
|
|||
@add_fig_kwargs
|
||||
def plot(self, **kwargs):
|
||||
"""
|
||||
Plot structure in 3D with matplotlib. Return matplotlib Figure
|
||||
See plot_structure for kwargs
|
||||
Plot structure in 3D with matplotlib. Return matplotlib Figure.
|
||||
See plot_structure for kwargs.
|
||||
"""
|
||||
from abipy.tools.plotting import plot_structure
|
||||
return plot_structure(self, **kwargs)
|
||||
|
@ -1348,7 +1347,7 @@ class Structure(pmg_Structure, NotebookWriter):
|
|||
@add_plotly_fig_kwargs
|
||||
def plotly(self, **kwargs):
|
||||
"""
|
||||
Plot structure in 3D with plotly. Return plotly Figure
|
||||
Plot structure in 3D with plotly. Return plotly Figure.
|
||||
See plot_structure for kwargs
|
||||
"""
|
||||
from abipy.tools.plotting import plotly_structure
|
||||
|
|
|
@ -1124,8 +1124,8 @@ See also <https://forum.abinit.org/viewtopic.php?f=10&t=545>
|
|||
# Scatter plot with Bose-Einstein occupation factors for T = temp
|
||||
factor = abu.phfactor_ev2units(units)
|
||||
if temp < 1: temp = 1
|
||||
fig.layout.annotations=[dict(text="T = %.1f K" % temp, font_size=fontsize, x=0.5, xref='paper',
|
||||
xanchor='center', y=1, yref='paper', yanchor='bottom' ,showarrow=False)]
|
||||
fig.layout.annotations = [dict(text="T = %.1f K" % temp, font_size=fontsize, x=0.5, xref='paper',
|
||||
xanchor='center', y=1, yref='paper', yanchor='bottom', showarrow=False)]
|
||||
xs = np.arange(self.num_qpoints)
|
||||
for nu in self.branches:
|
||||
ws = self.phfreqs[:, nu]
|
||||
|
|
|
@ -10,7 +10,7 @@ from abipy.dfpt.ddb import DdbFile
|
|||
from abipy.dfpt.phonons import PhononBands, get_dyn_mat_eigenvec, match_eigenvectors
|
||||
from abipy.abio.inputs import AnaddbInput
|
||||
from abipy.tools.plotting import add_fig_kwargs, get_ax_fig_plt, set_visible, get_fig_plotly, get_figs_plotly, \
|
||||
add_plotly_fig_kwargs, plotlyfigs_to_browser, push_to_chart_studio, PlotlyRowColDesc
|
||||
add_plotly_fig_kwargs, plotlyfigs_to_browser, PlotlyRowColDesc
|
||||
from pymatgen.core.units import bohr_to_angstrom, eV_to_Ha
|
||||
|
||||
|
||||
|
@ -353,10 +353,10 @@ class SoundVelocity(Has_Structure, NotebookWriter):
|
|||
|
||||
if fig is None:
|
||||
fig, _ = get_fig_plotly()
|
||||
fig.layout=dict(annotations=[dict(text=title, font_size=fontsize, x=0.5, xref='paper', xanchor='center',
|
||||
y=1, yref='paper', yanchor='bottom' ,showarrow=False)],
|
||||
yaxis_title_text=abu.wlabel_from_units(units, unicode=True),
|
||||
xaxis_title_text= "Wave Vector")
|
||||
fig.layout = dict(annotations=[dict(text=title, font_size=fontsize, x=0.5, xref='paper', xanchor='center',
|
||||
y=1, yref='paper', yanchor='bottom' ,showarrow=False)],
|
||||
yaxis_title_text=abu.wlabel_from_units(units, unicode=True),
|
||||
xaxis_title_text="Wave Vector")
|
||||
else:
|
||||
fig.layout.annotations[idir].text = title
|
||||
fig.layout.annotations[idir].font.size = fontsize
|
||||
|
@ -429,7 +429,7 @@ class SoundVelocity(Has_Structure, NotebookWriter):
|
|||
horizontal_spacing=0.05)
|
||||
|
||||
for i in range(self.n_directions):
|
||||
rcd = PlotlyRowColDesc(i//2, i%2, nrows, ncols)
|
||||
rcd = PlotlyRowColDesc(i // 2, i % 2, nrows, ncols)
|
||||
self.plotly_fit_freqs_dir(i, fig, rcd, units=units, fontsize=fontsize, show=False)
|
||||
|
||||
return fig
|
||||
|
|
|
@ -449,7 +449,6 @@ class HistFile(AbinitNcFile, NotebookWriter):
|
|||
# yield self.plotly(show=False)
|
||||
# yield self.plotly_energies(show=False)
|
||||
|
||||
|
||||
def mvplot_trajectories(self, colormap="hot", sampling=1, figure=None, show=True,
|
||||
with_forces=True, **kwargs): # pragma: no cover
|
||||
"""
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# coding: utf-8
|
||||
"""Density/potential files in netcdf/fortran format."""
|
||||
import os
|
||||
import tempfile
|
||||
#import tempfile
|
||||
#import numpy as np
|
||||
|
||||
from monty.string import marquee
|
||||
|
|
|
@ -1410,7 +1410,7 @@ class ElectronBands(Has_Structure):
|
|||
|
||||
if unicode:
|
||||
import re
|
||||
numl=re.findall(r'\d', formula)
|
||||
numl = re.findall(r'\d', formula)
|
||||
for s in numl:
|
||||
formula = formula.replace(s,SUBSCRIPT_UNICODE[s])
|
||||
|
||||
|
@ -1459,7 +1459,6 @@ class ElectronBands(Has_Structure):
|
|||
k0_list.append(k)
|
||||
effmass_bands_f90.append(v)
|
||||
|
||||
|
||||
# Set small values to zero.
|
||||
k0_list = np.reshape(k0_list, (-1, 3))
|
||||
k0_list = np.where(np.abs(k0_list) > 1e-12, k0_list, 0.0)
|
||||
|
@ -2105,7 +2104,7 @@ class ElectronBands(Has_Structure):
|
|||
ply_row, ply_col = rcd.ply_row, rcd.ply_col
|
||||
|
||||
# Decorate the axis (e.g add ticks and labels).
|
||||
self.decorate_plotly(fig, klabels=klabels, iax = rcd.iax)
|
||||
self.decorate_plotly(fig, klabels=klabels, iax=rcd.iax)
|
||||
plotly_set_lims(fig, ylims, "y")
|
||||
|
||||
# Plot the band energies.
|
||||
|
@ -2386,12 +2385,12 @@ class ElectronBands(Has_Structure):
|
|||
fig.add_scatter(x=xx, y=yy, mode="lines", name=label, showlegend=showlegend, line=line_opts, **kwargs,
|
||||
row=ply_row, col=ply_col)
|
||||
label = ''
|
||||
showlegend=False
|
||||
showlegend = False
|
||||
|
||||
if with_linewidths:
|
||||
w = self.linewidths[spin, :, band] * lw_fact / 2
|
||||
lw_color = lines[-1].get_color()
|
||||
raise NotImplementedError
|
||||
#lw_color = lines[-1].get_color()
|
||||
# solution 1: Use scater points to fill
|
||||
# solution 2: add two traces and fill the area between
|
||||
# color problem
|
||||
|
@ -3978,7 +3977,7 @@ class ElectronDos(object):
|
|||
fig.add_scatter(x=x, y=y, mode='lines', name=trace_name, showlegend=showlegend, line=opts, **kwargs)
|
||||
|
||||
xlabel, ylabel = 'Energy (eV)', 'DOS (states/eV)'
|
||||
if exchange_xy: xlabel, ylabel = ylabel, xlabel
|
||||
if exchange_xy: xlabel, ylabel = ylabel, xlabel
|
||||
fig.layout.xaxis.title = xlabel
|
||||
fig.layout.yaxis.title = ylabel
|
||||
plotly_set_lims(fig, xlims, "x")
|
||||
|
|
|
@ -625,7 +625,8 @@ class RtaRobot(Robot, RobotWithEbands):
|
|||
#def get_mobility_mu_dataframe(self, eh=0, component='xx', itemp=0, spin=0, **kwargs):
|
||||
|
||||
@add_fig_kwargs
|
||||
def plot_mobility_kconv(self, eh=0, bte=['serta','mrta','ibte'], component='xx', itemp=0, spin=0, fontsize=14, ax=None, **kwargs):
|
||||
def plot_mobility_kconv(self, eh=0, bte=('serta', 'mrta', 'ibte'), component='xx', itemp=0, spin=0,
|
||||
fontsize=14, ax=None, **kwargs):
|
||||
"""
|
||||
Plot the convergence of the mobility as a function of the number of k-points,
|
||||
for different transport formalisms included in the computation.
|
||||
|
@ -662,9 +663,9 @@ class RtaRobot(Robot, RobotWithEbands):
|
|||
if 'serta' in bte:
|
||||
mob_serta = ncfile.reader.read_variable("mobility_mu")[0, spin, itemp, eh, j, i]
|
||||
if 'mrta' in bte:
|
||||
mob_mrta = ncfile.reader.read_variable("mobility_mu")[1, spin, itemp, eh, j, i]
|
||||
mob_mrta = ncfile.reader.read_variable("mobility_mu")[1, spin, itemp, eh, j, i]
|
||||
if 'ibte' in bte:
|
||||
mob_ibte = ncfile.reader.read_variable("ibte_mob")[spin, itemp, eh, j, i]
|
||||
mob_ibte = ncfile.reader.read_variable("ibte_mob")[spin, itemp, eh, j, i]
|
||||
|
||||
res.append([kptrlattx, mob_serta, mob_mrta, mob_ibte])
|
||||
temps.append(ncfile.tmesh[itemp])
|
||||
|
@ -789,7 +790,7 @@ class RtaRobot(Robot, RobotWithEbands):
|
|||
#if self.all_have_ibte:
|
||||
yield self.plot_ibte_mrta_serta_conv(show=False)
|
||||
yield self.plot_ibte_vs_rta_rho(show=False)
|
||||
|
||||
|
||||
# Determine the independent component. For the time being,
|
||||
# only consider the cubic case separately
|
||||
abifile = self.abifiles[0]
|
||||
|
|
|
@ -15,6 +15,7 @@ import abipy.data as abidata
|
|||
|
||||
from abipy import flowtk
|
||||
|
||||
|
||||
def make_scf_input(ngkpt, paral_kgb=0):
|
||||
"""
|
||||
This function constructs the input file for the GS calculation for a given IBZ sampling.
|
||||
|
|
|
@ -13,8 +13,6 @@ import abipy.abilab as abilab
|
|||
import abipy.flowtk as flowtk
|
||||
import abipy.core.abinit_units as abu
|
||||
|
||||
from abipy.abilab import abiopen
|
||||
|
||||
|
||||
def build_flow(options):
|
||||
# Working directory (default is the name of the script with '.py' removed and "run_" replaced by "flow_")
|
||||
|
|
|
@ -14,6 +14,7 @@ from abipy import abilab
|
|||
|
||||
# NB: This flow requires abinit >= "8.5.2"
|
||||
|
||||
|
||||
def make_scf_input(ecut=10, ngkpt=(8, 8, 8)):
|
||||
"""
|
||||
This function constructs an `AbinitInput` for performing a
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
#!/usr/bin/env python
|
||||
r"""
|
||||
Phonopy + Abinit Flow
|
||||
=====================
|
||||
Phonopy with AbiPy Flow
|
||||
=======================
|
||||
|
||||
This example shows how to compute phonon frequencies with phonopy
|
||||
(supercells and finite-difference method).
|
||||
|
||||
This approach could be useful to obtain vibrational properties with XC functionals
|
||||
for which DFPT is not yet implemented.
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ import abipy.data as abidata
|
|||
|
||||
phdos_path = abidata.ref_file("al_161616q_PHDOS.nc")
|
||||
|
||||
ncfile = abilab.abiopen(abidata.ref_file("al_888k_161616q_A2F.nc"))
|
||||
ncfile = abilab.abiopen(abidata.ref_file("al_888k_161616q_A2F.nc"))
|
||||
print(ncfile)
|
||||
|
||||
#ncfile.phbands.plot()
|
||||
|
|
|
@ -582,7 +582,7 @@ qadapters:
|
|||
qname: localhost
|
||||
job:
|
||||
mpi_runner: mpirun
|
||||
pre_run:
|
||||
pre_run:
|
||||
# List of shell commands executed before running abinit
|
||||
# Change this part according to your Abinit installation and the location of the shared libs
|
||||
- export OMP_NUM_THREADS=1
|
||||
|
@ -623,15 +623,15 @@ Cannot locate `{cls.YAML_FILE}` neither in current directory nor in `{path}`
|
|||
|
||||
!!! PLEASE READ THIS !!!
|
||||
|
||||
To run AbiPy flows you need a manager.yaml describing your computer/cluster
|
||||
To run AbiPy flows you need a manager.yaml describing your computer/cluster
|
||||
as well as the job submission engine being used (shell, Slurm, PBS, etc).
|
||||
|
||||
|
||||
Examples are provided in the `abipy/data/managers` directory.
|
||||
Use `abidoc.py manager` to access the documentation from the terminal.
|
||||
See also https://abinit.github.io/abipy/workflows/manager_examples.html for examples.
|
||||
|
||||
|
||||
A minimalistic example of manager.yml for a laptop with the shell engine is reported below:
|
||||
|
||||
|
||||
{cls.get_simple_manager()}
|
||||
|
||||
""", color="red"))
|
||||
|
@ -3945,7 +3945,8 @@ class KerangeTask(AbinitTask):
|
|||
"""
|
||||
Class for kerange calculations.
|
||||
"""
|
||||
color_rgb = np.array((255, 128, 0)) / 255
|
||||
color_rgb = np.array((255, 128, 128)) / 255
|
||||
|
||||
|
||||
class ManyBodyTask(AbinitTask):
|
||||
"""
|
||||
|
|
|
@ -468,9 +468,9 @@ class NodeContainer(metaclass=abc.ABCMeta):
|
|||
kwargs.update({"manager": seq_manager})
|
||||
|
||||
if eph_inp.get("eph_task",0) == -4:
|
||||
max_cores = TaskManager.from_user_config().qadapter.max_cores
|
||||
natom3 = 3 * len(eph_inp.structure)
|
||||
nprocs = max(max_cores - max_cores % natom3, 1)
|
||||
max_cores = TaskManager.from_user_config().qadapter.max_cores
|
||||
natom3 = 3 * len(eph_inp.structure)
|
||||
nprocs = max(max_cores - max_cores % natom3, 1)
|
||||
new_manager = TaskManager.from_user_config().new_with_fixed_mpi_omp(nprocs, 1)
|
||||
kwargs.update({"manager": new_manager})
|
||||
|
||||
|
|
|
@ -160,7 +160,7 @@ def itest_phonon_restart(fwp):
|
|||
tolvrs=1.0e-5,
|
||||
)
|
||||
|
||||
multi = abilab.MultiDataset(structure=structure,
|
||||
multi = abilab.MultiDataset(structure=structure,
|
||||
pseudos=abidata.pseudos("13al.981214.fhi", "33as.pspnc"),
|
||||
ndtset=1 + len(qpoints))
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ def get_template_cls_from_name(name):
|
|||
if hasattr(pn.template, name):
|
||||
return getattr(pn.template, name)
|
||||
|
||||
try_name = name + "Template"
|
||||
try_name = name + "Template"
|
||||
if hasattr(pn.template, try_name):
|
||||
return getattr(pn.template, try_name)
|
||||
|
||||
|
@ -87,7 +87,6 @@ Possible templates are: {list(pn.template.__dict__.keys())}
|
|||
""")
|
||||
|
||||
|
||||
|
||||
def depends_on_btn_click(btn_name):
|
||||
|
||||
def decorator(func):
|
||||
|
@ -190,9 +189,11 @@ If everything is properly configured, a new window is automatically created in y
|
|||
""")
|
||||
|
||||
btn = pnw.Button(name="Upload to chart studio server")
|
||||
|
||||
def push_to_cs(event):
|
||||
with ButtonContext(btn):
|
||||
push_to_chart_studio(fig)
|
||||
|
||||
btn.on_click(push_to_cs)
|
||||
|
||||
if with_help:
|
||||
|
@ -397,7 +398,6 @@ class AbipyParameterized(param.Parameterized):
|
|||
Please **refresh** the page using the refresh button of the browser if plotly figures are not shown.
|
||||
""")
|
||||
|
||||
|
||||
#def __repr__(self):
|
||||
# # https://github.com/holoviz/param/issues/396
|
||||
# return f"AbiPyParametrized(name='{self.name}')"
|
||||
|
@ -516,7 +516,6 @@ class HasStructureParams(AbipyParameterized):
|
|||
objects=[None, "jsmol", "vesta", "xcrysden", "vtk", "crystalk", "ngl",
|
||||
"matplotlib", "plotly", "ase_atoms", "mayavi"])
|
||||
|
||||
|
||||
#def __init__(self, **params):
|
||||
# self.struct_view_btn = pnw.Button(name="View structure", button_type='primary')
|
||||
# super(self).__init__(**params)
|
||||
|
@ -639,7 +638,7 @@ def get_structure_info(structure):
|
|||
df_len = pd.DataFrame(rows, index=["Å", "Bohr"]).transpose().rename_axis("Lattice lenghts")
|
||||
|
||||
# Build dataframe with lattice angles.
|
||||
rows = []; keys = ("alpha", "beta", "gamma")
|
||||
rows = []; keys = ("alpha", "beta", "gamma")
|
||||
rows.append({k: d[k] for k in keys})
|
||||
rows.append({k: np.radians(d[k]) for k in keys})
|
||||
df_ang = pd.DataFrame(rows, index=["Degrees", "Radians"]).transpose().rename_axis("Lattice angles")
|
||||
|
@ -713,7 +712,7 @@ class PanelWithElectronBands(AbipyParameterized):
|
|||
# e-DOS plot.
|
||||
edos_method = param.ObjectSelector(default="gaussian", objects=["gaussian", "tetra"], doc="e-DOS method")
|
||||
edos_step_ev = param.Number(0.1, bounds=(1e-6, None), step=0.1, doc='e-DOS step in eV')
|
||||
edos_width_ev = param.Number(0.2, step=0.05, bounds=(1e-6, None), doc='e-DOS Gaussian broadening in eV' )
|
||||
edos_width_ev = param.Number(0.2, step=0.05, bounds=(1e-6, None), doc='e-DOS Gaussian broadening in eV')
|
||||
|
||||
# SKW interpolation of the KS band energies.
|
||||
skw_lpratio = param.Integer(5, bounds=(1, None))
|
||||
|
|
|
@ -600,6 +600,7 @@ class DdbRobotPanel(BaseRobotPanel, HasAnaddbParams):
|
|||
"""Return tabs with widgets to interact with the DDB file."""
|
||||
robot = self.robot
|
||||
|
||||
d = {}
|
||||
d["Summary"] = pn.Row(
|
||||
bkw.PreText(text=robot.to_string(verbose=self.verbose), sizing_mode="scale_both")
|
||||
)
|
||||
|
|
|
@ -4,7 +4,7 @@ import panel as pn
|
|||
import panel.widgets as pnw
|
||||
import bokeh.models.widgets as bkw
|
||||
|
||||
from abipy.panels.core import AbipyParameterized, ButtonContext, mpl, ply, depends_on_btn_click
|
||||
from abipy.panels.core import AbipyParameterized, mpl, ply, depends_on_btn_click
|
||||
|
||||
|
||||
_what_list = ["pressure", "forces", "energy", "abc", "angles", "volume"]
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
import panel as pn
|
||||
#import panel.widgets as pnw
|
||||
import bokeh.models.widgets as bkw
|
||||
from abipy.panels.core import AbipyParameterized, mpl, ply, dfc #, ButtonContext
|
||||
from abipy.panels.core import AbipyParameterized, mpl, ply, dfc
|
||||
|
||||
|
||||
class AbinitOutputFilePanel(AbipyParameterized):
|
||||
|
|
|
@ -3,7 +3,7 @@ import param
|
|||
import panel as pn
|
||||
import panel.widgets as pnw
|
||||
|
||||
from abipy.panels.core import AbipyParameterized, ButtonContext, mpl, ply, dfc, depends_on_btn_click
|
||||
from abipy.panels.core import AbipyParameterized, mpl, ply, dfc, depends_on_btn_click
|
||||
|
||||
|
||||
class PhononBandsPlotterPanel(AbipyParameterized):
|
||||
|
|
|
@ -5,7 +5,7 @@ import panel as pn
|
|||
import panel.widgets as pnw
|
||||
import bokeh.models.widgets as bkw
|
||||
|
||||
from abipy.panels.core import HasStructureParams, ButtonContext, dfc, mpl, ply, depends_on_btn_click
|
||||
from abipy.panels.core import HasStructureParams, dfc, mpl, ply, depends_on_btn_click
|
||||
|
||||
|
||||
class StructurePanel(HasStructureParams):
|
||||
|
|
|
@ -676,9 +676,9 @@ def _invoke_robot(options):
|
|||
if options.plotly:
|
||||
# plotly version.
|
||||
if hasattr(robot, "plotly_expose"):
|
||||
robot.plotly_expose(chart_studio=options.chart_studio, verbose=options.verbose)
|
||||
robot.plotly_expose(chart_studio=options.chart_studio, verbose=options.verbose)
|
||||
else:
|
||||
cprint("<%s> does not implement plotly_expose method" % type(robot), color="red")
|
||||
cprint("<%s> does not implement plotly_expose method" % type(robot), color="red")
|
||||
|
||||
elif hasattr(robot, "expose"):
|
||||
# matplotlib version.
|
||||
|
|
|
@ -123,6 +123,8 @@ def display_top(snapshot, key_type='lineno', limit=3):
|
|||
snapshot = tracemalloc.take_snapshot()
|
||||
display_top(snapshot)
|
||||
"""
|
||||
import tracemalloc
|
||||
import linecache
|
||||
snapshot = snapshot.filter_traces((
|
||||
tracemalloc.Filter(False, "<frozen importlib._bootstrap>"),
|
||||
tracemalloc.Filter(False, "<unknown>"),
|
||||
|
|
|
@ -566,7 +566,7 @@ class PanelExpose(object): # pragma: no cover
|
|||
self.verbose = verbose
|
||||
|
||||
if self.verbose:
|
||||
print("\nLoading all figures before showing them. It may take some time...")
|
||||
print("\nLoading all figures before showing them. It may take some time...")
|
||||
|
||||
self.start_time = time.time()
|
||||
|
||||
|
@ -979,7 +979,7 @@ class PlotlyRowColDesc(object):
|
|||
# Assume list with 4 integers
|
||||
try:
|
||||
return cls(*obj)
|
||||
except exc:
|
||||
except Exception as exc:
|
||||
raise TypeError(f"Dont know how to convert `{type(obj)}` into `{cls}`")
|
||||
|
||||
def __init__(self, py_row, py_col, nrows, ncols):
|
||||
|
@ -1328,6 +1328,7 @@ def push_to_chart_studio(figs):
|
|||
####################################################
|
||||
import plotly.graph_objects as go
|
||||
|
||||
|
||||
def go_points(points, size=4, color="black", labels=None, **kwargs):
|
||||
|
||||
#textposition = 'top right',
|
||||
|
@ -1486,7 +1487,6 @@ def plot_fcc_prim():
|
|||
fcc_conv = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])
|
||||
fcc_conv_box = get_box(fcc_conv, name="conv lattice")
|
||||
|
||||
|
||||
fig = go.Figure(data=[*fcc_prim_box, *fcc_prim_vectors, *fcc_conv_box, atoms])
|
||||
|
||||
return fig
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
ipython
|
||||
jupyter
|
||||
nbformat
|
||||
pygments
|
||||
|
@ -11,7 +10,6 @@ ase
|
|||
param
|
||||
panel
|
||||
bokeh
|
||||
chart-studio
|
||||
XlsxWriter # For DataFrame.to_excel()
|
||||
# Unit tests
|
||||
python-coveralls
|
||||
|
|
7
tasks.py
7
tasks.py
|
@ -59,10 +59,15 @@ pytest -n 2 --cov-config=.coveragerc --cov=abipy -v --doctest-modules abipy \
|
|||
def style(ctx):
|
||||
with cd(ABIPY_ROOTDIR):
|
||||
ctx.run("pycodestyle 2>&1 | tee style.log", pty=True)
|
||||
ctx.run("flake8 --count --show-source --statistics | tee -a style.log", pty=True)
|
||||
#ctx.run("pydocstyle abipy | tee -a style.log", pty=True)
|
||||
|
||||
|
||||
@task
|
||||
def flake(ctx):
|
||||
with cd(ABIPY_ROOTDIR):
|
||||
ctx.run("flake8 --count --show-source --statistics | tee -a style.log", pty=True)
|
||||
|
||||
|
||||
@task
|
||||
def plots(ctx):
|
||||
with cd(os.path.join(ABIPY_ROOTDIR, "abipy", "examples")):
|
||||
|
|
Loading…
Reference in New Issue