Пример #1
0
 def enableStripView(self, event):
     self.bStrip = not self.bStrip
     if self.bStrip == False:
         self.view = View2ScreenTransform(self.extent, self.bufferWidth,
                                          self.bufferHeight)
     else:
         self.view = View2ScreenTransform(
             self.extent, self.bufferWidth,
             self.bufferHeight - self.bufferHeight / 3.0)
     self.reInitBuffer = True
Пример #2
0
    def drawSubGiMap(self, idx, bufferWidth, bufferHeight, bmp):
        """
        Draw two relative Gi* maps for current Gi* map
        """
        dc = wx.BufferedDC(None, bmp)
        dc.SetBrush(wx.WHITE_BRUSH)
        dc.SetPen(wx.TRANSPARENT_PEN)
        dc.DrawRectangle(0, 0, bufferWidth, bufferHeight)

        if not "Linux" in stars.APP_PLATFORM:
            # not good drawing effect using GCDC in linux
            dc = wx.GCDC(dc)

        view = View2ScreenTransform(self.extent, bufferWidth, bufferHeight)

        p_values = self.space_gstar[idx]
        z_values = self.space_gstar_z[idx]

        not_sig = list(np.where(p_values > 0.05)[0])
        sig = set(np.where(p_values <= 0.05)[0])
        hotspots = list(sig.intersection(set(np.where(z_values >= 0)[0])))
        coldspots = list(sig.intersection(set(np.where(z_values < 0)[0])))
        id_groups = [not_sig, hotspots, coldspots]

        from stars.visualization.maps.BaseMap import PolygonLayer
        draw_layer = PolygonLayer(self, self.layer, build_spatial_index=False)
        #edge_clr = wx.Colour(200,200,200, self.opaque)
        edge_clr = self.color_schema_dict[self.layer.name].edge_color
        draw_layer.set_edge_color(edge_clr)
        draw_layer.set_data_group(id_groups)
        draw_layer.set_fill_color_group(self.gi_color_group)
        draw_layer.draw(dc, view)

        return bmp
Пример #3
0
    def DoDraw(self, dc, isAppendDraw=False):
        """
        Drawing code: drawing all map layers on bitmap buffer
        """
        if len(self.layers) == 0:
            dc.Clear()
            return

        if os.name == 'nt':
            # in windows, it's weird to draw things with transparency
            # the workaround solution is draw a white background first
            # tried dc.SetBackground() and dc.SetBackgroundMode(wx.SOLID)
            # but doesn't work.
            dc.SetPen(wx.TRANSPARENT_PEN)
            dc.SetBrush(wx.WHITE_BRUSH)
            dc.DrawRectangle(0, 0, self.bufferWidth, self.bufferHeight)

        tmpBuffer = None

        # find the common extend by union all shapefile maps
        if self.view == None:
            self.view = View2ScreenTransform(self.extent, self.bufferWidth,
                                             self.bufferHeight)
            self.view.zoom_extent = self.extent

        # draw layer in buffer
        for layer_name in self.layer_name_list[::-1]:
            layer = self.layer_dict[layer_name]
            if self.hide_layers[layer] == False:
                self.draw_layers[layer].draw(dc, self.view)
