本文整理汇总了Python中org.eclipse.dawnsci.analysis.dataset.impl.DatasetUtils.linSpace方法的典型用法代码示例。如果您正苦于以下问题:Python DatasetUtils.linSpace方法的具体用法?Python DatasetUtils.linSpace怎么用?Python DatasetUtils.linSpace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.dawnsci.analysis.dataset.impl.DatasetUtils
的用法示例。
在下文中一共展示了DatasetUtils.linSpace方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: linspace
# 需要导入模块: from org.eclipse.dawnsci.analysis.dataset.impl import DatasetUtils [as 别名]
# 或者: from org.eclipse.dawnsci.analysis.dataset.impl.DatasetUtils import linSpace [as 别名]
def linspace(start, stop, num=50, endpoint=True, retstep=False):
'''Create a 1D dataset from start to stop in given number of steps
Arguments:
start -- starting value
stop -- stopping value
num -- number of steps, defaults to 50
endpoint -- if True (default), include the stop value
retstep -- if False (default), do not include the calculated step value as part of return tuple
'''
if not endpoint:
stop = ((num - 1) * stop + start)/num
dtype = _getdtypefromobj(((start, stop)))
if dtype.value < float64.value:
dtype = float64
if dtype.value >= complex64.value:
dtype = complex128
if type(start) is _types.IntType:
start = start+0j
if type(stop) is _types.IntType:
stop = stop+0j
rresult = _dsutils.linSpace(start.real, stop.real, num, float64.value)
iresult = _dsutils.linSpace(start.imag, stop.imag, num, float64.value)
result = Sciwrap(_complexdoubleds(rresult, iresult))
del rresult, iresult
else:
result = Sciwrap(_dsutils.linSpace(start, stop, num, dtype.value))
if retstep:
step = result[1] - result[0]
return (result, step)
else:
return result