# Path: rlvision/utils.py
# def load_grid_selection(path):
# def process_map_data(path, return_full=False):
# def mask_grid(pos, grid, radius, one_is_free=True):
# def accumulate_map(source_grid, new_grid, one_is_free=True):
# def plot_grid(data, imsize, start=None, pos=None, goal=None, title=None):
# def process_gridworld_data(data_in, imsize):
# def load_mat_data(file_path):
# def find_layout(data, verbose=0):
# def init_h5_db(db_name, save_dir):
# def add_h5_group(group_name, db, db_path=None):
# def add_h5_ds(data, ds_name, db, group_name=None, data_type=np.uint8,
#               renew=False):
# def create_grid_8_dataset(mat_file_path, db_name, save_dir):
# def create_ds_from_splits(mat_file_prefix, db, splits):
# def create_grid_16_dataset(mat_file_prefix, db_name, save_dir, splits=5):
# def create_grid_28_dataset(mat_file_prefix, db_name, save_dir, splits=20):
# def create_grid_40_dataset(mat_file_prefix, db_name, save_dir, splits=100):
# def load_grid8(return_imsize=True):
# def load_grid16(split=None, return_imsize=True):
# def load_grid28(split=None, return_imsize=True):
# def load_grid40(split=None, return_imsize=True):


import os
import h5py
import cPickle as pickle
import numpy as np
import rlvision
from rlvision import utils
                self.dstar_curr_map = self.get_curr_dstar_visible_map(
                    self.start_pos)
            self.pos_history = [start_pos]
            # update state map
            self.state_map[0, 0] = self.get_state_map()
            #  self.state_map[0, 1] = self.curr_map
        else:
            print ("[MESSAGE] WARNING: The position is not valid, nothing"
                   " changes. (by set_start_pos)")

    def set_goal_pos(self):
        """Set goal position based on the value map."""
        goal_list = np.where(self.value_map == self.value_map.max())
        # assume the first one
        self.goal_pos = (goal_list[0][0], goal_list[1][0])

    def set_curr_pos(self, curr_pos):
        if self.is_pos_valid(curr_pos):
            self.curr_pos = curr_pos
        else:
            print ("[MESSAGE] WARNING: The position is not a vaild point"
                   " (by set_curr_pos)")

    def update_curr_map(self, map_update, dstar_map_update=None):
        """Update current map.
        Parameters
        ----------
        map_update : numpy.ndarray
            the update to the current map
        """

# Path: rlvision/utils.py
# def load_grid_selection(path):
# def process_map_data(path, return_full=False):
# def mask_grid(pos, grid, radius, one_is_free=True):
# def accumulate_map(source_grid, new_grid, one_is_free=True):
# def plot_grid(data, imsize, start=None, pos=None, goal=None, title=None):
# def process_gridworld_data(data_in, imsize):
# def load_mat_data(file_path):
# def find_layout(data, verbose=0):
# def init_h5_db(db_name, save_dir):
# def add_h5_group(group_name, db, db_path=None):
# def add_h5_ds(data, ds_name, db, group_name=None, data_type=np.uint8,
#               renew=False):
# def create_grid_8_dataset(mat_file_path, db_name, save_dir):
# def create_ds_from_splits(mat_file_prefix, db, splits):
# def create_grid_16_dataset(mat_file_prefix, db_name, save_dir, splits=5):
# def create_grid_28_dataset(mat_file_prefix, db_name, save_dir, splits=20):
# def create_grid_40_dataset(mat_file_prefix, db_name, save_dir, splits=100):
# def load_grid8(return_imsize=True):
# def load_grid16(split=None, return_imsize=True):
# def load_grid28(split=None, return_imsize=True):
# def load_grid40(split=None, return_imsize=True):


# Path: rlvision/grid.py
import os
import h5py
import cPickle as pickle
import numpy as np
import rlvision
from rlvision import utils

                self.dstar_curr_map = self.get_curr_dstar_visible_map(
                    self.start_pos)
            self.pos_history = [start_pos]
            # update state map
            self.state_map[0, 0] = self.get_state_map()
            #  self.state_map[0, 1] = self.curr_map
        else:
            print ("[MESSAGE] WARNING: The position is not valid, nothing"
                   " changes. (by set_start_pos)")

    def set_goal_pos(self):
        """Set goal position based on the value map."""
        goal_list = np.where(self.value_map == self.value_map.max())
        # assume the first one
        self.goal_pos = (goal_list[0][0], goal_list[1][0])

    def set_curr_pos(self, curr_pos):
        if self.is_pos_valid(curr_pos):
            self.curr_pos = curr_pos
        else:
            print ("[MESSAGE] WARNING: The position is not a vaild point"
                   " (by set_curr_pos)")

    def update_curr_map(self, map_update, dstar_map_update=None):
        """Update current map.
        Parameters
        ----------
        map_update : numpy.ndarray
            the update to the current map
        """

        self.curr_map = utils.accumulate_map(self.curr_map, map_update,