# Get filename
filename = argv[1]

# Determine axial level
axial_level = int(argv[2]) if len(argv) > 2 else 1
score = int(argv[3]) if len(argv) > 3 else 1

# Create StatePoint object
sp = StatePoint(filename)

# Read number of realizations for global tallies
sp.n_realizations = sp._get_int()[0]

# Read global tallies
n_global_tallies = sp._get_int()[0]
sp.global_tallies = np.array(sp._get_double(2 * n_global_tallies))
sp.global_tallies.shape = (n_global_tallies, 2)

# Flag indicating if tallies are present
tallies_present = sp._get_int()[0]

# Check if tallies are present
if not tallies_present:
    raise Exception("No tally data in state point!")

# Loop over all tallies
print("Reading data...")
for t in sp.tallies:
    # Calculate t-value for 95% two-sided CI
    n = t.n_realizations
    t_value = scipy.stats.t.ppf(0.975, n - 1)
    # Create lists for tallies
    mean = np.zeros((nx,ny))
    error = np.zeros((nx,ny))
    criteria = np.zeros((nx,ny))

    # Determine starting position for data
    start = sp1._f.tell()

    for x in range(nx):
        for y in range(ny):
            # Seek to position of data
            sp1._f.seek(start + x*ny*nz*ns*16 + y*nz*ns*16)

            # Read sum and sum-squared
            s, s2 = sp1._get_double(2)
            s /= n
            mean[x,y] = s
            if s != 0.0:
                error[x,y] = t_value*sqrt((s2/n - s*s)/(n-1))/s

    # Make figure
    plt.imshow(error, interpolation="nearest", vmin=0.0, vmax=0.03)
    cb = plt.colorbar()
    [t.set_fontsize(16) for t in cb.ax.get_yticklabels()]
    plt.xlim((0,nx))
    plt.ylim((0,ny))
    plt.xticks(range(1), (''))
    plt.yticks(range(1), (''))
    plt.savefig('opr-without-ufs.pdf', bbox_inches='tight')
    plt.close()
示例#3
0
# Get filename
filename = argv[1]

# Determine axial level
axial_level = int(argv[2]) if len(argv) > 2 else 1
score = int(argv[3]) if len(argv) > 3 else 1

# Create StatePoint object
sp = StatePoint(filename)

# Read number of realizations for global tallies
sp.n_realizations = sp._get_int()[0]

# Read global tallies
n_global_tallies = sp._get_int()[0]
sp.global_tallies = np.array(sp._get_double(2*n_global_tallies))
sp.global_tallies.shape = (n_global_tallies, 2)

# Flag indicating if tallies are present
tallies_present = sp._get_int()[0]

# Check if tallies are present
if not tallies_present:
    raise Exception("No tally data in state point!")

# Loop over all tallies
print("Reading data...")
for t in sp.tallies:
    # Calculate t-value for 95% two-sided CI
    n = t.n_realizations
    t_value = scipy.stats.t.ppf(0.975, n - 1)
示例#4
0
    # Create lists for tallies
    mean = np.zeros((nx, ny))
    error = np.zeros((nx, ny))
    criteria = np.zeros((nx, ny))

    # Determine starting position for data
    start = sp1._f.tell()

    for x in range(nx):
        for y in range(ny):
            # Seek to position of data
            sp1._f.seek(start + x * ny * nz * ns * 16 + y * nz * ns * 16)

            # Read sum and sum-squared
            s, s2 = sp1._get_double(2)
            s /= n
            mean[x, y] = s
            if s != 0.0:
                error[x, y] = t_value * sqrt((s2 / n - s * s) / (n - 1)) / s

    # Make figure
    plt.imshow(error, interpolation="nearest", vmin=0.0, vmax=0.03)
    cb = plt.colorbar()
    [t.set_fontsize(16) for t in cb.ax.get_yticklabels()]
    plt.xlim((0, nx))
    plt.ylim((0, ny))
    plt.xticks(range(1), (''))
    plt.yticks(range(1), (''))
    plt.savefig('opr-without-ufs.pdf', bbox_inches='tight')
    plt.close()