当前位置: 首页>>代码示例>>Python>>正文


Python MFnLineArray.xdata方法代码示例

本文整理汇总了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
开发者ID:axelvonderheide,项目名称:scratch,代码行数:10,代码来源:clamp_const_model.py

示例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
开发者ID:axelvonderheide,项目名称:scratch,代码行数:38,代码来源:ccs_unit_cell.py


注:本文中的mathkit.mfn.mfn_line.mfn_line.MFnLineArray.xdata方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。