Пример #4
0
    def __init__(self, parent, layers, **kwargs):
        ShapeMap.__init__(self,parent, layers)
        
        try:
            self.weight_file  = kwargs["weight"]
            self.cs_data_dict = kwargs["query_data"]
            self.bufferWidth, self.bufferHeight = kwargs["size"]
            self.step, self.step_by        = kwargs["step"] ,kwargs["step_by"]
            self.start_date, self.end_date = kwargs["start"],kwargs["end"]
            
            self.nav_left  = None
            self.nav_right = None
            self.bStrip    = True
            
            # preprocessing parameters 
            self.parent = parent
            self.layer  = layers[0]
            self.data_sel_keys   = sorted(self.cs_data_dict.keys())
            self.data_sel_values = [self.cs_data_dict[i] for i in self.data_sel_keys]
            self.weight          = pysal.open(self.weight_file).read()
            self.t = len(self.cs_data_dict) # number of data slices
            self.n = len(self.data_sel_values[0]) # number of shape objects
                        
            self.extent = self.layer.extent
            self.view   = View2ScreenTransform(
                self.extent, 
                self.bufferWidth, 
                self.bufferHeight - self.bufferHeight/3.0
                ) 
          
            self.tick = 0
            self.datetime_intervals, self.interval_labels = GetDateTimeIntervals(self.start_date, self.end_date,self.t, self.step, self.step_by)
            self.setupDynamicControls()
            self.parentFrame.SetTitle('Gi* Space Time Map-%s' % self.layer.name)
            self.dynamic_control = DynamicMapControl(self.parentFrame,self.t+1,self.updateDraw)
 
            self.trendgraphWidget = None
            self.popupTrendGraph = None
            
            # preprocessing Gi* SpaceTime maps
            self.processGiSpaceTimeMap()
            
        except Exception as err:
            detail_message = err.message
            if err.message == "dimension mismatch":
                detail_message = "The number of time intervals doesn't match time weights and space-time query."
            message = """Gi* Space Time map could not be created. Please re-select or create new time weights.
        
Details:""" + detail_message
            self.ShowMsgBox(message)
            
            self.UnRegister()
            if self.trendgraphWidget:
                self.trendgraphWidget.Close(True)
            if self.popupTrendGraph:
                self.popupTrendGraph.Close(True)
            self.parentFrame.Close(True)
            if os.name == 'nt':
                self.Destroy()
            return None
Пример #5
0
    def drawSubView(self, lisa_idx, bufferWidth, bufferHeight, bmp):
        dc = wx.BufferedDC(None, bmp)
        dc.SetBrush(wx.WHITE_BRUSH)
        dc.SetPen(wx.TRANSPARENT_PEN)
        dc.DrawRectangle(0, 0, bufferWidth, bufferHeight)

        if not "Linux" in stars.APP_PLATFORM:
            # not good drawing effect using GCDC in linux
            dc = wx.GCDC(dc)

        view = View2ScreenTransform(self.extent, bufferWidth, bufferHeight)

        ml = self.moran_locals[lisa_idx]
        # 0 not significant, 1 HH, 2 LL, 3 LH, 4 HL, 5 Neighborless
        sigFlag = ml[2]
        clusterFlag = ml[3]
        lm_sig = np.array(sigFlag)
        lm_q = np.array(clusterFlag)

        id_groups = [[] for i in range(6)]
        for i, sig in enumerate(lm_sig):
            if sig > 0:
                id_groups[lm_q[i]].append(i)
            else:
                id_groups[0].append(i)

        from stars.visualization.maps.BaseMap import PolygonLayer
        draw_layer = PolygonLayer(self, self.layer, build_spatial_index=False)
        #edge_clr = wx.WHITE#wx.Colour(200,200,200, self.opaque)
        edge_clr = self.color_schema_dict[self.layer.name].edge_color
        draw_layer.set_edge_color(edge_clr)
        draw_layer.set_data_group(id_groups)
        draw_layer.set_fill_color_group(self.lisa_color_group)
        draw_layer.draw(dc, view)
