def load_config_files(config): """Read in config file information for files Parameters ---------- config : ConfigParser.ConfigParser object Returns ------- A list of the following values taken from the .cfg file: datafile, phtn_src, mcnp_n_problem, mcnp_p_problem """ # Required input files if config.has_option('r2s-files', 'step2_datafile'): datafile = get_input_file(config, 'step2_datafile') else: datafile = get_input_file(config, 'step1_datafile') phtn_src = get_input_file(config, 'alara_phtn_src') # Filenames mcnp_p_problem = None if config.has_option('r2s-files','photon_mcnp_input'): mcnp_n_problem = config.get('r2s-files','neutron_mcnp_input') mcnp_p_problem = config.get('r2s-files','photon_mcnp_input') return (datafile, phtn_src, mcnp_n_problem, mcnp_p_problem)
def load_config_files(config): """Read in config file information for files Parameters ---------- config : ConfigParser.ConfigParser object Returns ------- A list of the following values taken from the .cfg file: datafile, phtn_src, mcnp_n_problem, mcnp_p_problem """ # Required input files if config.has_option('r2s-files', 'step2_datafile'): datafile = get_input_file(config, 'step2_datafile') else: datafile = get_input_file(config, 'step1_datafile') phtn_src = get_input_file(config, 'alara_phtn_src') # Filenames mcnp_p_problem = None if config.has_option('r2s-files', 'photon_mcnp_input'): mcnp_n_problem = config.get('r2s-files', 'neutron_mcnp_input') mcnp_p_problem = config.get('r2s-files', 'photon_mcnp_input') # Optional gammas file entry gammas = "gammas" if config.has_option('r2s-files', 'gammas'): gammas = config.get('r2s-files', 'gammas') return (datafile, phtn_src, mcnp_n_problem, mcnp_p_problem, gammas)
cfgfile = 'r2s.cfg' if len(sys.argv) > 1: cfgfile = sys.argv[1] config = ConfigParser.SafeConfigParser() config.read(cfgfile) ########################### # Read in config file information # Required input files if config.has_option('r2s-files', 'step2_datafile'): datafile = get_input_file(config, 'step2_datafile') else: datafile = get_input_file(config, 'step1_datafile') phtn_src = get_input_file(config, 'alara_phtn_src') # Filenames mcnp_p_problem = None if config.has_option('r2s-files','photon_mcnp_input'): mcnp_n_problem = config.get('r2s-files','neutron_mcnp_input') mcnp_p_problem = config.get('r2s-files','photon_mcnp_input') # Read other parameters from r2s.cfg
cfgfile = sys.argv[1] config = ConfigParser.SafeConfigParser() config.read(cfgfile) # Get isotopes and cooling times # Filenames mcnp_p_problem = None if config.has_option('r2s-files','photon_mcnp_input'): #mcnp_n_problem = get_input_file(config,'neutron_mcnp_input') mcnp_n_problem = config.get('r2s-files','neutron_mcnp_input') mcnp_p_problem = config.get('r2s-files','photon_mcnp_input') datafile = config.get('r2s-files','step1_datafile') phtn_src = get_input_file(config, 'alara_phtn_src') #defaults iso_list = ['TOTAL'] cool_list = ['shutdown', '1 d'] path_list = list() if config.has_section('r2s-params'): opt_isotope = config.get('r2s-params','photon_isotope') opt_cooling = config.get('r2s-params','photon_cooling') else: sys.exit("ERROR: r2s-params section required in your config file " \ "({0})".format(cfgfile)) thisdir = os.curdir
oldx = x return centers ##################################################################### # Look for and open configuration file for r2s workflow cfgfile = 'r2s.cfg' if len(sys.argv) > 1: cfgfile = sys.argv[1] config = ConfigParser.SafeConfigParser() config.read(cfgfile) # Required input file from config file datafile = get_input_file(config, 'step1_datafile') # Read in the mesh smesh = ScdMesh.fromFile(datafile) # Get the Tag object called PHTN_BIAS try: bias_tag = smesh.imesh.createTag("PHTN_BIAS",1,"d") except iBase.TagAlreadyExistsError: print "Tag already exists. Tags are being overwritten." bias_tag = smesh.imesh.getTagHandle("PHTN_BIAS") # Calculate the center of all voxels in the problem and store in a list centers = calc_centers_list(smesh) # EXAMPLE OF MATH FOR DISTANCE BASED BIASING: