本文整理匯總了Python中mathkit.mfn.mfn_line.mfn_line.MFnLineArray.xdata方法的典型用法代碼示例。如果您正苦於以下問題:Python MFnLineArray.xdata方法的具體用法?Python MFnLineArray.xdata怎麽用?Python MFnLineArray.xdata使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類mathkit.mfn.mfn_line.mfn_line.MFnLineArray
的用法示例。
在下文中一共展示了MFnLineArray.xdata方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: strains
# 需要導入模塊: from mathkit.mfn.mfn_line.mfn_line import MFnLineArray [as 別名]
# 或者: from mathkit.mfn.mfn_line.mfn_line.MFnLineArray import xdata [as 別名]
def strains( self ):
mfn = MFnLineArray()
mfn.xdata, mfn.ydata = self.values
strains_fn = frompyfunc( mfn.get_diff, 1, 1 )
strains = strains_fn( mfn.xdata )
strains[0] = strains[1]
strains[-2] = strains[-1]
return strains
示例2: get_df_average
# 需要導入模塊: from mathkit.mfn.mfn_line.mfn_line import MFnLineArray [as 別名]
# 或者: from mathkit.mfn.mfn_line.mfn_line.MFnLineArray import xdata [as 別名]
def get_df_average( self, n_points ):
'''derive the average phi-function based on all entries
in damage_function_list
'''
def get_y_average( self, x_average ):
'''get the y-values from the mfn-functions in df_list for
'x_average' and return the average.
Note that the shape of 'mfn.xdata' does not necessarily needs to be equal in all
'DamageFunctionEntries' as the number of steps used for calibration or the adaptive
refinement in 'tloop' might have been different for each case.
'''
y_list = [ self.damage_function_list[i].damage_function.get_value( x_average ) \
for i in range(len( self.damage_function_list )) ]
return sum(y_list) / len(y_list)
get_y_average_vectorized = frompyfunc( get_y_average, 2, 1 )
mfn = MFnLineArray()
# take the smallest value of the strains for the average function. Beyond this value
# the average does not make sense anymore because it depends on the arbitrary number
# of entries in the df_list
#
xdata_min = min( self.damage_function_list[i].damage_function.xdata[-1] \
for i in range( len( self.damage_function_list ) ) )
# number of sampling point used for the average phi function
#
mfn.xdata = linspace( 0., xdata_min, num = n_points )
# get the corresponding average ydata values
#
mfn.ydata = self.get_y_average_vectorized( mfn.xdata )
return mfn