add isscalar function in numeric module

This commit is contained in:
wyq 2023-02-21 10:28:27 +08:00
parent fe11464879
commit f0f5e028e1
7 changed files with 32 additions and 20 deletions

View File

@ -1,11 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<MeteoInfo File="milconfig.xml" Type="configurefile">
<Path OpenPath="D:\Working\MIScript\Jython\mis\plot_types\hist">
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\streamplot"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\quiver"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\scatter"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\stem"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\slice"/>
<Path OpenPath="D:\Working\MIScript\Jython\mis\traj">
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\particles"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\surf"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\text"/>
@ -13,20 +8,27 @@
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\volume"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\3d_earth"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\hist"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\others"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math\stats"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\violinplot"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\traj"/>
</Path>
<File>
<OpenedFiles>
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\3d_earth\scatter_sphere.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\3d_earth\contour.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\hist\hist_muti_array.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\hist\hist_muti_array_1.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\violinplot\violinplot_3.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\traj\plot_cluster_3d.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\traj\plot_cluster_color_1.py"/>
</OpenedFiles>
<RecentFiles>
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\3d_earth\scatter_sphere.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\3d_earth\contour.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\hist\hist_muti_array.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\hist\hist_muti_array_1.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\violinplot\violinplot_3.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\traj\plot_cluster_3d.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\traj\plot_cluster_color_1.py"/>
</RecentFiles>
</File>
<Font>
@ -34,5 +36,5 @@
</Font>
<LookFeel DockWindowDecorated="true" LafDecorated="true" Name="FlatDarkLaf"/>
<Figure DoubleBuffering="true"/>
<Startup MainFormLocation="-7,-7" MainFormSize="1293,685"/>
<Startup MainFormLocation="-7,0" MainFormSize="1351,753"/>
</MeteoInfo>

View File

@ -43,7 +43,7 @@ __all__ = [
'concatenate','conj','conjugate','corrcoef','cos','cosh','cylinder','degrees','delete','delnan','diag','diff',
'datatable','dot','empty','empty_like','exp','eye','flatnonzero','floor',
'fmax','fmin','full','hcurl','hdivg','hstack','identity','interp2d','interpn','isarray',
'isclose','isfinite','isinf','isnan','linspace','log','log10','logical_not','logspace',
'isclose','isfinite','isinf','isnan','isscalar','linspace','log','log10','logical_not','logspace',
'magnitude','max','maximum','mean','median','meshgrid','min','minimum','monthname',
'moveaxis','newaxis','ones','ones_like','outer','peaks','pol2cart','power','radians','reciprocal','reshape',
'repeat','roll','rolling_mean','rot90','round','sec','sign','sin','sinh','shape','smooth5','smooth9','sort',
@ -1739,6 +1739,16 @@ def isfinite(x):
else:
return Double.isFinite(x)
def isscalar(element):
"""
Returns True if the type of `element` is a scalar type.
:param element: Input argument, can be of any type and shape.
:return: (*bool*) True if `element` is a scalar type, False if it is not.
"""
return isinstance(element, (numbers.Number, basestring, bool))
def delnan(a):
"""
Delete NaN values.

View File

@ -1,4 +1,4 @@
from ..core import numeric as np
from .. import core as np
import stats
from ..linalg import linalg

View File

@ -3097,12 +3097,12 @@ class Axes(object):
return graphics
def violinplot(self, dataset, positions=None, widths=0.5, boxwidth=0.01, boxprops=None, \
def violinplot(self, dataset, positions=None, widths=0.5, boxwidth=0.01, boxprops=None,
whiskerprops=None, **kwargs):
"""
Make a violin plot.
:param dateset: (*Array or a sequence of vectors*) The input data.
:param dataset: (*Array or a sequence of vectors*) The input data.
:param positions: (*array_like*) Sets the positions of the violins. The ticks and limits are automatically
set to match the positions. Defaults to range(1, N+1) where N is the number of violins to be drawn.
:param widths: (*scalar or array_like*) Sets the width of each box either with a scalar or a sequence.
@ -3138,7 +3138,7 @@ class Axes(object):
if boxprops is None:
boxprops = dict(color='k', edgecolor=None)
if whiskerprops is None:
whiskerprops = whiskerprops = dict(color='k')
whiskerprops = dict(color='k')
if not kwargs.has_key('color'):
kwargs['color'] = 'c'
if not kwargs.has_key('edgecolor'):