yves-weissenberger / twoptb

Python toolbox for analysing data from two photon imaging experiments
0 stars 1 forks source link

twoptb use in jupyter #14

Open QNeuron opened 6 years ago

QNeuron commented 6 years ago

Hi again,

Not sure if this is an issue or a question, but I tried to use your toolbox in jupyter the following way:

import twoptb as tptb tptb.ROIs.ROI_Drawer(pathToHdfFile)

but only a subset of the functions were accessible from the import, and ROI_Drawer is not one of them. The functions to train and run the classifier are also not accessible. I am ust trying to run the thing in jupyter to be able to try different threshold easier than in command line.

Ultimately, it would be usefull for me to write a pipeline to call all the functions without typing them one by one in cmd...

So, am I missing something here ? I tried to re-install the toolbox, thinking that the pulls may have done something, but it does not change that.

yves-weissenberger commented 6 years ago

I haven't done any testing with jupyer but would be surprised if the scripts would work with it, at the moment. I think the easy way to do this would be with a shell script.

Batch scripts will be added soon, if that helps, @samupicard has them written.

yves-weissenberger commented 6 years ago

just a thought, I think one thing to try, which is maybe the easiest way of doing this is to write a quick wrapper around the function which opens it via the os module. I don't know if this would work but you could try to instead of

import twoptb as tptb
tptb.ROIs.ROI_Drawer(pathToHdfFile)

do

import os
pathvar = '/path/to/hdf5.h5'
os.system('ROI_Drawer.py' + ' ' + pathvar)

note the space before

or analogously

import subprocess
pathvar = '/path/to/hdf5.h5'
p = subprocess.Popen(["ROI_Drawer.py",pathvar])

I haven't tested either of these but can imagine that with a little bit of fiddling this can be implemented

QNeuron commented 6 years ago

Just gave it a quick shot, the os.system command do nto fail, but you don't retrieve the graphical output. So, not ideal for the roi drawer, but maybe worth it to run the registration on all areas from an animal automatically.

yves-weissenberger commented 6 years ago

its with the gods now