SyneRBI / SIRF-Exercises

SIRF Training and demonstration material
http://www.ccpsynerbi.ac.uk
Apache License 2.0
18 stars 21 forks source link

MissingIDFieldWarning #191

Closed KrisThielemans closed 1 year ago

KrisThielemans commented 1 year ago

when git pull or similar I get

/home/sirfuser/.local/lib/python3.10/site-packages/nbformat/__init__.py:92: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.

  validate(nb)

this is because nbstripout validates the notebooks first.

I don't know how to find out which notebooks have this problem and I don't know how to call normalize() either!

It's a warning so not urgent.

evgueni-ovtchinnikov commented 1 year ago

I get similar warnings from git status in SIRF-Exercises and also

No valid notebook detected)
error: external filter '"/usr/bin/python3" -m nbstripout' failed 1
error: external filter '"/usr/bin/python3" -m nbstripout' failed
No valid notebook detected
error: external filter '"/usr/bin/python3" -m nbstripout' failed 1
error: external filter '"/usr/bin/python3" -m nbstripout' failed
Refresh index: 100% (90/90), done.

culminating with

On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
    modified:   notebooks/Deep_Learning_PET/4_setup_training.ipynb
    modified:   notebooks/Geometry/d_manipulation.ipynb
    modified:   notebooks/Geometry/get_nifti_data.ipynb

no changes added to commit (use "git add" and/or "git commit -a")

For 4_setup_training.ipynb, git diff actually gives no output, and for the other two files a lot of differences like this one:

  "cells": [
   {
    "cell_type": "markdown",
-   "id": "fcfde9f0",
+   "id": "cf2f627c",
    "metadata": {},
    "source": [
     "### Manipulating Volumes\n",

Whose changes are those, and should I commit or restore?

KrisThielemans commented 1 year ago

They're likely my changes...

Which branch are you on please? It's possible that a git pull did something weird and that your local copy isn't identical to what is online. It might be good to do

git fetch origin
git reset --hard origin/master

or whatever branch you are on.

evgueni-ovtchinnikov commented 1 year ago

@KrisThielemans Having applied your suggestion, I now get

On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:

  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
    modified:   notebooks/Geometry/d_manipulation.ipynb
    modified:   notebooks/Geometry/get_nifti_data.ipynb
    modified:   notebooks/SPECT/SPECT_OSEM_measured_data.ipynb

no changes added to commit (use "git add" and/or "git commit -a")

I suggest I restore to move on - after all, I can always import another copy of VM 3.4.0 should these changes be important, can I not?

evgueni-ovtchinnikov commented 1 year ago

git restore did not work - had to commit to move from master to jupyterlab, ended up in exactly the same situation:

On branch jupyterlab
Your branch is up to date with 'origin/jupyterlab'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
    modified:   notebooks/Geometry/d_manipulation.ipynb
    modified:   notebooks/Geometry/get_nifti_data.ipynb
    modified:   notebooks/SPECT/SPECT_OSEM_measured_data.ipynb

no changes added to commit (use "git add" and/or "git commit -a")
evgueni-ovtchinnikov commented 1 year ago

have run all PET notebooks, everything looks ok, just minor remarks/corrections:

display_and_projection.ipynb:

"SIRF 3.1 does not provide TOF functionality" - should it not rather be 3.3 or 3.4?

reconstruct_measured_data.ipynb:

DIY_OSEM.ipynb:

KrisThielemans commented 1 year ago

@evgueni-ovtchinnikov I think this might be a bit better now. In #189 I fixed the "id" issues with Geometry/d_manipulation.ipynb such that I get no warnings anymore.

There is of course still the usual stuff that if you run a notebook (without actually making any changes), git status will show it's changed, but git diff will show it isn't. That's due to nbstripout stuff (i.e. git status detects the change, but nbstripout removes the change before handing it to git diff). There isn't much we can do about that unfortunately.

I'll merge this to master now, and then fix your other comments.

Let us know how it goes.

KrisThielemans commented 1 year ago

Other comments are now fixed (on master). thanks!

Please reopen if you still have trouble with git