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 a function to delete a time interval from GTI #4822

Merged
merged 7 commits into from Oct 19, 2023

Conversation

cgalelli
Copy link
Contributor

As requested by the issue #4784 I added a function that removes a "bad time interval" from the GTIs with correlated test. A future addition will be a more complex handling of lists of "bad periods"

@registerrier
Copy link
Contributor

The CI issue is corrected. You can rebase to make it run.

@registerrier registerrier added feature coding sprint To be tackled during coding sprint labels Oct 19, 2023
@registerrier registerrier added this to the 1.2 milestone Oct 19, 2023
@registerrier registerrier linked an issue Oct 19, 2023 that may be closed by this pull request
@codecov
Copy link

codecov bot commented Oct 19, 2023

Codecov Report

Merging #4822 (043362d) into main (64a6b2a) will increase coverage by 0.02%.
Report is 10 commits behind head on main.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #4822      +/-   ##
==========================================
+ Coverage   75.52%   75.54%   +0.02%     
==========================================
  Files         224      224              
  Lines       32771    32804      +33     
==========================================
+ Hits        24750    24783      +33     
  Misses       8021     8021              
Files Coverage Δ
gammapy/data/gti.py 81.60% <100.00%> (+1.00%) ⬆️
gammapy/estimators/utils.py 75.71% <100.00%> (+1.66%) ⬆️
gammapy/stats/__init__.py 100.00% <100.00%> (ø)
gammapy/stats/variability.py 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@registerrier registerrier left a comment

Choose a reason for hiding this comment

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

Thanks @cgalelli . This looks good!

I think there is one issue because you don't copy the parent Table. You are probably modifying the GTI.

Otherwise you might add a test when the bad interval is partly outside or fully outside the range of your GTI?

interval_start.format = self.time_start.format
interval_stop.format = self.time_stop.format

trim_table = self.table
Copy link
Contributor

Choose a reason for hiding this comment

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

Here you are modifying the parent table. You should make a copy to avoid changing the parent GTI.

gammapy/data/gti.py Outdated Show resolved Hide resolved
Signed-off-by: cgalelli <claudio.galelli@obspm.fr>
Copy link
Contributor

@registerrier registerrier left a comment

Choose a reason for hiding this comment

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

Thanks @cgalelli ! Looks good to me.

@registerrier registerrier merged commit d4587ea into gammapy:main Oct 19, 2023
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
coding sprint To be tackled during coding sprint feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding a GTI.difference or GTI.remove_interval method
3 participants