Dear Dr Lopes and Bonsai community,
I am Jade, a PhD student at the University of Hong Kong and for my research project I am attempting to use Bonsai for behavioural tracking and analysis of larval zebrafish. I am not yet familiar with Python language and I am encountering an issue in my workflow, I am hoping you could help me. I am running Bonsai 2.6.2 on Windows 10 and I am using a workflow from the BonZeb package, that allows multi animal tracking. My issue is at the end of my workflow, as a code contained in « Python Transform » cannot be ran. Bonsai responds « No module named csv » after trying to import csv in that script. I thought modules like csv and os were inherent to Python so I dont know what to do.I have installed Python and IronPython packages in Bonsai, along with the Bonsai Starter pack so I think it should be fine, not to mention i have anaconda3 on my laptop as well.
I have attached the workflow file for
your reference, I think it should be helpful. Also I copied the script in which
I have an issue at the bottom of this discussion for you to see. As I have
downloaded them from the Github repository of BonZeb it should not contain
mistakes, but who knows…
I am a bit desperate because I have worked on previous steps for a while now
and was really excited about how well things seemed to be going. I hope it is a
silly mistake and that you could help me with little to no hassle too.
Thank you very much for your attention and please do not hesitate to contact me
if you need any additional information.
Best regards,
Jade Mathilde SOURISSE
import csv
import os
csv_writer = None
csv_file = None
filename = None
def unload():
global filename, csv_file, csv_writer
if filename is not None:
filename = None
if csv_file is not None:
csv_file.close()
csv_file = None
if csv_writer is not None:
csv_writer = None
@returns(bool)
def process(value):
global filename, csv_file, csv_writer
if filename is None:
filename = "tracking_results.csv"
csv_file = open(filename, 'wb')
csv_writer = csv.writer(csv_file, delimiter = ',')
n_fish_list = []
for tail_points in value.Item1:
tail_points_list = []
for tail_point in tail_points:
tail_points_list.append(str(tail_point))
n_fish_list.append(str(tail_points_list))
csv_writer.writerow(n_fish_list)
return True
--
You received this message because you are subscribed to the Google Groups "Bonsai Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/ea4be747-2f86-4a63-b0f7-966c50ca87f8n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/0ca292d9-dd94-4190-b811-f82374616c01n%40googlegroups.com.