Searching the standard deviation of a dataframe

Hello,

I am an engineering student and I am currently doing a project related to the improvement of tritium breeder blankets in tokamak power plants.

Basically, I have created a random number of breeder blanket layers with different enrichment fractions in Li6. On each layer, I use a tally to find the TBR (tritium breeding ratio) with OpenMC.

For each layer, the result of the tally is stored in a dataframe. So for each area, I have access to the mean value of the TBR and to the standard deviation too.

I need to have a general value of the TBR and of its standard deviation : so for the value it is quite easy (I just have to consider the mean of all the means of each layer) but I cannot find a command able to give me the combined standard deviation.

For example, here is a screen shot of the dataframe with 4 layers and I would like to know the standard deviation associated to the mean of the means.

cell nuclide score mean std. dev.
0 387 total (n,Xt) 4.80e-01 6.13e-03
1 388 total (n,Xt) 3.53e-01 5.61e-03
2 389 total (n,Xt) 2.10e-01 1.73e-03
3 390 total (n,Xt) 9.70e-02 1.70e-03

Thank you very much for your help.

Hi Maxime,

You would have to use standard propagation of uncertainty in order to determine the variance of the sum of the estimates. Strictly speaking, in order to know the standard deviation of the mean, you would need to know the covariances between the estimates of the TBRs for different layers. As a simplification, you can assume they are independent of one another, which would allow you to calculate the combined variance as:

Var(mean) = 1/(N^2) sum(Var(x_i), i=1…N)

If however, like me, you’re too lazy to propagate uncertainty yourself, you can use the nifty Python uncertainties package to do this for you. By default it will assume covariances are zero. To determine the mean of the estimates from the different layers, you could run something like:

from uncertainties import unumpy
df = <pandas.DataFrame you showed before>

x = unumpy.uarray(df[‘mean’], df[‘std. dev.’])
print(x.mean())

Best regards,
Paul

1 Like