Open KrisThielemans opened 6 years ago
And I've made a script to convert spyder scripts to jupyter notebooks! We can close the circle.
:-) I knew you were not a copy-paste guy.
will be interesting to see the output... Note that there are some fixes on the demos already.
After the first file I painstakingly translated I went for the more interesting way. Which enabled me to update the notebook you've updated!
I've got a question: it seems that you need to run the PET interactive samples in a single thread, as one is needed for the other step. Shall I put it all in one notebook?
MR notebooks work like charm.
BTW, you can already try it on any machine with SIRF installed (and jupyter)
great.
RE the PET interactive ones question, does each notebook run with its own kernel? If not, I'd rather avoid it. It otherwise would become a very large notebook. Maybe we could put some stuff in then to avoid the dependency. To discuss tomorrow?
BTW: try, yes. great. but where are they? :-;
they are here https://github.com/CCPPETMR/SIRF-Exercises/tree/notebook
Yes, each notebook runs on a different kernel, and to make a notebook connect to another kernel is quite a hack.
notebook convert
can output spyder, and/or check the spyder notebook plug-in.
from the link above, we could do ipython nbconvert --config mycfg.py
which should hopefully allow us to replace # <codecell>
with #%%
automatically. If it doesn't we can always run our own script to do the replacement.
update: jupyter nbconvert --to python
now does # In [*]
instead. This seems to be supportend by spyder
(spyder-ide/spyder#1783). I've tested this with latest jupyter
and spyder
via conda
(and nbstripout
via pip
). I'd recommend:
nbstripout file.ipynb && jupyter nbconvert --to python file.ipynb
would need to be done at install time (see #181) I think
for the course, we've decided on jupyter notebooks (assuming it all works!). That will lead to duplication of demos and therefore bugs.
One solution might be to swap to jupyter notebooks and tell people about the spyder plug-in to use jupyter notebooks in spyder. I haven't tried this yet.
By the way, there seems to be a nice feature of jupyter notebooks to be able to generate a new notebook with all output, and then convert it to HTML (or Latex or ...), see here. This would be good for generating documentation.