Пример #6
0
    def draw3DMap(self, bmp, idx, bufferWidth, bufferHeight):
        dc = wx.BufferedDC(None, bmp)
        dc.SetBrush(wx.WHITE_BRUSH)
        dc.SetPen(wx.TRANSPARENT_PEN)
        dc.DrawRectangle(0, 0, bufferWidth, bufferHeight)

        if not "Linux" in stars.APP_PLATFORM:
            # not good drawing effect using GCDC in linux
            dc = wx.GCDC(dc)

        view = View2ScreenTransform(self.extent, bufferWidth, bufferHeight)
        view.zoom_extent = self.map_query_region
        subBmpHeight = self.bufferHeight / self.t
        ratio = bufferHeight / float(subBmpHeight)
        from stars.visualization.maps.BaseMap import PolygonLayer
        draw_layer = PolygonLayer(self, self.layer, build_spatial_index=False)

        p_values = self.space_gstar[idx]
        z_values = self.space_gstar_z[idx]

        not_sig = list(np.where(p_values > 0.05)[0])
        sig = set(np.where(p_values <= 0.05)[0])
        hotspots = list(sig.intersection(set(np.where(z_values >= 0)[0])))
        coldspots = list(sig.intersection(set(np.where(z_values < 0)[0])))
        id_groups = [not_sig, hotspots, coldspots]

        self.id_groups = id_groups
        draw_layer.set_data_group(id_groups)
        draw_layer.set_fill_color_group(self.gi_color_group)
        draw_layer.set_edge_color(stars.DEFAULT_MAP_EDGE_COLOR)

        edge_clr = wx.Colour(200, 200, 200, self.opaque)
        draw_layer.set_edge_color(edge_clr)
        draw_layer.draw(dc, view, draw3D=ratio)
Пример #7
0
 def extentToLayer(self, layer):
     # support TreeList ctrl
     self.extent = layer.extent
     self.view = View2ScreenTransform(self.extent, self.bufferWidth,
                                      self.bufferHeight)
     self.view.zoom_extent = self.extent
     self.reInitBuffer = True
     self.resetTitle()
Пример #8
0
    def drawSubLISA(self, lisa_idx, bufferWidth, bufferHeight, bmp):
        """
        Draw two relative LISA maps for current Markov LISA map
        """
        dc = wx.BufferedDC(None, bmp)
        dc.SetBrush(wx.WHITE_BRUSH)
        dc.SetPen(wx.TRANSPARENT_PEN)
        dc.DrawRectangle(0, 0, bufferWidth, bufferHeight)

        if not "Linux" in stars.APP_PLATFORM:
            # not good drawing effect using GCDC in linux
            dc = wx.GCDC(dc)

        view = View2ScreenTransform(self.extent, bufferWidth, bufferHeight)

        lm = self.moran_locals[lisa_idx]
        # 0 not significant, 1 HH, 2 LL, 3 LH, 4 HL, 5 Neighborless
        try:
            # LISA from c++ DLL call
            localMoran, sigLocalMoran, sigFlag, clusterFlag = lm
            lm_moran = np.array(localMoran)
            lm_p_sim = np.array(sigLocalMoran)
            lm_sig = np.array(sigFlag)
            lm_q = np.array(clusterFlag)
            candidates = np.where(lm_sig < 1)[0]
            id_groups = []
            id_groups.append(list(candidates))
            for i in range(1, n):
                cluster = set(np.where(lm_q == i)[0]) - set(candidates)
                id_groups.append(cluster)
        except:
            # LISA from Pysal call
            sigFlag = lm[2]
            clusterFlag = lm[3]
            lm_sig = np.array(sigFlag)
            lm_q = np.array(clusterFlag)
            id_groups = [[] for i in range(6)]
            for i, sig in enumerate(lm_sig):
                if sig > 0:
                    id_groups[lm_q[i]].append(i)
                else:
                    id_groups[0].append(i)

        from stars.visualization.maps.BaseMap import PolygonLayer
        draw_layer = PolygonLayer(self, self.layer, build_spatial_index=False)
        #edge_clr = wx.Colour(200,200,200, self.opaque)
        edge_clr = self.color_schema_dict[self.layer.name].edge_color
        draw_layer.set_edge_color(edge_clr)
        draw_layer.set_data_group(id_groups)
        lisa_color_group = [
            self.NOT_SIG_color, self.HH_color, self.LL_color, self.LH_color,
            self.HL_color, self.OBSOLETE_color
        ]
        draw_layer.set_fill_color_group(lisa_color_group)
        draw_layer.draw(dc, view)

        return bmp
Пример #9
0
 def draw_space_in_buffer(self, space_shp, width=6000,height=6000):
     """
     Function for fast space-time query: how many points
     sit in each polygon
     """
     from stars.visualization.maps.BaseMap import PolygonLayer
     from stars.visualization.utils import View2ScreenTransform,DrawPurePoints
     # specify different color for each polygon
     poly_color_dict = {}
     n = len(space_shp)
     
     if n > 10000:
         width = 9000
         height = 9000
     
     id_group = []
     color_group = []
     color_range = 254*254*254 - 1
     used_color = {}
     for i in range(n):
         color_idx = random.randint(1,color_range)
         while color_idx in used_color: 
             color_idx = random.randint(1,color_range)
         used_color[color_idx] = True
         r = color_idx & 255
         g = (color_idx>>8) & 255
         b = (color_idx>>16) & 255
         id_group.append([i])
         color_group.append(wx.Color(r,g,b))
         poly_color_dict[(r,g,b)] = i
         
     # draw polygon to an empty_buffer
     polygon_layer = PolygonLayer(self, space_shp)
     polygon_layer.set_edge_color(wx.Color(0,0,0,0))
     polygon_layer.set_data_group(id_group)
     polygon_layer.set_fill_color_group(color_group)
     #polygon_layer.set_edge_color_group(color_group)
     
     view = View2ScreenTransform(space_shp.extent, width, height)
     buffer = wx.EmptyBitmap(width, height)
     dc = wx.BufferedDC(None, buffer)
     dc.Clear()
     polygon_layer.draw(dc, view, drawRaw=True)
     
     """
     _points = []
     for p in points: 
         x,y = view.view_to_pixel(p[0],p[1])
         x,y = int(round(x)), int(round(y))
         _points.append((x,y))
     DrawPurePoints(dc, _points)
     """
     bmp = wx.ImageFromBitmap(buffer)
     #buffer.SaveFile('test.bmp',wx.BITMAP_TYPE_BMP)
     return bmp,view,poly_color_dict
Пример #10
0
    def __init__(self, parent, layers, **kwargs):
        ShapeMap.__init__(self, parent, layers)

        try:
            self.weight_file = kwargs["weight"]
            self.cs_data_dict = kwargs["query_data"]
            self.bufferWidth, self.bufferHeight = kwargs["size"]
            self.step, self.step_by = kwargs["step"], kwargs["step_by"]
            self.start_date, self.end_date = kwargs["start"], kwargs["end"]

            self.nav_left = None
            self.nav_right = None
            self.bStrip = True

            # preprocessing parameters
            self.parent = parent
            self.layer = layers[0]
            self.data_sel_keys = sorted(self.cs_data_dict.keys())
            self.data_sel_values = [
                self.cs_data_dict[i] for i in self.data_sel_keys
            ]
            self.weight = pysal.open(self.weight_file).read()
            self.t = len(self.cs_data_dict)  # number of data slices
            self.n = len(self.data_sel_values[0])  # number of shape objects

            self.extent = self.layer.extent
            self.view = View2ScreenTransform(
                self.extent, self.bufferWidth,
                self.bufferHeight - self.bufferHeight / 3.0)

            self.datetime_intervals, self.interval_labels = GetDateTimeIntervals(
                self.start_date, self.end_date, self.t, self.step,
                self.step_by)
            self.setupDynamicControls()
            self.parentFrame.SetTitle('LISA Space Time Map-%s' %
                                      self.layer.name)
            self.dynamic_control = DynamicMapControl(self.parentFrame,
                                                     self.t + 1,
                                                     self.updateDraw)

            self.trendgraphWidget = None
            self.popupTrendGraph = None

            # preprocessing LISA SpaceTime maps
            self.processLISASpaceTimeMap()

        except Exception as err:
            self.ShowMsgBox(
                """LISA Space Time map could not be created. Please check or create new spatial and/or time weights files."""
            )
            self.UnRegister()
            self.parentFrame.Close(True)
            if os.name == 'nt':
                self.Destroy()
            return None
