-
Notifications
You must be signed in to change notification settings - Fork 46
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
[INFRA] Python test automation #44
base: main
Are you sure you want to change the base?
Conversation
Common base for the matlab and python testing branch to minimize merge conflicts down the line
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-20.04] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to test with different OS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably higher priority is different python versions (since python versions seem to cause more problems)... I suppose, assuming that the tests can run pretty quickly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now set up to test in parallel python 3.7 to python 3.9 on ubuntu, mac, windows
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Running the tests themselves takes about a minute in CI. But the whole takes a bit more time than this because of the set up and tear down
Trying to test against actual values, I realizing that the Is this intentional? In [65]: tmp = np.load("TYPEB_FITHRF.npy", allow_pickle=True)
...: print(tmp.item(0)["HRFindex"].shape)
...:
...: tmp = np.load("TYPEC_FITHRF_GLMDENOISE.npy", allow_pickle=True)
...: print(tmp.item(0)["HRFindex"].shape)
...:
...: tmp = np.load("TYPED_FITHRF_GLMDENOISE_RR.npy", allow_pickle=True)
...: print(tmp.item(0)["HRFindex"].shape)
(20, 20, 1)
(20, 20, 1)
(400,) |
Looks like this is because there is not a GLMsingle/glmsingle/glmsingle.py Line 1386 in 0d835eb
in an "else" block for model 3 as there is for model 2. |
This is now set up |
|
||
[![Python tests](https://github.com/cvnlab/GLMsingle/actions/workflows/run_tests_python.yml/badge.svg)](https://github.com/cvnlab/GLMsingle/actions/workflows/run_tests_python.yml) | ||
[![Python demos](https://github.com/cvnlab/GLMsingle/actions/workflows/run_demos_python.yml/badge.svg)](https://github.com/cvnlab/GLMsingle/actions/workflows/run_demos_python.yml) | ||
[![Python-coverage](https://codecov.io/gh/Remi-Gau/GLMsingle/branch/main/graph/badge.svg?token=H75TAAUVSW)](https://codecov.io/gh/Remi-Gau/GLMsingle) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code coverage is not yet uploaded and so this might require some tweaking after merging:
- setting up an account for cvnlab on codecov (can simply link the github account)
- changing the URL of this badge
But once set up you can know how pull request change the code coverage: like this
Remi-Gau#3 (comment)
|
||
Notes: | ||
* Please note that GLMsingle is not (yet) compatible with Python 3.9 (due to an incompatibility between scikit-learn and Python 3.9). Please use Python 3.8 or earlier. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have removed this since the tests pass with python 3.9.
But there seem to be a different issue with python 3.10 and numpy: I can investigate but I would not consider necessary for this PR
fracridge>=1.4.3 | ||
h5py>=3.1.0 | ||
matplotlib>=3.3.4 | ||
nibabel>=3.2.2 | ||
numpy>=1.17.0 | ||
scikit-learn>=0.23.2 | ||
scipy>=1.5.4 | ||
tqdm>=4.63.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have pinned the dependency minimum version for GLMsingle to be those that were installed by default when using python 3.6.
version='0.0.1', | ||
version='1.0.0', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To match what the README and the github tag say
@@ -28,5 +28,6 @@ | |||
packages=find_packages(), | |||
include_package_data=True, | |||
zip_safe=False, | |||
install_requires=requires | |||
install_requires=requires, | |||
python_requires='>=3.6, <3.10' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specifying which python version to use
# TODO use same expected data for Python and MATLAB ? | ||
# TODO in both cases expected results should probably be in a set of CSV files | ||
# tmp = sio.loadmat(join(expected_dir, "TYPEB_FITHRF.mat")) | ||
# expected["typeb"]["HRFindex"] = tmp["HRFindex"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the long run we probably do not want to have different expected data for MATLAB and python, a set of CSV files to read from for both languages could be easier to handle, more interoperable and easier to inspect too.
@iancharest |
[black](https://black.readthedocs.io/en/stable/) (code formater) and | ||
[flake8](https://flake8.pycqa.org/en/latest/) (style guide enforcement) are used | ||
on the test code base. | ||
|
||
Ypu can use make to run them automatically with | ||
|
||
```bash | ||
make lint/black # to run black | ||
make lint/flake8 # to run flake8 | ||
make lint # to run both | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of those are for code styling, so it does not have to be done manually. Only applies to the test code base.
Can remove it if you want.
I think that sounds about right. Basically, the code tries to flexibly handle X Y Z (volume) data, or A (surface) data, and there are funny reshapings that have to happen. Hopefully you and @iancharest can sort this out and put this into this pull request. |
Because this has not been merged, the results of the Github continuous integration woklfows are for now only viewable in the action tab of my fork
The initial commit of this PR is common to #44 (some changes are common to both PR and this might help prevent merge conflicts).
relates to #33
TODO
DONE