Skip to content

Maximum likelihood method for polarization#443

Open
eneights wants to merge 15 commits intocositools:developfrom
eneights:develop
Open

Maximum likelihood method for polarization#443
eneights wants to merge 15 commits intocositools:developfrom
eneights:develop

Conversation

@eneights
Copy link
Contributor

This updates COSILike to enable polarization fitting in the CDS, and fixes a mistake with the polarization handling in the point source response.

This replaces PR #367. I'm opening this as a draft PR for now, since I still need to add an example notebook and add/fix unit tests.

@eneights eneights marked this pull request as ready for review November 20, 2025 17:53
@eneights
Copy link
Contributor Author

This is ready to be looked at, but I have only tested it with the one GRB in the example notebook so far, and the fraction it outputs is not correct. This might just be due to the coarse response, but before merging, it should probably be tested on some DC3 GRBs

@israelmcmc
Copy link
Collaborator

Cool! @eneights Can you please share an executed tutorial (with outputs) to first see if we can reproduce your results?

@codecov
Copy link

codecov bot commented Nov 20, 2025

Codecov Report

❌ Patch coverage is 62.85714% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.88%. Comparing base (ee6a8bf) to head (9be206f).

Files with missing lines Patch % Lines
cosipy/threeml/COSILike.py 61.76% 13 Missing ⚠️
Files with missing lines Coverage Δ
cosipy/response/PointSourceResponse.py 100.00% <100.00%> (ø)
cosipy/threeml/COSILike.py 73.17% <61.76%> (-1.46%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@eneights
Copy link
Contributor Author

@israelmcmc Yes, just added it!

@israelmcmc
Copy link
Collaborator

Thanks, @eneights !

                                             value  negative_error  \
 source.spectrum.grb.polarization.degree  27.984015       -2.817586   
 source.spectrum.grb.polarization.angle   90.001559       -0.000649

Is the PD 0-100 or is it part of the issue your are fixing?

@eneights
Copy link
Contributor Author

@israelmcmc Just seeing your question for some reason; the PD is 0-100 so this is not an issue

@israelmcmc
Copy link
Collaborator

Thanks @eneights. If I remember correctly, you wanted to test this more before merging? Or is it ready?

@eneights
Copy link
Contributor Author

Alberto just tested this on a persistent source simulated with the source injector and got reasonable results. It was injected with 70% polarization at 45 deg, and the fitted polarization was 59 +/- 4% at 48 +/- 2 deg. I think it's okay to merge if you're comfortable with it, @israelmcmc

@israelmcmc
Copy link
Collaborator

@eneights Sounds good. Yes, I'm good with merging this. Can you just please resolve the conflicts and then I'll merge it?

@eneights
Copy link
Contributor Author

@israelmcmc Conflicts should be resolved now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants