當前位置: 首頁>>代碼示例>>Python>>正文


Python MFnLineArray.ydata方法代碼示例

本文整理匯總了Python中mathkit.mfn.mfn_line.mfn_line.MFnLineArray.ydata方法的典型用法代碼示例。如果您正苦於以下問題:Python MFnLineArray.ydata方法的具體用法?Python MFnLineArray.ydata怎麽用?Python MFnLineArray.ydata使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在mathkit.mfn.mfn_line.mfn_line.MFnLineArray的用法示例。


在下文中一共展示了MFnLineArray.ydata方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get_df_average

# 需要導入模塊: from mathkit.mfn.mfn_line.mfn_line import MFnLineArray [as 別名]
# 或者: from mathkit.mfn.mfn_line.mfn_line.MFnLineArray import ydata [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
開發者ID:axelvonderheide,項目名稱:scratch,代碼行數:38,代碼來源:ccs_unit_cell.py


注:本文中的mathkit.mfn.mfn_line.mfn_line.MFnLineArray.ydata方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。