Pincell example problem

I made a calculation code with python for the pincell example, finally I am getting this error. How can I solve it?

import openmc

# Load the statepoint file
sp = openmc.StatePoint("statepoint.100.h5")

# Get the list of nuclides in the state
nuclides = sp.get_nuclides

# Get the total number of fission products for each time step
fp_numbers = []
for nuclide in nuclides:
    if "fission" in nuclide.name:
        fp_numbers.append(sum(nuclide.number[:]))

# Plot the results
import matplotlib.pyplot as plt
plt.plot(fp_numbers)
plt.xlabel("Time step")
plt.ylabel("Number of fission products")
plt.show()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[4], line 7
      4 sp = openmc.StatePoint("statepoint.100.h5")
      6 # Get the list of nuclides in the state
----> 7 nuclides = sp.get_nuclides
      9 # Get the total number of fission products for each time step
     10 fp_numbers = []

AttributeError: 'StatePoint' object has no attribute 'get_nuclides'

The sp variable in your code snippet is a openmc.Statepoint object.

Here are all the attributes of that object. It does not have a get_nuclides attribute.

Perhaps you want to get a material object as that does have a get_nuclides method

1 Like

I wanted to calculate burnup with this code.Have another method?

I think this is the best fission depletion example I know of as it has a lot of explanation

1 Like