Пример #11
0
    def __init__(self, parent, layers, **kwargs):
        ShapeMap.__init__(self, parent, layers)

        try:
            self.weight_file = kwargs["weight"]
            self.cs_data_dict = kwargs["query_data"]
            self.bufferWidth, self.bufferHeight = kwargs["size"]
            self.step, self.step_by = kwargs["step"], kwargs["step_by"]
            self.start_date, self.end_date = kwargs["start"], kwargs["end"]

            self.nav_left = None
            self.nav_right = None
            self.bStrip = True

            # preprocessing parameters
            self.parent = parent
            self.layer = layers[0]
            self.data_sel_keys = sorted(self.cs_data_dict.keys())
            self.data_sel_values = [
                self.cs_data_dict[i] for i in self.data_sel_keys
            ]
            self.weight = pysal.open(self.weight_file).read()
            self.t = len(self.cs_data_dict)  # number of data slices
            self.n = len(self.data_sel_values[0])  # number of shape objects

            self.extent = self.layer.extent
            self.view = View2ScreenTransform(
                self.extent, self.bufferWidth,
                self.bufferHeight - self.bufferHeight / 3.0)

            self.datetime_intervals, self.interval_labels = GetDateTimeIntervals(
                self.start_date, self.end_date, self.t, self.step,
                self.step_by)
            self.setupDynamicControls()
            self.parentFrame.SetTitle('LISA Markov-%s' % self.layer.name)
            self.dynamic_control = DynamicMapControl(self.parentFrame, self.t,
                                                     self.updateDraw)

            # preprocessing Markov LISA maps
            self.processLISAMarkovMaps()

        except Exception as err:
            self.ShowMsgBox("""LISA Markov map could not be created. 
            
Details: """ + str(err.message))
            self.UnRegister()
            self.parentFrame.Close(True)
            return None
Пример #12
0
    def __init__(self, parent, layers, **kwargs):
        ShapeMap.__init__(self, parent, layers)

        try:
            self.point_layer = self.layers[0]
            #self.bg_layer     = kwargs["background"]
            self.cell_size = kwargs["cell_size"]
            self.bandwidth = kwargs["bandwidth"]
            self.kernel = kwargs["kernel"]
            self.color_band = kwargs["color_band"]
            self.opaque = kwargs["opaque"]
            self.bufferWidth, self.bufferHeight = kwargs["size"]
            self.points = self.point_layer.shape_objects
            self.extent = self.point_layer.extent
            self.view = View2ScreenTransform(self.extent, self.bufferWidth,
                                             self.bufferHeight)

            if kwargs.has_key("query_points"):
                self.query_points = kwargs["query_points"]
            else:
                self.query_points = range(len(self.points))
            """
            if self.bg_layer: 
                self.layers.append(self.bg_layer)
            """

            if len(self.query_points) < len(self.points):
                id_group = [self.query_points]
                color_group = [
                    self.color_schema_dict[self.point_layer.name].colors[0]
                ]
                edge_color_group = [
                    self.color_schema_dict[self.point_layer.name].edge_color
                ]
                """
                non_query_points = list(set(range(len(self.points))) - set(self.query_points))
                id_group.append(non_query_points)
                color_group.append(wx.Colour(255,255,255,0))
                edge_color_group.append(wx.Colour(255,255,255,0))
                """
                self.draw_layers[self.point_layer].set_data_group(id_group)
                self.draw_layers[self.point_layer].set_fill_color_group(
                    color_group)
                self.draw_layers[self.point_layer].set_edge_color_group(
                    edge_color_group)

            # setup gradient color
            self.gradient_color = GradientColor(self.color_band)
            # for tree node
            self.color_schema_dict["Density Map"] = GradientColorSchema(
                self.color_band)
            self.isHideDensityMap = False
            # for export gif
            self.img_array_rgb = None

            self.isResizing = False
            self.cells_Updated = False
            self.bmp = None

            self.setup_densityMap()
            self.createDensityMap()

            # dummy Layer for density map
            self.layer_seq_list = []
            self.layer_seq_list.insert(0, "Density Map")
            self.layer_name_list.insert(0, "Density Map")

        except Exception as err:
            self.ShowMsgBox(
                """Density map could not be created. Please choose/input valid parameters.
            
Details: """ + str(err.message))
            self.UnRegister()
            self.parentFrame.Close(True)
            return None
