Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add weights to the SourceModel class __str__ #218

Open
juanma-cano-vila opened this issue Feb 22, 2024 · 1 comment
Open

Add weights to the SourceModel class __str__ #218

juanma-cano-vila opened this issue Feb 22, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@juanma-cano-vila
Copy link
Collaborator

For better track in the logs and development, it would be nice to add the weight of each source to the __str__method.
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

@juanma-cano-vila juanma-cano-vila self-assigned this Feb 22, 2024
@juanma-cano-vila juanma-cano-vila added the enhancement New feature or request label Feb 22, 2024
@martwo
Copy link
Collaborator

martwo commented Feb 23, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants