Skip to content

Reworking of the ObserverTimeEvolution #511

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

Merged
merged 14 commits into from
Mar 11, 2025

Conversation

JanNiklasB
Copy link
Contributor

@JanNiklasB JanNiklasB commented Dec 19, 2024

Dear All,

in this pull request, I want to introduce a reworked ObserverTimeEvolution.
I replaced the addTimeRange function which filled the detList array with a function
that takes the required index as an argument and returns the time that should be observed.
For that, I also changed other parts of the ObserverTimeEvolution class to
correctly utilize that new getTime function.
I also kept the option of using a detList by utilizing a new constructor.
Furthermore, it is possible to use a user-defined getTime function by utilizing
the setUserDefinedGetTime function.

Additionally, I fixed the issue mentioned in #510.
For that, it was necessary to change some tests, since those handled
the maximum observed time like max = numb * dist when it should
be handled like max = min + numb * dist.

@lukasmerten lukasmerten self-assigned this Jan 9, 2025
Jan-Niklas Bohnensack added 4 commits March 4, 2025 01:08
- fixed wrong scaling in constructor
- fixed unexpected behavior in getTimes
- added more detailed documentation
- replaced customGetTime with virtual on getTime since it is only used inside c++
- modified Test for checkDetection
- added Test for behavior with arrays instead of getTime function
- added clear and empty function
 - further fixed a floating point issue in testBreakCondition
@JanNiklasB
Copy link
Contributor Author

After discussing pull request with @JulienDoerner, I added setter and getter functions as well as some older functions that I previously removed to preserve compatibility.

  • The ObserverTimeEvolution now creates the protected vector detList when calling any functions that require detList like addTime or addTimeRange.
  • Futhermore, function to edit detList more freely like clear and setTimes were added.
  • Since it is only necessary to use custom functions inside of c++, the override of the getTime can now be done directly by overriding the virtual function getTime.
  • I added tests to testBreakCondition where the behavior of the arrays is tested in more detail.

For a more detailed description of the single changes, see the comments.

Copy link
Member

@JulienDoerner JulienDoerner left a comment

Choose a reason for hiding this comment

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

Hey @JanNiklasB,

the overall changes look good for me and it improves the usability for non-uniform observations.
I left some comments about code style (see below).

And can you please add your changes to the CHANGELOG.md.

Jan-Niklas Bohnensack added 3 commits March 6, 2025 18:48
- Replaced EXPECT_TRUE with EXPECT_NEAR in TimeEvolutionArray
- all changes to variables now over setter functions
- valid range check for min if isLogarithmicScaling = true now in setMinimum
Copy link
Member

@JulienDoerner JulienDoerner left a comment

Choose a reason for hiding this comment

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

This looks good for me now and can be merged.

@JulienDoerner JulienDoerner merged commit 5e8b1cb into CRPropa:master Mar 11, 2025
3 of 4 checks passed
@JanNiklasB JanNiklasB deleted the RenewObserverTimeEvolution branch June 12, 2025 13:03
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.

3 participants