-
Notifications
You must be signed in to change notification settings - Fork 255
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
migrated to msgpack as serializer for network traffic to allow connec…
…tions from non-python applications
- Loading branch information
Showing
15 changed files
with
341 additions
and
240 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
from bluesky import settings | ||
from bluesky.io.node import Node | ||
from bluesky.io.iodata import IOData | ||
if not settings.is_sim: | ||
from bluesky.io.iomanager import IOManager | ||
from bluesky.io.client import Client |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import numpy as np | ||
|
||
def encode_ndarray(o): | ||
'''Msgpack encoder for numpy arrays.''' | ||
if isinstance(o, np.ndarray): | ||
return {b'numpy': True, | ||
b'type': o.dtype.str, | ||
b'shape': o.shape, | ||
b'data': o.tobytes()} | ||
return o | ||
|
||
def decode_ndarray(o): | ||
'''Msgpack decoder for numpy arrays.''' | ||
if o.get(b'numpy'): | ||
return np.fromstring(o[b'data'], dtype=np.dtype(o[b'type'])).reshape(o[b'shape']) | ||
return o |
Oops, something went wrong.