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

Properly implement DynamicMap.split_overlays #2254

Closed
philippjfr opened this issue Jan 11, 2018 · 0 comments
Closed

Properly implement DynamicMap.split_overlays #2254

philippjfr opened this issue Jan 11, 2018 · 0 comments

Comments

@philippjfr
Copy link
Member

As I originally described in #2253, the DynamicMap.split_overlays method simply reuses the HoloMap implementation of the method which is not correct. This is because it will simply split up the Overlays in the cache into their constituent components and then make a clone of the DynamicMap. This means that if anything attempts to actually call that DynamicMap (which generally shouldn't happen but might) the validation on the DynamicMap will raise an error because the type returned by the callback (an Overlay) will not match the type in the cache (an Element).

The correct solution is probably just to implement a split_overlays method that fetches the appropriate layer from the original DynamicMap using something like:

def split_overlays(self):
    keys = self.last.keys()
    dmaps = []
    for i, key in enumerate(keys):
        dmaps.append(self.map(lambda overlay: overlay.get(i), Overlay))
    return keys, dmaps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant