def check( self, info ) : """ Check for incomplete angular distributions + any negative probabilities. Ignore normalization for this double-differential distribution. """ from fudge.gnd import warning from pqu import PQU warnings = [] for index, energy_in in enumerate(self): integral = energy_in.integrate() if abs(integral - 1.0) > info['normTolerance']: warnings.append( warning.unnormalizedDistribution( PQU.PQU(energy_in.value, self.axes[0].unit), index, integral, self.toXLink() ) ) if( energy_in.domainMin != -1 ) or ( energy_in.domainMax != 1 ) : warnings.append( warning.incompleteDistribution( PQU.PQU(energy_in.value, self.axis[0].unit), energy_in.domainMin, energy_in.domainMax, energy_in ) ) for mu in energy_in: if( mu.domainMin < 0 ) : warnings.append( warning.valueOutOfRange("Negative outgoing energy for energy_in=%s!" % PQU.PQU(energy_in.value, self.axes[0].unit), mu.domainMin, 0, 'inf', self.toXLink() ) ) if( mu.rangeMin < 0 ) : warnings.append( warning.negativeProbability( PQU.PQU(energy_in.value, self.axes[-1].unit), mu=mu.value, obj=mu ) ) return warnings
def check(self, info): from fudge.gnd import warning warnings = [] if (not (self.aSubform.isEmptyASubform())): raise NotImplementedError( "Checking for Kalbach-Mann data with 'a' coefficients") for index, F in enumerate( self.fSubform.data ): # F is like P(E' | E), must be normalized for each incident energy integral = F.integrate() if abs(integral - 1.0) > info['normTolerance']: warnings.append( warning.unnormalizedKMDistribution( PQUModule.PQU(F.value, F.axes[-1].unit), index, integral, F)) if F.rangeMin < 0: warnings.append( warning.negativeProbability(PQUModule.PQU( F.value, F.axes[-1].unit), obj=F)) for R in self.rSubform.data: # R = pre-compound fraction, must be between 0 and 1 if R.rangeMin < 0 or R.rangeMax > 1: badR = R.rangeMin if ( 0.5 - R.rangeMin > R.rangeMax - 0.5) else R.rangeMax warnings.append( warning.valueOutOfRange( "Invalid 'r' in KalbachMann distribution at incident energy %s" % PQUModule.PQU(R.value, R.axes[-1].unit), badR, 0, 1, R)) return warnings
def check(self, info): from fudge.gnd import warning warnings = [] for idx, function in enumerate(self): xys = function.toPointwise_withLinearXYs( accuracy=info['normTolerance'], lowerEps=1e-6) if isinstance(function, Legendre): integral = function.coefficients[0] elif isinstance(function, XYs1d): integral = xys.integrate(-1, 1) else: raise NotImplementedError( "checking function of type %s" % type(function)) # FIXME support xs_pdf_cdf1d if abs(integral - 1.0) > info['normTolerance']: warnings.append( warning.unnormalizedDistribution( PQUModule.PQU(function.value, self.axes[-1].unit), idx, integral, function)) if (xys.rangeMin < 0.0): warnings.append( warning.negativeProbability(PQUModule.PQU( function.value, self.axes[-1].unit), value=xys.rangeMin, obj=function)) return warnings
def check(self, info): from fudge.gnd import warning warnings = [] for idx in range(len(self)): integral = self[idx].integrate() if abs(integral - 1.0) > info['normTolerance']: warnings.append( warning.unnormalizedDistribution( PQU.PQU(self[idx].value, self.axes[-1].unit), idx, integral, self[idx])) if self[idx].rangeMin() < 0.0: warnings.append( warning.negativeProbability(PQU.PQU( self[idx].value, self.axes[-1].unit), value=self[idx].rangeMin(), obj=self[idx])) return warnings
def check(self, info): from fudge.gnd import warning from pqu import PQU warnings = [] axes = axesModule.axes() axes[0] = self.axes[-2] axes[1] = self.axes[-1] for index, energy_in in enumerate(self): integral = float( XYsModule.XYs1d([(eout.value, eout.coefficients[0]) for eout in energy_in], axes=axes, accuracy=0.001).integrate()) if abs(integral - 1.0) > info['normTolerance']: warnings.append( warning.unnormalizedDistribution( PQU.PQU(energy_in.value, axes[0].unit), index, integral, self.toXLink())) minProb = min([ xy.toPointwise_withLinearXYs(0.001).rangeMin() for xy in energy_in ]) if minProb < 0: warnings.append( warning.negativeProbability(PQU.PQU( energy_in.value, axes[0].unit), value=minProb, obj=energy_in)) if self.interpolationQualifier is standardsModule.interpolation.unitBaseToken: # check for more than one outgoing distribution integrating to 0 at high end of incident energies integrals = [eout.integrate() for eout in energy_in] for idx, integral in enumerate(integrals[::-1]): if integral != 0: break if idx > 1: warnings.append( warning.extraOutgoingEnergy(PQU.PQU( energy_in.value, axes[-1].unit), obj=energy_in)) return warnings
def check(self, info): from fudge.gnd import warning warnings = [] for idx, function in enumerate(self): xys = function.toPointwise_withLinearXYs(1e-6) integral = xys.integrate(-1, 1) if abs(integral - 1.0) > info['normTolerance']: warnings.append( warning.unnormalizedDistribution( PQUModule.PQU(function.value, self.axes[-1].unit), idx, integral, function)) if xys.rangeMin() < 0.0: warnings.append( warning.negativeProbability(PQUModule.PQU( function.value, self.axes[-1].unit), value=xys.rangeMin(), obj=function)) return warnings