def process_one_evaluation(yi, ZA, libraryName='endl2008.2', libraryVersion='', libPath=default_lib_path, outputDir=None, workDir='work', verbose=False, dryrun=False): '''process all reactions for an evaluation that we possibley can''' try: e = endlProject(database=os.path.join(libPath, libraryName, libraryVersion), projectile=yi, readOnly=True) target = e.readZA(ZA) except: print 'target za%06d yi%02d doesnt exist' % (ZA, yi) return [] if verbose: print '---- process_one_evaluation ----' print 'yi:', yi print ' za:', ZA if verbose: target.ll() target.read(I=0) CList = filter(lambda x: x in default_C_list, target.CList()) cutOffEnergy = 0.010 # 10 keV cutoff, if threshold > this value, then don't make a TDF file #if CList == []: print "No C's to process for yi =", yi, "za =", ZA,"!" reactionnames = [] for C in CList: #target.read( I = 0 ) #print " yi %02d za%06d C %02d \n"% (yi,ZA,C) if target.findDatas(I=0, C=C)[0].data[0][0] > cutOffEnergy: #print "yi %02d za%06d C %02d : "%(yi,ZA,C), "first energy point too high \n" continue if verbose: print " C:", C try: reactionname = processTDF_Reaction(target, C, workDir=workDir, outputDir=outputDir, libraryName=libraryName, libraryVersion=libraryVersion, verbose=verbose, dryrun=dryrun) reactionnames.append(reactionname) print 'adding to tdf list :', reactionname except RuntimeError, err: print err print "\n.... continuing\n"
def process_one_reaction(yi, ZA, C, libraryName='endl2009.0', libraryVersion='', libPath=default_lib_path, outputDir=None, workDir='work', verbose=False, dryrun=False): ''' process one reaction, use this for testing projectile designator: yi = ( 1,n; 2,p; 3,d; 4,t; 5,3He; 6,He; 7,g ) target ZA = 1000 * Z + A I = 0 is cross section data. ''' if verbose: print '---- process_one_reaction ----' print 'yi:', yi print ' za:', ZA print " C:", C print " next endlproject call... " e = endlProject(os.path.join(libPath, libraryName, libraryVersion), projectile=yi, readOnly=True) target = e.readZA(ZA) if verbose: target.ll() target.read(I=0) reactionname = processTDF_Reaction(target, C, workDir=workDir, outputDir=outputDir, libraryName=libraryName, libraryVersion=libraryVersion, verbose=verbose, dryrun=dryrun) if dryrun: return reactionname
'--output', default='endl2gnd', help='prefix for resulting .endf and .xml files') parser.add_argument( '-v', '--version', default='1.0.0', help= "Evaluation version number. Should be of form 'major.minor.patchlevel' (i.e. 2011.0.1)" ) if (__name__ == '__main__'): args = parser.parse_args() e = endlProject(args.library, projectile=args.projectile, readOnly=True) if args.ZA[-1].isalpha(): # isomer, e.g. 95242m za = e.readZA(args.ZA[:-1], suffix=args.ZA[-1]) else: za = e.readZA(args.ZA) za.read() if not args.includeAverageProductData: za.removeFile(I=10) za.removeFile(I=13) r = za.toGND(evaluationLibrary=os.path.basename(args.library), evaluationVersion=args.version) r.saveToFile(args.output + ".xml") if (args.toENDF6):
def testReadZA(self): e = endlProject(os.sep.join(__path__ + ['test', 'testdb'])) self.assertEqual(e.ZAList(), ['za001001']) za = e.readZA(1001) za.read() self.assertEqual([x.C for x in za.findDatas(I=0)], [1, 10, 46])
def testInit(self): e = endlProject(os.sep.join(__path__ + ['test', 'testdb'])) self.assertEqual(e.ZAList(), ['za001001'])