(scene_json)
return scene
Deserialize a scene.
Deserialize a scene.
Deserialize a scene .
def deserialize(scene_json):
    """Deserialize a scene."""
    scene = json.loads(scene_json)
    for visual in scene.get('visuals', []):
        if is_str(visual.get('bounds', None)):
            visual['bounds'] = decode_data(visual['bounds'], np.int32)
        for variable in visual.get('variables', []):
            if is_str(variable.get('data', None)):
                vartype = variable.get('vartype', 'float')
                if vartype == 'int':
                    dtype = np.int32
                elif vartype == 'float':
                    dtype = np.float32
                variable['data'] = decode_data(variable['data'], dtype)
    return scene
def deserialize ( scene_json ) : scene = json . loads ( scene_json ) for visual in scene . get ( 'visuals' , [ ] ) : if is_str ( visual . get ( 'bounds' , None ) ) : visual [ 'bounds' ] = decode_data ( visual [ 'bounds' ] , np . int32 ) for variable in visual . get ( 'variables' , [ ] ) : if is_str ( variable . get ( 'data' , None ) ) : vartype = variable . get ( 'vartype' , 'float' ) if vartype == 'int' : dtype = np . int32 elif vartype == 'float' : dtype = np . float32 variable [ 'data' ] = decode_data ( variable [ 'data' ] , dtype ) return scene