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

Added timestamp calculation to detsim city #778

Merged
merged 7 commits into from
Apr 7, 2021

Conversation

MCruces-fz
Copy link
Collaborator

Timestamp calculation is based on rate parameter and event number.

@MCruces-fz
Copy link
Collaborator Author

MCruces-fz commented Mar 16, 2021

I have left the modifications of the names of the output files for each detsim test in a different commit at the request of @mmkekic.
All other changes pertinent to the calculation of the timestamp are in the last commit

@mmkekic mmkekic requested a review from gondiaz March 16, 2021 17:30
@jacg
Copy link
Collaborator

jacg commented Apr 6, 2021

The tests are failing. It is not immediately obvious to me that the failure is spurious.

  • If the failure is spurious, please rerun the job on IC.
  • If the failure is not spurious, please fix: having broken PRs sitting around in the queue is not helpful.

@jacg
Copy link
Collaborator

jacg commented Apr 6, 2021

... and please rebase on top of #783 as soon as it is merged, so that we get clearer test error reporting.

@jacg
Copy link
Collaborator

jacg commented Apr 6, 2021

Is there any reason why this PR should not be reviewed and merged?

@jacg
Copy link
Collaborator

jacg commented Apr 6, 2021

#783 has been merged. Please rebase.

@MCruces-fz
Copy link
Collaborator Author

I should clear the commit history a bit. Then, can we merge it?
Maybe I should do more modifications

@gondiaz
Copy link
Collaborator

gondiaz commented Apr 6, 2021

This is the warning message I get when running the function in a python shell:

>>> f = create_timestamp(-2*units.hertz)
/Users/gonzalo/NEXT/IC/invisible_cities/cities/components.py:137: UserWarning: Negative rate is unphysical, using rate = 2.0 Hz instead
  warnings.warn(f"Negative rate is unphysical, using "

Shouldn't we add stacklevel=2 to the warning? The output would be clearer I think

>>> f = create_timestamp(-2*units.hertz)
__main__:1: UserWarning: Negative rate is unphysical, using rate = 2.0 Hz instead

@jacg
Copy link
Collaborator

jacg commented Apr 6, 2021

I should clear the commit history a bit.

Yes, but there's no point in doing that until you have an approving review ... UNLESS (and it's a very important 'unless') cleaning up history will help the reviewers understand what you have done.

Don't hesitate to ask for help with the cleaning, if you need it.

Then, can we merge it?

I'm not the best person to answer that question. You should probably ask for a review (using the buttons/links on the right, near the top of the PR page) from the people you consider most familiar with the issue you are resolving.

@MCruces-fz
Copy link
Collaborator Author

Shouldn't we add stacklevel=2 to the warning? [...]

Good idea, I add that now

@mmkekic
Copy link
Collaborator

mmkekic commented Apr 6, 2021

I'm not the best person to answer that question. You should probably ask for a review (using the buttons/links on the right, near the top of the PR page) from the people you consider most familiar with the issue you are resolving.

Well reviewer @gondiaz has already been assigned and it seems he is mostly happy with the changes.

Shouldn't we add stacklevel=2 to the warning? [...]

I think this is a good idea, that way the warning will point to the function calling create_timestamp where the nonphysical rate value is passed, instead of pointing to the create_timestamp itself

@MCruces-fz
Copy link
Collaborator Author

Okay, thank you @jacg

@jacg
Copy link
Collaborator

jacg commented Apr 6, 2021

Well reviewer @gondiaz has already been assigned and it seems he is mostly happy with the changes.

@gondiaz please formally approve once you are happy, so that it's clear when we can merge.

[@carmenromo You should start thinking about training a successor for the role of merge-master]

@carmenromo
Copy link
Collaborator

Why? Are you not happy with me?
I think most of the people know how to merge, but I can teach anyone :)

@gondiaz
Copy link
Collaborator

gondiaz commented Apr 6, 2021

The PR will be ready after history rewriting/squashing. The commits should be similar to:

  • Modify create_timestamp function
  • Move create_timestamp function to components.py
  • Add test for create_timestamp function
  • Modify detsim city and source with new create_timestamp function
  • Modify detsim tests for new create_timestamp function
  • Modify buffy city and source with new create_timestamp function

Note that you usually start with a past tense at the start of commit messages, change it to present.

@jacg
Copy link
Collaborator