Пример #13
0
    def __init__(self, parent, layers, **kwargs):
        ShapeMap.__init__(self, parent, layers)
        try:
            # setup point layer color to white
            self.bufferWidth, self.bufferHeight = kwargs["size"]
            self.date_field = kwargs["date_field"]

            self.parent = parent
            layer = layers[0]
            self.layer = layer
            self.layers = layers

            self.extent = self.layer.extent
            self.view = View2ScreenTransform(self.extent,
                                             self.bufferWidth - 500,
                                             self.bufferHeight - 150,
                                             offset_x=500,
                                             offset_y=150)

            self.isDynamic = False
            self.all_date = self.layer.dbf.by_col(self.date_field,
                                                  ctype='datetime')
            self.start_date = min(self.all_date)
            self.end_date = max(self.all_date)
            self.gradient_color = ColorBrewer()
            #self.gradient_color.set_colorschema(self.gradient_color.RdYlGn6, reverse=True)
            self.gradient_color.set_colorschema(self.gradient_color.BuGn9,
                                                reverse=False)

            if not isinstance(self.start_date, datetime.date):
                raise Exception(
                    "Please select a DateTime field to create Calendar Map!")

            # variables
            self.weekday_list = [
                'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'
            ]
            self.mt_text_list = [
                'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
                'Oct', 'Nov', 'Dec'
            ]
            self.mt_text_list_full = [
                'January', 'Febuary', 'March', 'April', 'May', 'June', 'July',
                'August', 'September', 'October', 'November', 'December'
            ]
            self.start_year = self.start_date.year
            self.start_month = self.start_date.month
            self.end_year = self.end_date.year
            self.end_month = self.end_date.month

            self.selected_day = 0
            self.selected_year = 0
            self.selected_month = self.start_month - 1
            self.num_years = self.end_year - self.start_year + 1
            self.current_date = self.start_date

            self.year_histogram = [False for i in range(self.num_years)]
            self.month_histogram = [False for i in range(12)]

            self.data_min, self.data_max = self.parseData()
            self.selected_obj_ids = []

        except Exception as err:
            self.ShowMsgBox(
                """Calendar map could not be created. Please choose a valid datetime variable.

Details: """ + str(err.message))
            self.UnRegister()
            self.parentFrame.Close(True)
            return None
Пример #14
0
    def __init__(self, parent, layers, **kwargs):
        ShapeMap.__init__(self, parent, layers)

        try:
            self.parent = parent
            self.layer = layers[0]

            self.cs_data_dict = kwargs["data"]
            self.weight_file = kwargs["weight"]
            start_date, end_date = kwargs["start"], kwargs["end"]
            self.step, self.step_by = kwargs["step"], kwargs["step_by"]
            self.start_date, self.end_date = start_date, end_date

            self.t = len(self.cs_data_dict)
            self.data_sel_keys = sorted(self.cs_data_dict.keys())
            self.data_sel_values = [
                self.cs_data_dict[i] for i in self.data_sel_keys
            ]
            self.weight = pysal.open(self.weight_file).read()

            self.bufferWidth, self.bufferHeight = kwargs["size"]
            self.extent = self.layer.extent
            self.view = View2ScreenTransform(
                self.extent, self.bufferWidth,
                self.bufferHeight - self.bufferHeight / 3.0)

            # strip map
            self.tick = 0
            self.bStrip = True
            self.nav_left = None
            self.nav_right = None

            self.bAnimate = False

            # setup dynamic control buttons
            self.SetTitle('Dynamic LISA - %s %s' %
                          (self.layer.name, kwargs["title"]))
            self.datetime_intervals, self.interval_labels = GetDateTimeIntervals(
                self.start_date, self.end_date, self.t, self.step,
                self.step_by)
            self.setupDynamicControls()

            # preprocess multi LISA maps
            self.processLISAMaps()

            # inital drawing lisa map
            self.updateDraw(0)

            # Thread-based controller for dynamic LISA
            self.dynamic_control = DynamicMapControl(self.parentFrame, self.t,
                                                     self.updateDraw)

        except Exception as err:
            self.ShowMsgBox(
                """Dynamic LISA map could not be created. Please choose or create a valid spatial weights file.
            
Details: """ + str(err.message))
            self.UnRegister()
            self.parentFrame.Close(True)
            if os.name == 'nt':
                self.Destroy()
            return None
Пример #15
0
    def __init__(self, parent, layers, **kwargs):
        ShapeMap.__init__(self, parent, layers)

        try:
            self.parent = parent
            self.layer = layers[0]

            self.cs_data_dict = kwargs["data"]
            self.weight_file = kwargs["weight"]
            start_date, end_date = kwargs["start"], kwargs["end"]
            self.step, self.step_by = kwargs["step"], kwargs["step_by"]
            self.start_date, self.end_date = start_date, end_date

            self.n = len(self.layer)
            self.t = len(self.cs_data_dict)
            self.data_sel_keys = sorted(self.cs_data_dict.keys())
            self.data_sel_values = [
                self.cs_data_dict[i] for i in self.data_sel_keys
            ]
            self.weight = pysal.open(self.weight_file).read()

            time_gstar = dict()
            time_gstar_z = dict()
            space_gstar = dict()
            space_gstar_z = dict()
            tneighbors = self.create_time_w(self.t)
            tweights = pysal.W(tneighbors)
            for tid, obs in self.cs_data_dict.iteritems():
                y = np.array(obs)
                lg = pysal.esda.getisord.G_Local(y, self.weight, star=True)
                space_gstar[tid] = lg.p_sim
                space_gstar_z[tid] = lg.Zs

            tseries_data = []
            for pid in range(self.n):
                tseries = []
                for tid in range(self.t):
                    tseries.append(self.cs_data_dict[tid][pid])
                tseries_data.append(tseries)

            for pid in range(self.n):
                tseries = tseries_data[pid]
                y = np.array(tseries)
                lg = pysal.esda.getisord.G_Local(y, tweights, star=True)
                time_gstar[pid] = lg.p_sim
                time_gstar_z[pid] = lg.Zs

            self.tweights = tweights
            self.time_gstar = time_gstar
            self.time_gstar_z = time_gstar_z
            self.space_gstar = space_gstar
            self.space_gstar_z = space_gstar_z

            # default color schema for LISA
            self.HH_color = stars.LISA_HH_COLOR
            self.LL_color = stars.LISA_LL_COLOR
            self.NOT_SIG_color = stars.LISA_NOT_SIG_COLOR
            #self.OBSOLETE_color = stars.LISA_OBSOLETE_COLOR
            color_group = [self.NOT_SIG_color, self.HH_color, self.LL_color]
            label_group = ["Not Significant", "High-High", "Low-Low"]
            self.color_schema_dict[self.layer.name] = ColorSchema(
                color_group, label_group)
            self.gi_color_group = color_group

            self.bufferWidth, self.bufferHeight = kwargs["size"]
            self.extent = self.layer.extent
            self.view = View2ScreenTransform(self.extent,
                                             self.bufferWidth * 0.5,
                                             self.bufferHeight,
                                             offset_x=self.bufferWidth * 0.5)

            # setup dynamic control buttons
            self.SetTitle('SpaceTime Cluster Map- %s' % self.layer.name)
            self.datetime_intervals, self.interval_labels = GetDateTimeIntervals(
                self.start_date, self.end_date, self.t, self.step,
                self.step_by)
            self.setupDynamicControls()

            # preprocess multi LISA maps

            # inital drawing lisa map

            # Thread-based controller for dynamic LISA
            self.dynamic_control = DynamicMapControl(self.parentFrame, self.t,
                                                     self.updateDraw)
        except:
            self.ShowMsgBox(
                "Please respecify valid parameters for Dynamic LISA Map.")
            #self.parentFrame.Close(True)
            wx.FutureCall(10, self.parentFrame.Close, True)