I am a first-year graduate student. My supervisor asked me to export fission rate data and create plots. My senior colleague mentioned that I could find the relevant code on the OpenMC official website, but I couldn’t find it. What should I do to find code examples like this?I have attached the code provided by my senior colleague below. My goal is to develop a script that extracts the fission rate. Where can I find this type of code? If it’s not readily available, how should I go about writing it myself?
import openmc.examples
import numpy as np
import matplotlib.pyplot as plt
import glob
from IPython.display import Image
import openmc.examples
import openmc
import openmc.model
import scipy.stats
import pandas as pd
import math
from math import pi
import os
import pickle
import openmc.deplete
import openpyxl
import openmc.lib
from IPython.display import display, clear_output
assert(openmc.lib._dagmc_enabled())
import openmc
import pandas as pd
with openmc.StatePoint(‘statepoint.150.h5’) as sp:
x_flux_tally = sp.tallies[200]
x_flux_df = x_flux_tally.get_pandas_dataframe()
x_flux_df.to_excel(‘2_x_flux.xlsx’)
z_flux_tally = sp.tallies[201]
z_flux_df = z_flux_tally.get_pandas_dataframe()
z_flux_df.to_excel(‘3_z_flux.xlsx’)
xy_flux_tally = sp.tallies[203]
xy_flux_df = xy_flux_tally.get_pandas_dataframe()
xy_flux_df.to_excel(‘4_xy_flux.xlsx’)
df = pd.read_excel(“4_xy_flux.xlsx”)
column_G = df.iloc[:, 6]
extracted_data = column_G.iloc[2::5]
data_chunks = [extracted_data[i:i + 360].tolist() for i in range(0, len(extracted_data), 360)]
new_df = pd.DataFrame()
for i, chunk in enumerate(data_chunks):
new_df[f"Column {i + 1}“] = chunk
new_df.to_excel(“5_flux.xlsx”, index=False)
column_G = df.iloc[:, 6]
extracted_data = column_G.iloc[3::5]
data_chunks = [extracted_data[i:i + 360].tolist() for i in range(0, len(extracted_data), 360)]
new_df = pd.DataFrame()
for i, chunk in enumerate(data_chunks):
new_df[f"Column {i + 1}”] = chunk