Open danjgale opened 3 years ago
WIll be added for 0.0.2a
Hi @alyssadai! This is the issue I had in mind in our discussion.
As mentioned above, the views
parameter currently only takes strings for predefined views. Those are mapped on orientations here. Downstream, this tuple is passed into the plotting here.
Passing in custom orientations would just mean that the user would be able to pass in a tuple directly instead of a string that maps to a tuple.
Some potential hurdles:
_broadcast()
used here handles tuples. surf.py
, and admittedly I don't have a full grasp of that code. It's complicated! So it might take a good amount of time figuring out what works and what doesn't. And given that some of the code is convoluted at times, we might end up having to piece together our own hacks over top of it if needed. But if it works...Elaborating further:
The key line of code is here, as mentioned above.
if view[i, j] is not None:
actor['orientation'] = orientations[view[i, j]]
the view
variable is basically an array of whatever views the user passed, with the shape being determined by the layout (see here) . Rather than using the orientation
variable to look up the respective tuple for the view, you could do something like:
if view[i, j] is not None:
if isintance(view[i, j], str):
actor['orientation'] = orientations[view[i, j]]
else:
actor['orientation'] = view[i, j] # pass in a tuple directly
Again, this depends if _broadcast()
lets us pass in a tuple. As mentioned, _broadcast()
basically converts the user's view to an array of views matching the layout.
The final piece of the puzzle is to handle the sign flip. I've done that lazily in the _set_layout()
function here. I basically ask if the right hemisphere is plotted, and if so, swap the medial and lateral views. This amounts to flipping the sign. We might need to check if the user passed a tuple here instead of a string, and manually flip the sign.
Currently the
views
parameter takes one or more predefined views (e.g., 'lateral'). Under the hood these just map to a tuple of viewing angles, so there's no reason why tuples could also just be passed in as well.The only extra step required would be flipping the sign of the
y
angle (second element in the tuple) for the right hemisphere. This could probably be all done in_set_layout()
, or a sub-function to be place in_set_layout()