#NEWLINE# def _get_sum( self ) : #NEWLINE# #INDENT# 'Compute sum of non NaN / Inf values in the array.' #NEWLINE# try : #NEWLINE# #INDENT# return self . _sum #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# self . _sum = self . no_nan . sum ( ) #NEWLINE# if ( type ( self . _sum ) is numpy . memmap ) : #NEWLINE# #INDENT# self . _sum = numpy . asarray ( self . _sum ) . item ( ) #NEWLINE# #UNINDENT# if ( self . has_nan and self . no_nan . mask . all ( ) ) : #NEWLINE# #INDENT# self . _sum = 0 #NEWLINE# #UNINDENT# if ( numpy . isinf ( self . _sum ) or numpy . isnan ( self . _sum ) ) : #NEWLINE# #INDENT# if self . has_nan : #NEWLINE# #INDENT# mask = ( self . no_nan . mask + numpy . isinf ( self [ 1 ] ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# mask = numpy . isinf ( self [ 1 ] ) #NEWLINE# #UNINDENT# if mask . all ( ) : #NEWLINE# #INDENT# self . _sum = 0 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . _sum = numpy . ma . masked_array ( self [ 1 ] , mask ) . sum ( ) #NEWLINE# #UNINDENT# assert ( not numpy . isnan ( self . _sum ) ) #NEWLINE# #UNINDENT# #UNINDENT# return self . _sum