jrkerns / pylinac

An image analysis library for medical physics
https://pylinac.readthedocs.io/en/latest/
MIT License
153 stars 98 forks source link

Trajectory log results are different on different computers #189

Open bozhikovstanislav opened 5 years ago

bozhikovstanislav commented 5 years ago

Describe the bug A clear and concise description of what the bug is.

The calculation are different on different computers .

There is problem in core directory file image.py

change it with float32 to float64 fixed it

the numpy array must be of type np.float64 !! . .

40 img = load(path, dtype=np.float64)

. . . 624 img_x = spf.sobel(ref_img.as_type(np.float64), 1) 625 img_y = spf.sobel(ref_img.as_type(np.float64), 0)

this fixed it

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

jrkerns commented 5 years ago

Can you give me some more context here? What exactly is different and why is float64 consistent but float32 isn't?

bozhikovstanislav commented 5 years ago

https://stackoverflow.com/questions/13421159/different-result-of-same-numpy-mean-calculation-on-two-computers?fbclid=IwAR2UJkbKazO4RSA8pE-aA4ZrCwwYN3annKmJOi47qbkVvNC9J8g4VjyEo4E

here is explained

On Thu, Aug 22, 2019 at 4:50 AM James Kerns notifications@github.com wrote:

Can you give me some more context here? What exactly is different and why is float64 consistent but float32 isn't?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jrkerns/pylinac/issues/189?email_source=notifications&email_token=ABTLNLWV3FKZM7BHA554GGDQFXWETA5CNFSM4II33P72YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD43TXKA#issuecomment-523713448, or mute the thread https://github.com/notifications/unsubscribe-auth/ABTLNLRMR5NI52IE4WM7OXTQFXWETANCNFSM4II33P7Q .

bozhikovstanislav commented 5 years ago

I found that when my professor is doing the same calculation on his computer . the results were differed than that of my computer . after changing np.float32 to np.float64 . everything go the same ... as it was mention in the link above . it is related on how numpy library is manipulating big set of array .... this is what I can say ..