oslocyclotronlab / ompy

A python implementation of the Oslo method
https://ompy.readthedocs.io
GNU General Public License v3.0
7 stars 7 forks source link

Get the mean Raw, Unfolded and Primary from Ensemble #180

Open tellefs opened 3 years ago

tellefs commented 3 years ago

Right now, one can extract e.g. the first generation matrix from the ensemble ensemble.get_firstgen(0) Here one has to specify which ensemble member to choose. If one could get mean of these matrices, e.g. like ensemble.get_firstgen_mean() This could be nice for different plotting purposes. It might be excess, but I'll put it here and see what you think.

Right now I have done something like:

primary_plot=ensemble.get_firstgen(0)

for i in range(1, ensemble_members):
    primary_plot += ensemble.get_firstgen(i)

primary_plot /= ensemble_members
fzeiser commented 3 years ago

For the article we created a function like this: https://github.com/fzeiser/ompy_article_data/blob/aa303b769c92777cc7046dedef1d8fbc8e82efa1/myplots.py#L10-L79

This could be implemented as a method of ensemble / as a part of the plot method.

tellefs commented 3 years ago

But that still plots the original raw matrix, and its unfolded and primary, right? Or du you mean to include the lines that are removed by comment:

    # # mean values
    # raw = om.Matrix(np.mean(ensemble.raw_ensemble, axis=0),
    #                 Ex=ensemble.raw.Ex, Eg=ensemble.raw.Eg)
    # unfolded = om.Matrix(np.mean(ensemble.unfolded_ensemble, axis=0),
    #                      Ex=ensemble.raw.Ex,
    #                      Eg=ensemble.raw.Eg)
    # firstgen = om.Matrix(np.mean(ensemble.firstgen_ensemble, axis=0),
    #                      Ex=ensemble.firstgen.Ex,
    #                      Eg=ensemble.firstgen.Eg)