mirror of https://github.com/phonopy/phono3py.git
--zmax option is made for kdeplot.
This commit is contained in:
parent
5835dcef93
commit
152d3a60a1
Binary file not shown.
After Width: | Height: | Size: 32 KiB |
Binary file not shown.
After Width: | Height: | Size: 28 KiB |
Binary file not shown.
After Width: | Height: | Size: 35 KiB |
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
Binary file not shown.
After Width: | Height: | Size: 29 KiB |
|
@ -233,9 +233,9 @@ higher lifetime side is not drawn if all density beyond a lifetime
|
|||
value is smaller than some ratio (see
|
||||
:ref:`kdeplot_density_ratio`) of the maximum density.
|
||||
|
||||
The following plot is drawn with a
|
||||
19x19x19 mesh and nbins=200 and the ``Si-PBEsol`` example is used to
|
||||
generate the data.
|
||||
The following plot is drawn with a 19x19x19 mesh and nbins=200 and the
|
||||
``Si-PBEsol`` example is used to generate the data. The colormap of
|
||||
'jet' in matplotlib is used.
|
||||
|
||||
.. |ikde| image:: Si-kdeplot.png
|
||||
:width: 50%
|
||||
|
@ -295,19 +295,15 @@ computation will be roughly twice faster.
|
|||
|
||||
% kdeplot --ymax=60 kappa-m111111.hdf5
|
||||
|
||||
``--cmap``
|
||||
``--zmax``
|
||||
^^^^^^^^^^^
|
||||
|
||||
**New**: The latest version of ``kdeplot`` is download at
|
||||
https://github.com/atztogo/phono3py/blob/develop/scripts/kdeplot.)
|
||||
|
||||
Color map to be used for the density plot. It's given by the name
|
||||
presented at the matplotlib documentation,
|
||||
https://matplotlib.org/users/colormaps.html.
|
||||
|
||||
::
|
||||
|
||||
% kdeplot --cmap="OrRd" kappa-m111111.hdf5
|
||||
Maximum value of the density is specified with this option. The color
|
||||
along colorbar saturates by choosing a smaller value than the maximum value
|
||||
of density in the data.
|
||||
|
||||
.. _kdeplot_density_ratio:
|
||||
|
||||
|
@ -325,3 +321,38 @@ together, this option is ignored.
|
|||
::
|
||||
|
||||
% kdeplot --dr=0.01 kappa-m111111.hdf5
|
||||
|
||||
``--cmap``
|
||||
^^^^^^^^^^^
|
||||
|
||||
**New**: The latest version of ``kdeplot`` is download at
|
||||
https://github.com/atztogo/phono3py/blob/develop/scripts/kdeplot.)
|
||||
|
||||
Color map to be used for the density plot. It's given by the name
|
||||
presented at the matplotlib documentation,
|
||||
https://matplotlib.org/users/colormaps.html. The default colormap
|
||||
depends on your matplotlib environment.
|
||||
|
||||
::
|
||||
|
||||
% kdeplot --cmap="OrRd" kappa-m111111.hdf5
|
||||
|
||||
The following figures are those drawn with ``jet``, ``bwr``,
|
||||
``seismic``, ``gnuplot``, ``hsv``, and ``OrRd`` colormaps.
|
||||
|
||||
|
||||
.. |ikde-jet| image:: Si-kdeplot-jet.png
|
||||
:width: 25%
|
||||
.. |ikde-bwr| image:: Si-kdeplot-bwr.png
|
||||
:width: 25%
|
||||
.. |ikde-seismic| image:: Si-kdeplot-seismic.png
|
||||
:width: 25%
|
||||
.. |ikde-gnuplot| image:: Si-kdeplot-gnuplot.png
|
||||
:width: 25%
|
||||
.. |ikde-hsv| image:: Si-kdeplot-hsv.png
|
||||
:width: 25%
|
||||
.. |ikde-OrRd| image:: Si-kdeplot-OrRd.png
|
||||
:width: 25%
|
||||
|
||||
|ikde-jet| |ikde-bwr| |ikde-seismic| |ikde-gnuplot| |ikde-hsv| |ikde-OrRd|
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ def run_KDE(x, y, nbins, x_max=None, y_max=None, density_ratio=0.1):
|
|||
return xi, yi, zi, short_nbinds
|
||||
|
||||
def plot(plt, xi, yi, zi, x, y, short_nbinds, nbins,
|
||||
y_max=None, cmap='viridis'):
|
||||
y_max=None, z_max=None, cmap=None):
|
||||
#
|
||||
# Plotting
|
||||
#
|
||||
|
@ -92,7 +92,8 @@ def plot(plt, xi, yi, zi, x, y, short_nbinds, nbins,
|
|||
y_cut.append(_y)
|
||||
|
||||
fig = plt.figure()
|
||||
plt.pcolormesh(xi[:,:nbins], yi[:,:nbins], zi[:,:nbins], cmap=cmap)
|
||||
plt.pcolormesh(xi[:,:nbins], yi[:,:nbins], zi[:,:nbins],
|
||||
vmax=z_max, cmap=cmap)
|
||||
plt.colorbar()
|
||||
|
||||
plt.scatter(x_cut, y_cut, s=5, c='k', marker='.', linewidth=0)
|
||||
|
@ -112,7 +113,7 @@ def plot(plt, xi, yi, zi, x, y, short_nbinds, nbins,
|
|||
# Arg-parser
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Plot property density with gaussian KDE")
|
||||
parser.add_argument("--cmap", dest="cmap", default="viridis",
|
||||
parser.add_argument("--cmap", dest="cmap", default=None,
|
||||
help="Matplotlib cmap")
|
||||
parser.add_argument("--cutoff",
|
||||
help=("Property (y-axis) below this value is included in "
|
||||
|
@ -124,6 +125,9 @@ parser.add_argument("--dr", "--density_ratio", dest="density_ratio",
|
|||
type=float, default=0.1)
|
||||
parser.add_argument("--fmax", help="Max frequency to plot",
|
||||
type=float, default=None)
|
||||
parser.add_argument('--gv_norm', action='store_true',
|
||||
help=("|gv| is used for the density plot instead of "
|
||||
"lifetime.")),
|
||||
parser.add_argument('--nbins', type=int, default=100,
|
||||
help=("Number of bins in which data are assigned, "
|
||||
"i.e., determining resolution of plot")),
|
||||
|
@ -138,6 +142,9 @@ parser.add_argument("--xmax",
|
|||
parser.add_argument("--ymax",
|
||||
help="Set maximum y of draw area",
|
||||
type=float, default=None)
|
||||
parser.add_argument("--zmax",
|
||||
help="Set maximum indisity",
|
||||
type=float, default=None)
|
||||
parser.add_argument('filenames', nargs='*')
|
||||
args = parser.parse_args()
|
||||
|
||||
|
@ -189,15 +196,20 @@ print("Temperature at which lifetime density is drawn: %7.3f"
|
|||
#
|
||||
weights = f['weight'][:]
|
||||
frequencies = f['frequency'][:]
|
||||
gammas = [f['gamma'][t_index],]
|
||||
symbols = ['',]
|
||||
if args.nu:
|
||||
if 'gamma_N' in f:
|
||||
gammas.append(f['gamma_N'][t_index])
|
||||
symbols.append('N')
|
||||
if 'gamma_U' in f:
|
||||
gammas.append(f['gamma_U'][t_index])
|
||||
symbols.append('U')
|
||||
|
||||
if args.gv_norm:
|
||||
gv_norm = np.sqrt((f['group_velocity'][:, :, :] ** 2).sum(axis=2))
|
||||
gammas = [gv_norm,]
|
||||
else:
|
||||
gammas = [f['gamma'][t_index],]
|
||||
if args.nu:
|
||||
if 'gamma_N' in f:
|
||||
gammas.append(f['gamma_N'][t_index])
|
||||
symbols.append('N')
|
||||
if 'gamma_U' in f:
|
||||
gammas.append(f['gamma_U'][t_index])
|
||||
symbols.append('U')
|
||||
|
||||
#
|
||||
# Run
|
||||
|
@ -210,7 +222,7 @@ for gamma, s in zip(gammas, symbols):
|
|||
y_max=args.ymax,
|
||||
density_ratio=args.density_ratio)
|
||||
fig = plot(plt, xi, yi, zi, x, y, short_nbinds, args.nbins,
|
||||
y_max=args.ymax, cmap=args.cmap)
|
||||
y_max=args.ymax, z_max=args.zmax, cmap=args.cmap)
|
||||
if s:
|
||||
fig.savefig("lifetime-%s.png" % s)
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue