icecube / skyllh

https://icecube.github.io/skyllh/
GNU General Public License v3.0
11 stars 5 forks source link

Add weights to the SourceModel class __str__ #218

Open juanma-cano-vila opened 8 months ago

juanma-cano-vila commented 8 months ago

For better track in the logs and development, it would be nice to add the weight of each source to the strmethod. That way, when printing the shg_mgr or when it appears on a .log file it will include this information, useful for a better track when doing different stacking analysis with different weight hypothesis.

It would look something like this:

print(shg_mgr)
SourceHypoGroupManager
    Source Hypothesis Groups:
        0: SourceHypoGroup:
            sources (6):
                0: PointLikeSource: "Source 0": { ra=342.167 deg, dec=45.372 deg, weight=51.18216, classification=AGN }
                1: PointLikeSource: "Source 1": { ra=107.457 deg, dec=-38.936 deg, weight=26.16121, classification=AGN }
                2: PointLikeSource: "Source 2": { ra=85.252 deg, dec=-37.053 deg, weight=8.56492, classification=AGN }
                3: PointLikeSource: "Source 3": { ra=184.078 deg, dec=-72.267 deg, weight=94.30561, classification=AGN }
                4: PointLikeSource: "Source 4": { ra=290.859 deg, dec=-1.756 deg, weight=80.50029, classification=AGN }
                5: PointLikeSource: "Source 5": { ra=123.578 deg, dec=15.181 deg, weight=53.81644, classification=AGN }

            fluxmodel:
                1.000e+00 * (E / (1000 GeV))^-2 * 1 (GeV cm^2 s)^-1
            detector signal yield builders (1):
                PDSingleParamFluxPointLikeSourceI3DetSigYieldBuilder
            signal generation method:
                NoneType

I hope is not to loaded with information.

Also, the format of the weights is .5f, but it could be shortened or forced to be normalized to 1 to avoid extremely large numbers. Currently it displays the original, non normalized inputs

martwo commented 8 months ago

I agree with the additional information to print out.

Regarding the normalization of the weights: The weights must not be normalized, because these are scaling factors for the signal generation. So it will be possible to generate like 3 times the flux for source 1 and while only 0.5 times the flux for source 2. Hence the weights would be 3 and 0.5.