示例#1
0
文件: D2S.py 项目: IRSN/SalinoPhD
def loadlcm(filepath):
    if '/' in filepath:
        # PyGan can only read files in the local directory. When the file to be
        # read is located elsewhere, it is necessary to make a link.
        filename = filepath.split('/')[-1]
        os.system('ln -s ' + filepath + ' _' + filename)
        # PyGan's lcm method requires that filenames begin with an underscore,
        # but at the same time requires that it is passed without this
        # underscore
        loadedfile = lcm.new('LCM_INP', filename)
        # Once loaded, we can delete the created link
        os.system('rm _' + filename)
    else:
        loadedfile = lcm.new('LCM_INP', filepath)
    return loadedfile
示例#2
0
for controlrod in controlrods:
    print('controlrod = ' + controlrod)
    if controlrod == 'ARO':
        cbor = 1206
    elif controlrod == 'D':
        cbor = 1084
    elif controlrod == 'CD':
        cbor = 960
    #---
    #  Drakkar power distributions
    #---
    # Create links toward every available Drakkar power distribution
    os.system('ln -s ../Drakkar/Output_TMC/_Power' + controlrod + '_*.ascii .')
    # List isotopes we've been (potentially) randomly sampling in Drakkar
    firstfile = glob.glob('_Power' + controlrod + '_*.ascii')[0]
    ResultFile = lcm.new('LCM_INP', firstfile[1:])
    drkisotopes = ResultFile['NamIso'].split()
    del ResultFile
    # Initialize dictionnary (isotope-wise) of lists (sampling-wise) that will
    # contain the retrieved Drakkar data
    powers = {}
    for iso in drkisotopes:
        powers[iso] = []
    for file in list(glob.glob('_Power' + controlrod + '_*.ascii')):
        # Loading data while removing beginning-of-filename underscore
        ResultFile = lcm.new('LCM_INP', file[1:])
        os.system("rm " + file)
        # Compute mean in order to normalize power to 1.0 per average assembly
        power = ResultFile['POWER-CHAN']
        mean = np.sum(power)/len(power)
        power = power/mean
示例#3
0
文件: Draglib.py 项目: IRSN/SalinoPhD
directories = glob.glob(path + 'TENDL-2019/*') + glob.glob(path + 'SANDY/*')
for draglibpath in directories:
    # Retrieve isotope name as given in directories' names and its source
    source, iso = draglibpath.rsplit('/', 2)[1:3]
    print('iso = ' + iso)
    #---
    #  Initialize plot
    #---
    fig, axs = plt.subplots(nrows=2, sharex='all', gridspec_kw={'hspace': 0})
    #---
    #  Create link toward Draglib file and load data (most time spent here)
    #---
    command = ('ln -s ' + draglibpath + '/draglib' + iso + ' _draglib' + iso +
               '.txt')
    os.system(command)
    draglib = lcm.new('LCM_INP', 'draglib' + iso + '.txt')
    os.system('rm -f _draglib' + iso + '.txt')
    draglib._impx = 0
    # A few plotting parameters
    minsig = 0.01
    if iso.startswith('U23'):
        minsig = 0.1
        loclegend = 'upper right'
        ncol = 2
    elif iso == 'Fe54':
        loclegend = 'upper left'
        ncol = 3
    elif iso == 'Cd110':
        loclegend = 'upper left'
        ncol = 2
    elif iso == 'Zr92' or iso == 'Zr94':