GSTT-CSC / hazen

Quality assurance framework for Magnetic Resonance Imaging
https://github.com/GSTT-CSC/hazen
Apache License 2.0
22 stars 12 forks source link

TestCliParser.test_snr_measured_slice_width Failure #209

Closed JamieSmall closed 1 year ago

JamieSmall commented 2 years ago

Recently installed Hazen in Python on Windows and have had this error returned.

Hazen malfunction

In the output_dict theres an extra two fields:

'snr_subtraction_measured_SNR SAG MEAS1_23_1': 183.97, 'snr_subtraction_normalised_SNR SAG MEAS1_23_1': 7593.04}

Compared to here:

https://github.com/GSTT-CSC/hazen/blob/237a1f17b6e6dafbd70475d7aeb5db0faef08393/tests/test_hazenlib.py#L204

Cheers Jamie

tomaroberts commented 2 years ago

Hi Jamie – thanks for raising.

How did you install hazen on Windows? Guessing you are running via command line rather than hazen-app (i.e.: the Docker version)?

Also, did you clone the repo or download the latest Release (0.5.2)?

JamieSmall commented 2 years ago

Yea just installed via the command line. Rachael figured it all out for her laptop and has the instructions written down.

Cheers Jamie

tomaroberts commented 2 years ago

Did you install version 0.5.2? Does Rachael get the same test fail on her machine as well?

JamieSmall commented 2 years ago

I just downloaded the latest version off github.

JamieSmall commented 2 years ago

Rachael is on a version of Hazen pre the update last December. She is about to chime in here in person I think?

Cheers Jamie

JamieSmall commented 2 years ago

I just downloaded the latest version off github.

Version 0.5.2 yea.

RFranklin-MR commented 2 years ago

I have not taken that version of Hazen yet (haven't used it since release), and so did not get that error (just run the tests now).

=============================================== short test summary info =============================================== FAILED tests/test_models.py::UserModelCase::test_avatar - sqlalchemy.exc.OperationalError: (psycopg2.OperationalError... FAILED tests/test_models.py::UserModelCase::test_password_hashing - sqlalchemy.exc.OperationalError: (psycopg2.Operat... ============================== 2 failed, 168 passed, 35086 warnings in 138.30s (0:02:18) ============================== (hazen-user-venv) C:\Users\racha\OneDrive\Documents\STP - Code\hazen-user>hazen --version 0.5.1

(just gonna ignore all those warnings...)

RFranklin-MR commented 2 years ago

When I run git pull, I now get the same error as Jamie: =============================================== short test summary info =============================================== FAILED tests/test_hazenlib.py::TestCliParser::test_snr_measured_slice_width - AssertionError: {'snr_smoothing_measure... FAILED tests/test_models.py::UserModelCase::test_avatar - sqlalchemy.exc.OperationalError: (psycopg2.OperationalError... FAILED tests/test_models.py::UserModelCase::test_password_hashing - sqlalchemy.exc.OperationalError: (psycopg2.Operat... =============================== 3 failed, 170 passed, 10 warnings in 192.16s (0:03:12) ================================

tomaroberts commented 2 years ago

Thanks Rachael – are you running the command line version on Windows too? Or hazen-app?

(I thought you were on a Mac for some reason, but might be wrong)

RFranklin-MR commented 2 years ago

I'm running the command line version directly (on my Windows laptop).

tomaroberts commented 2 years ago

I've looked into this some more. I've installed hazen on a machine running Windows I can access. Essentially there is a difference in the hazen snr results depending on the operating system.

For example, running release/0.5.2 CLI version:

MacOS

(hazen-3.9-pip) tr17@tar-kcl-macbook hazen % hazen snr tests/data/snr/GE --measured_slice_width 1
{   'snr_smoothing_measured_SNR SAG MEAS1_23_1': 184.41,
    'snr_smoothing_measured_SNR SAG MEAS2_24_1': 189.38,
    'snr_smoothing_normalised_SNR SAG MEAS1_23_1': 7610.83,
    'snr_smoothing_normalised_SNR SAG MEAS2_24_1': 7816.0,
    'snr_subtraction_measured_SNR SAG MEAS2_24_1': 182.87,
    'snr_subtraction_normalised_SNR SAG MEAS2_24_1': 7547.37}

Windows (Powershell)

(hazen) PS C:\hazen> hazen snr .\tests\data\snr\GE\ --measured_slice_width 1
{   'snr_smoothing_measured_SNR SAG MEAS1_23_1': 184.41,
    'snr_smoothing_measured_SNR SAG MEAS2_24_1': 189.38,
    'snr_smoothing_normalised_SNR SAG MEAS1_23_1': 7610.83,
    'snr_smoothing_normalised_SNR SAG MEAS2_24_1': 7816.0,
    'snr_subtraction_measured_SNR SAG MEAS1_23_1': 183.97,
    'snr_subtraction_normalised_SNR SAG MEAS1_23_1': 7593.04}

If you look at the last two lines of the outputs, the snr_subtraction results are slightly different between the two operating systems. They also seem to be analysing different series (Mac: SAG MEAS2_24, Win: SAG_MEAS1_23), which is unexpected.

Implementing a fix and a release isn't really feasible for next week I'm afraid. This also illustrates why we are shifting everyone to using the hazen-app (appreciate this doesn't work on Windows yet), and soon the web app, so that everyone is using the same hazen implementation and so that hazen is operating system independent.

JamieSmall commented 2 years ago

Sweet cheers for looking into that. Regardless it looks like I'm heading to Bristol on Monday and will likely need to do the Hazen analysis for an acceptance test without a mac. What do you recommend? Just use it as is? i dont feel the slight difference between them will impact the results significantly given SNR doesn't have a set threshold to pass?

Cheers Jamie

RFranklin-MR commented 2 years ago

Would it be possible to clarify if the SNR results are different simply because they are analysing a different series (indicated by MEAS2_24_1 vs MEAS1_23_1) or producing a different result for the same calculation?

tomaroberts commented 2 years ago

Would it be possible to clarify if the SNR results are different simply because they are analysing a different series (indicated by MEAS2_24_1 vs MEAS1_23_1) or producing a different result for the same calculation?

Hi Rachael – it's not immediately obvious what's going on here and I don't have time to prioritise this at the moment.

We don't officially support using hazen with Windows so I can't recommend that you use it – if one of your team is on site with a Mac then that would be the best option. The values are similar as you say – you could run it with your Windows CLI versions and then verify them on a colleague's Mac afterwards. Up to you guys.

sophie22 commented 1 year ago

I was able to recreate the test error with version 0.5.2, however these Windows related issues have been fixed since and do not occur with the current version (v1.2.0). Please let me know @JamieSmall and @RFranklin-MR if the issue still occurs on your machines with the latest version of Hazen and I'll be happy to look into it further. Otherwise I will close this issue next week as resolved.