def from_json(cls, id_, info):
"""Convert JSON surface info into ``SurfaceInfo``.
This involves parsing the dictionary and converting some stringified
values (rationals and IEEE-754) to Python ``float``-s.
Args:
id_ (str): The ID of the surface.
info (dict): The JSON data of the surface.
Returns:
SurfaceInfo: The surface info parsed from the JSON.
"""
control_points = info.pop('control_points')
control_points = np.asfortranarray(_convert_float(control_points))
# Optional fields.
note = info.pop('note', None)
_ensure_empty(info)
return cls(id_, control_points, note=note)
# pylint: disable=too-few-public-methods
评论列表
文章目录