jacg commented Apr 6, 2021

Why? Are you not happy with me?

Very happy!

I think most of the people know how to merge, but I can teach anyone :)

I'm sure that there are many who can merge, but far fewer are aware of the standards of merge commits we expect in IC.

Also remember that the role of merge-master serves two purposes: the idea is that some junior contributor

  1. become comfortable with managing this not-entirely-trivial git operation, and have a regular, not too difficult, but nonetheless important job to do, in order to strengthen a sense of belonging;
  2. relieve more senior members of the somewhat mechanical task.

I think that you're waaaaay past needing point 1 for yourself.

If there are any newish team members who would like a little bit of additional responsibility, or an opportunity to get a bit more comfortable with Git, then step forward.

Job description: merge approved PRs as soon as they are ready, following the merge commit style that we have established in IC. Sometimes PRs are merged by senior people involved, but sometimes they rush on to other things. We need someone who will make sure that approved PRs don't stay unmerged for more than 24h (prefereably 24 minutes :-)

@carmenromo
Copy link
Collaborator

Nice! I see and I fully agree. Do you have someone in mind?

@jacg
Copy link
Collaborator

jacg commented Apr 6, 2021

Note that you usually start with a past tense at the start of commit messages, change it to present.

Strictly speaking it's the imperative mood, rather than present tense:

Do this, fix that, remove the other ...

Some people find it helpful to check whether the commit title completes a sentence starting with something like "Including this commit will ..."

For example: Including this commit will ... fix the bug that cost us the Nobel Prize

@jacg
Copy link
Collaborator

jacg commented Apr 6, 2021

Do you have someone in mind?

Nope. I have no idea who is lurking in the background, how they feel about their relationship to the project etc. etc.

... maybe, after the pandemic is over and I meet some of the new people ...

@carmenromo
Copy link
Collaborator

@halmamol has volunteered!

@jjgomezcadenas
Copy link
Collaborator

jjgomezcadenas commented Apr 6, 2021 via email

@jjgomezcadenas
Copy link
Collaborator

jjgomezcadenas commented Apr 6, 2021 via email

@carmenromo
Copy link
Collaborator

If @MiryamMV wants I can teach both and they can agree as I did with @bpalmeiro.

@jacg
Copy link
Collaborator

jacg commented Apr 6, 2021

Hi @halmamol,

I'm sorry, I don't know who you are. I hope that the coronavirus will allow us to remedy this in the not too distant future. In the meantime don't hesitate to reach out to me if you want any help or assistance, though I am confident that @carmenromo will be able to get you up to speed without any trouble.

@jacg
Copy link
Collaborator

jacg commented Apr 6, 2021

Hi @MiryamMV,

My last message applies to you too!

@jacg
Copy link
Collaborator

jacg commented Apr 6, 2021

Sorry @MCruces-fz ... we seem to have hijacked your PR's conversation to discuss the merge-master role.

@carmenromo, @halmamol, @MiryamMV I'll refrain from merging #784 (which is still waiting for @jmbenlloch's approval, but should be ready), to leave you with plenty of material for practice. Please merge that one before any of the others, otherwise the spurious test failures will drive you nuts. (The whole PR is just a single commit, but do add a merge commit anyway.)

Next is #780. It's squashed and approved, but wait until #784 is in.

After that you can expect this one (#778) and #781 to be ready soon, so there should be plenty of material for you to work with. Merry merging!

Added a check for physical rate values and keept the timestamp
calculation nested.
  - Add rate variable (0.5 Hz) to detsim.conf
  - Add rate parameter in detsim function and MC_hits_from_files call
Update output files of test_detsim_exact and test_buffy_exact_result
@MCruces-fz
Copy link
Collaborator Author

I hadn't realized that my branch was outdated

Copy link
Collaborator

@gondiaz gondiaz left a comment

Choose a reason for hiding this comment

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

This PR succesfully implements timestamps for MC events in both detsim and buffy cities. Good job!
You can proceed with merging @carmenromo @halmamol @MiryamMV.

@carmenromo
Copy link
Collaborator

Since the PR #780 is waiting to pass the tests and this PR is already rebased, can we merge this one first @jacg?

@jacg
Copy link
Collaborator

jacg commented Apr 7, 2021

Yup.

@halmamol halmamol merged commit b7ddb73 into next-exp:master Apr 7, 2021
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.

7 participants