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

refactor: Consistently use mm for time in examples IO #2916

Merged
merged 4 commits into from
Feb 14, 2024

Conversation

andiwand
Copy link
Contributor

We are mixing time units in examples currently. I propose to solve this by consistently using mm which is the native internal core unit

@andiwand andiwand added this to the next milestone Jan 31, 2024
@github-actions github-actions bot added the Component - Examples Affects the Examples module label Jan 31, 2024
Copy link

codecov bot commented Jan 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d5f264e) 48.84% compared to head (d4a1c79) 48.84%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2916   +/-   ##
=======================================
  Coverage   48.84%   48.84%           
=======================================
  Files         495      495           
  Lines       28909    28909           
  Branches    13732    13732           
=======================================
  Hits        14122    14122           
  Misses       4890     4890           
  Partials     9897     9897           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@paulgessinger
Copy link
Member

Hm, shouldn't the ns literal then give us the conversion factor into mm, so that you can write ns and it just does the right thing?

@andiwand
Copy link
Contributor Author

andiwand commented Feb 1, 2024

Hm, shouldn't the ns literal then give us the conversion factor into mm, so that you can write ns and it just does the right thing?

the thing is that we are mixing ns and mm in the output files. we should either consistently use ns or mm. I opted for mm for now as it is also the native internal unit for time

@paulgessinger
Copy link
Member

paulgessinger commented Feb 3, 2024

Right and the way in principle that the unit system is designed is that it converts to our internal units. So in my opinion, if the internal unit is mm, when you write 25_ns it should convert this to the equivalent length in mm and if you want ns back, you divide a time by the constant.

@andiwand
Copy link
Contributor Author

andiwand commented Feb 3, 2024

Right and the way in principle that the unit system is designed is that it converts to our internal units. So in my opinion, if the internal unit is mm, when you write 25_ns it should convert this to the equivalent length in mm and if you want ns back, you divide a time by the constant.

yes this is what it does. I am not touching this. I just noticed that we use different units for time when we write it to file. sometimes we do no conversion which results in mm and sometimes we convert to ns. I would argue that this should be consistent to reduce confusion. and I would argue that mm would be easier as we would not have to convert everything including covariance matrices

@beomki-yeo
Copy link
Contributor

Sorry to jump in but I strongly suggest using one of time units (ps ns us ms s) for time components

@beomki-yeo
Copy link
Contributor

beomki-yeo commented Feb 3, 2024

Just to demonstrate how it can go wrong in deriving $c=1$ in the natural unit

$$c = \frac{\textrm{distance}}{\textrm{time}} = \frac{299792458 * \textrm{unit::m}}{1 * \textrm{unit::s}} = \frac{299792458000}{299792458000} $$

$$c = \frac{\textrm{distance}}{\textrm{time}} = \frac{299792458 * \textrm{unit::m}}{1 * \textrm{unit::mm} ?} = 299792458000? $$

@andiwand
Copy link
Contributor Author

andiwand commented Feb 3, 2024

not sure if I can follow. I don't suggest to change our unit system.

our units are defined as

constexpr double mm = 1.0;
constexpr double s = 299792458000.0;
constexpr double c = 1.0;

but in examples we are mixing time I/O with mm and ns. I suggest to use one of both and personally I would use mm as it matches up with out internal representation and it might be less surprising during debugging.

but I am happy to use ns if you see a benefit.

note that our digitization config also uses mm for time

@beomki-yeo
Copy link
Contributor

beomki-yeo commented Feb 3, 2024

I don't suggest to change our unit system.

I never tried to change the unit system but I am trying fully obey it

Of course we should not mix ns and mm for time -- I am not raising a question on this.

What I suggest is not using length unit for time component which will confuse things a lot as I demonstrated above.
Just try to obtain $c=1$ from using length units in time components...

I will be happy to answer if you don't undertstand why $c$ (speed of light) should be equal to 1

@paulgessinger
Copy link
Member

Should we discuss this in the meeting on Tuesday?

@andiwand
Copy link
Contributor Author

andiwand commented Feb 3, 2024

c = 1 is a definition which ties our time unit to the space unit. not sure why you want to derive that

sure lets discuss on tuesday

@beomki-yeo
Copy link
Contributor

beomki-yeo commented Feb 3, 2024

Discussing why we should use time unit for time quantity - seriously? Yeah let's discuss it then

c = 1 is a definition which ties or time unit to the space unit. not sure why you want to derive that

This change in this PR is defying the definition of $c=1$. That's my point

beomki-yeo
beomki-yeo previously approved these changes Feb 13, 2024
Copy link
Contributor

@beomki-yeo beomki-yeo left a comment

Choose a reason for hiding this comment

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

As concluded in the meeting today, let's go with the unified representation for length and time

@acts-policybot acts-policybot bot dismissed beomki-yeo’s stale review February 14, 2024 07:58

Invalidated by push of 4e929f8

@github-actions github-actions bot added the Infrastructure Changes to build tools, continous integration, ... label Feb 14, 2024
@andiwand andiwand requested a review from beomki-yeo February 14, 2024 08:40
@kodiakhq kodiakhq bot merged commit 19464fa into acts-project:main Feb 14, 2024
54 checks passed
@andiwand andiwand deleted the examples-use-mm-for-time branch February 14, 2024 13:24
@paulgessinger paulgessinger modified the milestones: next, v33.0.0 Mar 6, 2024
EleniXoch pushed a commit to EleniXoch/acts that referenced this pull request May 6, 2024
…#2916)

We are mixing time units in examples currently. I propose to solve this by consistently using `mm` which is the native internal core unit
asalzburger pushed a commit to asalzburger/acts that referenced this pull request May 21, 2024
…#2916)

We are mixing time units in examples currently. I propose to solve this by consistently using `mm` which is the native internal core unit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changes Performance Component - Examples Affects the Examples module Infrastructure Changes to build tools, continous integration, ...
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants