Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standardized constructor signature with dimensions as positional args #1946

Merged
merged 8 commits into from
Oct 8, 2017

Conversation

philippjfr
Copy link
Member

As suggested in #1938 this PR standardizes the constructors of Dimensioned objects such that kdims and vdims are the second and third argument respectively for Elements and kdims are the second argument for dimensioned containers (NdMapping, HoloMap, NdOverlay etc.). Currently Histogram and Annotations are the exceptions to this.

@jlstevens
Copy link
Contributor

Are there backwards compatibility implications? Otherwise I support the idea.

@philippjfr
Copy link
Member Author

Not as far as I know but I have yet to go through all the errors.


@property
def deep_dimensions(self): return self.ddims

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose we haven't used them in a long time so they should be ok to remove now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You would think that, turns out Columnar_Data still had a reference:

  3 error_hmap = hv.HoloMap({(i, j): hv.Image(j*np.random.randn(3, 3), bounds=extents)
  4                          for i, j in product(range(3), np.linspace(0, 1, 3))},
  5                         key_dimensions=['Observation', 'noise'])

@philippjfr
Copy link
Member Author

Also addresses #1619

@philippjfr
Copy link
Member Author

Okay, I've now gone through everything. There were two causes for errors:

  1. In some very old tests we passed Image bounds as the second positional argument. Since bounds is now optional and is only used when passing a numpy array to Image I think moving away from that is sensible.
  2. In some cases some internal code was passing NdMapping kdims as tuples, which used to be allowed but is now interpreted as a single dimension specification.

I think better exception messages will be sufficient to address both cases.

@jbednar
Copy link
Member

jbednar commented Oct 5, 2017

Sounds reasonable, but be sure to link to this PR in the changelog section on backwards compatibility.

@jlstevens
Copy link
Contributor

All sounds good to me!

I definitely wouldn't want bounds to be passed by position to Image anymore.

@philippjfr philippjfr force-pushed the standardize_constructors branch 2 times, most recently from a5b0dfd to 75a0bac Compare October 5, 2017 16:54
@philippjfr
Copy link
Member Author

Tests now passing, I suppose I'll add some tests to ensure Elements follow this signature.

@philippjfr
Copy link
Member Author

Ready to merge once test pass.

if edges is not None:
self.warning("Histogram edges should be supplied as a tuple "
"along with the values, passing the edges will "
"be deprecated in holoviews 2.0.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something to mention in the next changelog/release notes. It will be good to get histogram working consistently with everything else.

@jlstevens
Copy link
Contributor

Looks good to me. I made one comment about histogram but nothing that needs action. Merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants