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

Binary serialization #684

Merged
merged 5 commits into from
Nov 7, 2018
Merged

Conversation

maartenbreddels
Copy link
Member

@maartenbreddels maartenbreddels commented Jul 19, 2018

Continues from #680 (if that is merged I'll rebase)

This adds binary serialization to many of the Marks (scatter and line seems to work).

  • basic binary serialization
  • support for dates (this is using ms resolution, and float64 to transfer)
  • see if we can reuse the front-end code and feed this back to https://github.com/vidartf/ipydatawidgets/tree/master/packages/serializers/src (cc @VidarF )
  • check all marks (histogram doesn't seem to work)
  • use serializers instead of on the fly deserialization
  • find a way for datetime's to survive the roundtrip
  • Lines
  • Label (and check other text arrays)
  • Bars
  • Bins
  • Boxplot
  • Candles
  • GridHeatMap
  • HeatMap
  • Hist
  • MarketMap
  • Pie
  • Selectors
  • Remove BaseModel and get_typed_field/set_typed_field
  • Since date is now a number, tick_format in Axis fails.

Since some of the code is coming from ipyvolume, I left in support for 'keyframes', i.e. the data arrays can be or one dimension higher, allowing for full frontend based animation. Do we want to go that route?

Also, do we want to use ndarray? For 1d arrays I'm fine with TypedArrays for now.

@rmenegaux
Copy link
Contributor

@maartenbreddels I tested all the marks, the list is below.

One problem is that arrays of text (e.g. for Label and MarketMap) are not handled by the binary serializer, they should be changed to the 'classic' one. I haven't looked into the JS errors for the other Marks though...

Work

  • FlexLine
  • Graph
  • Scatter
  • Image
  • Map
  • Lines (most cases)

Don't work (serializing error because data is not float/int/date)

  • Lines (several lines w/ different number of points)
     Lines(x=[[0, 1], [0, 1, 2]], y=[[0, 1], [1, 0, -1],)
    because np.asarray([[0, 1], [0, 1, 2]]).dtype = ‘O’
  • Label (problem with the label text)
  • Market Map

Don't work (JS error)

  • Bars
  • Bins
  • Boxplot
  • Candles
  • GridHeatMap
  • HeatMap
  • Hist
  • Market Map

@maartenbreddels
Copy link
Member Author

Ok, I've looked into it, and in many places there is the expectation that the data can be 2d, but of irregular shape. That means that you can't really convert it to a numpy array (ok, of type object).
I propose two solutions:

  • only opt in for binary serialization for Scatter, Image, and the rest that work.
  • Have a new trait type, ListArray that will allow an array, or list of arrays, which is I think an ok solution, but some more work.

So it depends if we wanna solve this completely now, or have some results now quickly, and iterate later on. Thoughts @SylvainCorlay ?

@maartenbreddels
Copy link
Member Author

Discussed this with Sylvain, the support for irregular arrays was an accident, and there are two options:

  • not support it
  • fill with nans

I'll go for the first option first, and then when everything seems to work, I'll work on the 2nd item.

@SylvainCorlay
Copy link
Member

  • not support it
  • fill with nans

In any case, the "fill with nan" thingy would be a backend change only.

@maartenbreddels
Copy link
Member Author

It's 90% done I think. I check many of the notebooks, and there are only a few issues (non-breaking). I think we can totally can get rid of BaseModel as well.

@maartenbreddels maartenbreddels force-pushed the binary_serialize branch 2 times, most recently from 365aa50 to 3bc319a Compare September 10, 2018 15:36
@maartenbreddels maartenbreddels changed the title WIP: Binary serialization Binary serialization Sep 24, 2018
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

Successfully merging this pull request may close these issues.

None yet

3 participants