I'm trying to reference the iteration value i
in a parallel loop using Joblib. I'm getting the error NameError: name 'i' is not defined
. Below is my code:
def sub5():
curveplots = []
nodes = node_matrix[:,i,:].T
curveplots = bezier.Curve(nodes, degree=2).evaluate_multi(np.linspace(0,1,bezier_precision)).T
return curveplots
curveplots = Parallel(n_jobs=-1,)(delayed(sub5)()for i in range(l))
I'm assuming this is because i
is defined when I call Parallel
, after the function sub5
. But I'm not sure how to get around this. Any ideas? Thanks!