import PyFrensie.Utility.Prng as Prng import PyFrensie.Utility.Interpolation as Interpolation import PyFrensie.MonteCarlo.Collision as Collision import PyTrilinos.Teuchos as Teuchos import numpy import matplotlib.pyplot as plt Utility.initFrensiePrng() datadir = '/home/software/mcnpdata/' datadir = '/home/lkersting/frensie/src/packages/test_files/' #datadir = '/home/lkersting/research/frensie-repos/lkersting/src/packages/test_files/' source = Teuchos.FileInputSource(datadir + '/cross_sections.xml') xml_obj = source.getObject() cs_list = Teuchos.XMLParameterListReader().toParameterList(xml_obj) h_data_list = cs_list.get('Al-Native') pb_data_list = cs_list.get('Pb-Native') h_adjoint_file_name = datadir + h_data_list.get( 'adjoint_electroatomic_file_path') h_native_file_name = datadir + h_data_list.get('electroatomic_file_path') pb_native_file_name = datadir + pb_data_list.get('electroatomic_file_path') h_native_data = Native.ElectronPhotonRelaxationDataContainer( h_native_file_name) h_adjoint_data = Native.AdjointElectronPhotonRelaxationDataContainer( h_adjoint_file_name) pb_native_data = Native.ElectronPhotonRelaxationDataContainer( pb_native_file_name)
if inputExt == PYTHON_EXT: try: pyObj = eval(open(inputFile).read().strip()) xmlObj = Teuchos.XMLParameterListWriter().toXML(pyObj) open(outputFile, "w").write(xmlObj.toString()) if options.verbose: print "Wrote '%s'" % outputFile except Exception, e: print "Could not convert python file to XML file:" print e sys.exit(5) # Convert XML input to python if inputExt == XML_EXT: try: xmlObj = Teuchos.FileInputSource(inputFile).getObject() pList = Teuchos.XMLParameterListReader().toParameterList(xmlObj) stream = open(outputFile, "w") pprint(pList.asDict(), stream) # Pretty-print the dictionary stream.close() if options.verbose: print "Wrote '%s'" % outputFile except Exception, e: print "Could not convert XML file to python file:" print e sys.exit(6) ################################################################################ if __name__ == "__main__": main()