Skip to content
Snippets Groups Projects
Commit 77fa9e63 authored by Greg Henning's avatar Greg Henning
Browse files

[added] computing mean, std, cov, corr from iterations

parent a5a273b9
Branches
No related merge requests found
MC config:
UUID: '000000'
style: center
when: '2024-02-06 12:32:02.500951'
U3O8: 0.0
UF4: 0.0
bleu: 0.0
gris: 0.0
UUID: 3d3158
style: mc
when: '2024-02-07 22:02:44.413645'
U3O8: -0.046884891000881314
UF4: -0.043821489126609214
bleu: -7.885436293326389
gris: -5.753129843290958
pm_U3O8: 0.1
pm_UF4: 0.1
pm_bleu: 10.0
pm_gris: 10.0
pm_rouge: 10.0
pm_vert: 10.0
rouge: 0.0
rouge: -3.9298816472593128
small_time_jitter: 0.1
src_U3O8: 0.0
src_UF4: 0.0
src_bleu: 0.0
src_gris: 0.0
src_rouge: 0.0
src_vert: 0.0
time_jitter: 10.0
vert: 0.0
vert: 6.880420658582953
FC_DOF:
U3O8: 27.3981
UF4: 27.285
U3O8: 27.39128756004084
UF4: 27.291101384481905
src_U3O8: 27.3981
src_UF4: 27.285
u_U3O8: 0.005
u_UF4: 0.005
MC config:
UUID: '000000'
style: center
when: '2024-02-06 12:32:02.500951'
UUID: 3d3158
style: mc
when: '2024-02-07 22:02:44.413645'
SPEED_OF_LIGHT: 0.299792458
TNT_TS_STEP: 10.0
......@@ -3,11 +3,13 @@ FC_DENSITY:
U3O8: 9.912e-07
UF4: 8.2978e-07
FC_EFF:
U3O8: 0.776
UF4: 0.944
U3O8: 0.7399088773988158
UF4: 0.9595920484031608
src_U3O8: 0.776
src_UF4: 0.944
u_U3O8: 0.04
u_UF4: 0.021
MC config:
UUID: '000000'
style: center
when: '2024-02-06 12:32:02.500951'
UUID: 3d3158
style: mc
when: '2024-02-07 22:02:44.413645'
GE_DOF: 28.8168
GE_DOF: 28.815740545672163
MC config:
UUID: '000000'
style: center
when: '2024-02-06 12:32:02.500951'
UUID: 3d3158
style: mc
when: '2024-02-07 22:02:44.413645'
src_GE_DOF: 28.8168
u_GE_DOF: 0.005
MC config:
UUID: '000000'
style: center
when: '2024-02-06 12:32:02.500951'
neutron loss: 0.018
UUID: 3d3158
style: mc
when: '2024-02-07 22:02:44.413645'
neutron loss: 0.017387749600860196
neutron loss uncertainty: 0.001
src_neutron loss: 0.018
u_neutron loss: 0.001
MC config:
UUID: '000000'
style: center
when: '2024-02-06 12:32:02.500951'
UUID: 3d3158
style: mc
when: '2024-02-07 22:02:44.413645'
isotope of interest: 183W
nuclei density: 0.00312079131
nuclei density: 0.0029994112767346742
nuclei density uncertainty: 0.00031066
nuclei density unit: nuclei par barn
src_nuclei density: 0.00312079131
u_nuclei density: 0.00031066
......@@ -20,7 +20,7 @@ import matplotlib.pyplot as plt
def convergence_cv(the_files: list[str],
nCV: int = 4,
nCV: int = 16,
output_prefix: str = './_') -> None:
# loading data
data_cols = []
......@@ -88,7 +88,7 @@ def convergence_cv(the_files: list[str],
if __name__ == "__main__":
arg_parser = argparse.ArgumentParser(description=__doc__)
arg_parser.add_argument('--nCV', type=int,
default=5, nargs='?',
default=16, nargs='?',
help='number of CV loops')
arg_parser.add_argument('--output_prefix', type=str,
default='./_',
......
#!/usr/env python
# -*- coding: utf-8 -*-
# -*- format: python -*-
# -*- author: G. Henning -*-
# -*- created: feb 2024 -*-
'''
Process files from iterations to mean and std
'''
import argparse
from random import shuffle as rand_shuffle
import yaml
import numpy as np
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
def iters2cov_corr(the_files: list[str],
data_reduction: int = 1,
output_prefix: str = './_') -> None:
# loading data
data_cols = []
x, dx = None, None
for this_file in the_files:
x, dx, y = np.loadtxt(this_file, unpack=True)
data_cols.append(y)
the_data = np.column_stack(data_cols)
#print("#data loaded")
reduced_data = the_data[::data_reduction,]
# computing cov, corr
the_cov = np.cov(reduced_data)
the_corr = np.corrcoef(reduced_data)
grid_limits = list(x[::data_reduction])
grid_limits.append(x[-1]+dx[-1])
# exporting covariance.
plt.figure(figsize=(12, 10))
plt.pcolormesh(grid_limits, grid_limits,
the_cov,
cmap='viridis',
shading='flat')
plt.colorbar()
plt.savefig(f"{output_prefix}_cov.png")
np.savetxt(f"{output_prefix}_cov.npy.txt",
the_cov)
# exporting correlation.
plt.figure(figsize=(12, 10))
plt.pcolormesh(grid_limits, grid_limits,
the_corr,
vmin=-1, vmax=1,
cmap='seismic',
shading='flat')
plt.colorbar()
plt.savefig(f"{output_prefix}_corr.png")
np.savetxt(f"{output_prefix}_corr.npy.txt",
the_corr)
# Now, execution part
if __name__ == "__main__":
arg_parser = argparse.ArgumentParser(description=__doc__)
arg_parser.add_argument('--data_reduction', type=int,
default=1,
nargs='?',
help='Factor by which to reduce the data (in case it\'s too big)')
arg_parser.add_argument('--output_prefix', type=str,
default='./_',
nargs='?', help="prefix for output files")
arg_parser.add_argument('the_files', type=str,
nargs='*', help="Files to read and process")
the_arguments = arg_parser.parse_args()
try:
iters2cov_corr(**vars(the_arguments))
except Exception as err_:
print("error")
print(err_)
#!/usr/env python
# -*- coding: utf-8 -*-
# -*- format: python -*-
# -*- author: G. Henning -*-
# -*- created: feb 2024 -*-
'''
Process files from iterations to mean and std
'''
import argparse
from random import shuffle as rand_shuffle
import yaml
import numpy as np
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
def iters2mean_n_std(the_files: list[str],
output_prefix: str = './_') -> None:
# loading data
data_cols = []
x, dx = None, None
plt.figure(figsize=(8,6))
for this_file in the_files:
x, dx, y = np.loadtxt(this_file, unpack=True)
plt.plot(x, y, color='gray')
data_cols.append(y)
the_data = np.column_stack(data_cols)
#print("#data loaded")
# computing whole set mean and std
the_mean = the_data.mean(axis=1)
the_std = the_data.std(axis=1)
plt.ylim(bottom=0.)
plt.plot(x, the_mean, color="red", label='mean')
plt.plot(x, the_mean+the_std, color='orange', label='mean+std')
plt.plot(x, the_mean-the_std, color='orange', label='mean-std')
plt.savefig(f"{output_prefix}.png")
the_output = np.column_stack((x, dx, the_mean, the_std))
np.savetxt(f"{output_prefix}.txt",
the_output,
fmt="%12.5f",
header=f"""
Mean and Std values computed from {len(data_cols)} input files.
writen to {output_prefix}
Columns: x_low, w_width, mean, std
""",
footer="end of file")
# Now, execution part
if __name__ == "__main__":
arg_parser = argparse.ArgumentParser(description=__doc__)
arg_parser.add_argument('--output_prefix', type=str,
default='./_',
nargs='?', help="prefix for output files")
arg_parser.add_argument('the_files', type=str,
nargs='*', help="Files to read and process")
the_arguments = arg_parser.parse_args()
try:
iters2mean_n_std(**vars(the_arguments))
except Exception as err_:
print("error")
print(err_)
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment