@@ -79,13 +79,13 @@ def project_data(R, field, skip=1):
79
79
length3 = np .linalg .norm (field [:, :3 ], axis = 1 )
80
80
angle = np .arctan2 (field [:, 1 ], field [:, 0 ])
81
81
data = pd .DataFrame (np .hstack ((R , length2 [:, None ], length3 [:, None ], angle [:, None ])),
82
- columns = ["x" , "y" , "length2" , "length3 " , "angle" ])
82
+ columns = ["x" , "y" , "length2" , "length " , "angle" ])
83
83
data = data .sort_values (by = "length2" , ascending = False )
84
84
d2 = data .groupby (["x" , "y" ]).first ()
85
85
# optional slice
86
86
if skip > 1 :
87
87
d2 = d2 .loc [(slice (None , None , skip ), slice (None , None , skip )), :]
88
- return np .array ([i for i in d2 .index ]), d2 [["length2" , "angle" , "length3 " ]]
88
+ return np .array ([i for i in d2 .index ]), d2 [["length2" , "angle" , "length " ]]
89
89
90
90
mesh , field , params_arrows , name = get_mesh_arrows (params , result )
91
91
@@ -109,8 +109,7 @@ def project_data(R, field, skip=1):
109
109
if field is not None :
110
110
# rescale and offset
111
111
scale = 1e6 / display_image [1 ][0 ]
112
- offset = np .array (display_image [0 ].shape [0 :2 ]) / 2
113
-
112
+ offset = np .array (display_image [0 ].shape [0 :2 ]) / 2
114
113
R = mesh .nodes .copy ()
115
114
is3D = R .shape [1 ] == 3
116
115
field = field .copy ()
@@ -123,7 +122,8 @@ def project_data(R, field, skip=1):
123
122
if getattr (mesh , "units" , None ) == "pixels" :
124
123
R = R [:, :2 ]
125
124
R [:, 1 ] = display_image [0 ].shape [0 ] - R [:, 1 ]
126
- field = field [:, :2 ] * params_arrows ["arrow_scale" ]
125
+ field = field [:, :2 ]
126
+ field_to_pixel_factor = params_arrows ["arrow_scale" ]
127
127
field [:, 1 ] = - field [:, 1 ]
128
128
else : # "microns" + 3D
129
129
R = R [:, :2 ][:, ::- 1 ] * scale + offset [::- 1 ]
@@ -169,13 +169,13 @@ def project_data(R, field, skip=1):
169
169
# get the colormap
170
170
cmap = plt .get_cmap (colormap )
171
171
# calculate the colors of the arrows
172
- colors = cmap (field .length3 * scale_max_to_pixel_factor / scale_max )
172
+ colors = cmap (field .length * scale_max_to_pixel_factor / scale_max )
173
173
# set the transparency
174
174
colors [:, 3 ] = alpha
175
175
# make colors uint8
176
176
colors = (colors * 255 ).astype (np .uint8 )
177
177
178
- pil_image = add_quiver (pil_image , R , field .length3 * field_to_pixel_factor , field .angle , colors ,
178
+ pil_image = add_quiver (pil_image , R , field .length * field_to_pixel_factor , field .angle , colors ,
179
179
scale = im_scale * aa_scale ,
180
180
width = params ["2D_arrows" ]["width" ],
181
181
headlength = params ["2D_arrows" ]["headlength" ],
0 commit comments