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.

@philippjfr philippjfr force-pushed the standardize_constructors branch from 62b2ff3 to cb67246 Compare October 1, 2017 11:53
@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 philippjfr force-pushed the standardize_constructors branch from cb67246 to 17d8b6e Compare October 5, 2017 14:15
@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.

@philippjfr philippjfr force-pushed the standardize_constructors branch from dcf8101 to 6b68d75 Compare October 5, 2017 16:09
@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 philippjfr force-pushed the standardize_constructors branch from 75a0bac to b973187 Compare October 8, 2017 16:23
@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.

@jlstevens jlstevens merged commit 1e0cd19 into master Oct 8, 2017
@philippjfr philippjfr deleted the standardize_constructors branch October 9, 2017 02:25
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants