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

Fast TS map and add support for regional fitting and use scatter intead of text to plot the true location. #171

Merged
merged 10 commits into from
Aug 6, 2024

Conversation

Yong2Sheng
Copy link
Contributor

These changes are made for introducing the TS map method into my localization pipeline and optimizing the plotting method.

Update 1

In order to accelerate the ts map fitting in localization simulation, I modified fast_ts_fit.py to fit a specific disc region instead of the full map.

Update 2

  1. hp.projtext will place an offset between the text and the coordinate you give, which caused a noticeable systematic offset between the localized 90% containment region and the true location.

  2. Now it uses hp.projscatter, and the markers are placed at the exact location. If you run ts map tutorial notebook, you will find that the containment region is more consistent with the true location of the source than before.

@israelmcmc
Copy link
Collaborator

Thanks @Yong2Sheng . Can you please separate this into two PRs? The plotting change is simple and I'd like to include it in DC2, but I rather not merge the other one right before the release.

@Yong2Sheng
Copy link
Contributor Author

Sure! I will make a new branch that has the changes in the plot method only!

@israelmcmc
Copy link
Collaborator

Thanks @Yong2Sheng !

@Yong2Sheng
Copy link
Contributor Author

Hi @israelmcmc, I made another PR #172 that only contains the updates to the plotting method. I will modify this one later so it will only contain the updates to the regional fitting part.

@israelmcmc israelmcmc changed the base branch from main to develop March 25, 2024 15:16
@israelmcmc
Copy link
Collaborator

I changed the target branch to "develop". I want to avoid adding new features to the version we're releasing today. I'll explain this further tomorrow during the cosipy meeting.

@israelmcmc israelmcmc added enhancement New feature or request tsmap labels May 9, 2024
@israelmcmc israelmcmc requested a review from lommler May 15, 2024 13:21
Copy link

codecov bot commented Jun 18, 2024

Codecov Report

Attention: Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.

Project coverage is 63.14%. Comparing base (b3f85ab) to head (491a8b4).

Files Patch % Lines
cosipy/ts_map/fast_ts_fit.py 75.00% 1 Missing ⚠️
Files Coverage Δ
cosipy/ts_map/__init__.py 100.00% <100.00%> (ø)
cosipy/ts_map/fast_ts_fit.py 53.71% <75.00%> (+29.85%) ⬆️

... and 1 file with indirect coverage changes

@GallegoSav
Copy link
Contributor

Hi @Yong2Sheng , I tried your pr and everything went well for me. That's indeed fast when you can get lot of CPUs.

However, why do you use a so fine binning in time (0.5s) for Crab_bkg_galactic_inputs.yaml It is making a heavy file for the background and I don't see where you use the time in you code because it seems for me you are using the total 3 months bck.

In addition you only used the albedo photon background component. I tried with total_bg_3months_binned_for_continuum.hdf5, that's only 188Mo because time binning is 3600s. The TS map seems to converge well when we use all the background.

image
image

@Yong2Sheng
Copy link
Contributor Author

Hi @GallegoSav,

Thank you for your comments! it’s a good idea to use larger time binning to save the file size. I will make a new version of the data and upload to Wasabi after tests. (Total background and larger time binning).

@israelmcmc
Copy link
Collaborator

@Yong2Sheng: @GallegoSav is a good suggestion, but I think it can be done in a separate PR, if you want. This one is working properly, it's only a matter of the user inputs. The only thing preventing this PR from being merged is the unit test. 50% of the new lines need to be covered (it says 100%, but I have a tolerance of 50% for now). Please let me know if you need help with the unit tests.

@israelmcmc israelmcmc self-assigned this Jul 19, 2024
@israelmcmc
Copy link
Collaborator

I'm closing and reopening this PR to kick codecov. There was a recent change in GitHub that broke it, but I think it's fixed now.

@israelmcmc israelmcmc closed this Jul 22, 2024
@israelmcmc israelmcmc reopened this Jul 22, 2024
@GallegoSav
Copy link
Contributor

@Yong2Sheng: @GallegoSav is a good suggestion, but I think it can be done in a separate PR, if you want. This one is working properly, it's only a matter of the user inputs. The only thing preventing this PR from being merged is the unit test. 50% of the new lines need to be covered (it says 100%, but I have a tolerance of 50% for now). Please let me know if you need help with the unit tests.

@israelmcmc I think I would need help for unit test because I never done that
image

@Yong2Sheng
Copy link
Contributor Author

Hi @israelmcmc,

Thank you for the comments. I will work on the unit test. I will let you know if I need help on this.

@israelmcmc
Copy link
Collaborator

@GallegoSav I was asking Yong to add the tests for this PR, but you'll need to do it as well at some point hehe. Here are some instructions: https://github.com/cositools/cosipy/blob/c8eb53631f686621d93a8b56395ce66ae3d71825/docs/dev/unit_tests.rst

@Yong2Sheng
Copy link
Contributor Author

Hi @israelmcmc @GallegoSav , the unit test of ts_map module has been added:

  1. fast_norm_fit.py coverage is 80%
  2. fast_ts_fit.py coverage is 54%

Could you please take a look? Thank you!

@israelmcmc israelmcmc changed the title Add support for regional fitting and use scatter intead of text to plot the true location. Fast TS map and add support for regional fitting and use scatter intead of text to plot the true location. Aug 6, 2024
Copy link
Collaborator

@israelmcmc israelmcmc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Yong2Sheng! Everything looks good, I'm merging it.

@israelmcmc israelmcmc merged commit d74b7cf into cositools:develop Aug 6, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request tsmap
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants