Repository navigation
Add an __array__ method to NDData - #266
Conversation
…d by the mailing list thread "NDData plot proposal"
|
+1 I think this fulfills any near-term desire for easy plotting. |
|
+1 from me as well. Even if there ends up being a |
|
My one concern with this is that it makes NDData look like an array when it is really much more than that. If not told otherwise, it would be tempting for users to end up doing, e.g., d = NDData( ... ) to access the underlying data of an NDData object, rather than using I'm not that familiar with the use of masked arrays, but if a masked array is what you want all the time anyway, here's a possible alternative: change NDData. Rather than having separate Just a thought. Would this cause problems for the use of NDData in other situations? (i.e., not knowing if |
|
@kbarbary - we definitely don't want And to clarify, Which is explicit and makes it clear what's going on. @mdboom suggested this as a solution to the plotting commands, because matplotlib functions like |
|
@eteq Thanks for the clarification. I withdraw my comments :) |
|
I agree it's reasonable to elaborate in a comment (or docstring). Will do. |
|
Ok, great - once you've done that, as far as I'm concerned this can be merged. |
|
I'm don't have access to my computer right now, but does this actually make sense for anything else than 1 and 2d datasets? If not, should it just be implemented in Spectrum and Image instead? |
|
For plotting images, lines or scatters with matplotlib, yes it only makes sense for 1 and 2d datasets. 3d is less useful -- looking at mayavi2 as an example, there aren't really any functions that take a 3d array as a volume. In general, though, I think |
|
Ok - in that case I agree it is useful! |
|
@mdboom - I just generated the docstring on this now, and unfortunately, |
|
I've moved the |
|
Alright, looks good - I'll go ahead and merge this, and I'll add a little bit to the |
Add an __array__ method to NDData
Add an __array__ method to NDData
Updating bundled numpydoc version to v0.6
This makes them easier to plot in matplotlib, such as:
Note, this creates zero dependency on matplotlib.
Inspired by the mailing list thread "NDData plot proposal"