-
Notifications
You must be signed in to change notification settings - Fork 146
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
Factory functions for creating layers #91
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pbugnion
force-pushed
the
enhancement/factory-functions
branch
from
October 9, 2016 17:38
12984d4
to
631629a
Compare
pbugnion
force-pushed
the
enhancement/factory-functions
branch
from
October 12, 2016 06:18
98efa2c
to
6349328
Compare
pbugnion
force-pushed
the
enhancement/factory-functions
branch
from
January 22, 2017 15:39
8c7e1c4
to
5e823de
Compare
Now that we don't have deprecated functions, we don't need to import warnings.
This commit: - fixes the tests following the refactor of heatmaps into their own module - adds a unit test for weighted heatmaps.
Currently requires extracting the numpy array with `.values`, which is probably not what we want.
zip() returns an iterator, rather than a list, in Python 3.
We now need to tell Travis about numpy and pandas.
Building pandas on Travis takes a long time. For now, we just skip the test.
The locations object can now be a pandas dataframe. This allows, eg. heatmap_layer(df[['lat', 'lng']])
This refactors the maps module to extract out directions.
This allows re-using the functionality for other layers.
We can create the test dataframe in a slightly simpler manner.
This adds a test for a fairly common use case: the user has the entire data in a pandas dataframe and passes specific columns to factory function.
This gives meta information about a particular dataset.
This is more important now that we can have richer datasets with more than just latitude and longitude columns.
Prior to this commit, the columsn in datasets were all expected to be floats. Now that the datasets can be richer than just columns of latitudes and longitudes, we need to support more complex heterogeneous types.
Fixes a badly configured dependendency.
pbugnion
force-pushed
the
enhancement/factory-functions
branch
from
January 28, 2017 08:01
d5941bc
to
fd9e732
Compare
pbugnion
changed the title
[WIP] Factory functions for creating layers
Factory functions for creating layers
Jan 28, 2017
This was referenced Jan 28, 2017
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Creating layers is currently brittle and error prone. Since we use traitlets, the argument type is fixed. This breaks duck typing and is generally surprising to Python developers. For instance, at the moment, the
data
argument for a heatmap only takes a list of tuples. It should really take any iterable. The solution is to create factory functions for the layers that let us massage the arguments before the create the widget model itself.This will address several issues:
Directions
widget: instead of passing the start and end point and waypoints as an array, we can just pass them as a arguments to the functions, with a signature likedirections_layer(start, end, waypoints=None, **kwargs)
.WeightedHeatmaps
are implemented. Instead of having two different ways of creating the heat maps, we can just have a singleheatmap_layer(locations, weights=None)
. This will create either aWeightedHeatmap
or aHeatmap
internally.The markers and symbols layer already use a factory method. This PR will just bring the rest of the layers in line.
This PR will fix #65, #66 and #68.
Remaining tasks: