def __init__(self,parent,mapsystem,title):
		_SubPanel.__init__(self,parent,mapsystem,title)
		
		#### Loading XRC file and Setting the panel
		xmlresource=wx.xrc.XmlResource("OnSight/data/xrc/recurrencetimepanel.xrc")
		self.panel=xmlresource.LoadPanel(self,"recurrencetimepanel")
		
		sizer=wx.BoxSizer()
		sizer.Add(self.panel,proportion=1,flag= wx.ALL | wx.EXPAND)
		self.SetSizer(sizer)
		
		#### Creating TextCtrls and StaticTexts 
		axislabel=Utils.getAxisLabel(self.mapsystem)
		
		proportion_st=0
		proportion_tc=1
		style_tc=wx.TE_RIGHT
		flag_st=flag_tc=wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL
		
		input=[[axislabel[d]+': ', 'min ', 0.0, 'max ', 1.0] for d in range(self.mapsystem.dim)]
		
		sizer1=wx.xrc.XRCCTRL(self.panel,'StaticLine1').GetContainingSizer()
		self.TCListRect=Utils._putTextCtrlFlexGrid(self.panel,sizer1.GetChildren()[2].GetSizer(),input,
			proportion_st=proportion_st,flag_st=flag_st,style_tc=style_tc,proportion_tc=proportion_tc,flag_tc=flag_tc)
		
		input=[[axislabel[d]+': ', 'center ', 0.0] for d in range(self.mapsystem.dim)]
		input.append(['','edge ',1.0])
		
		self.TCListBox=Utils._putTextCtrlFlexGrid(self.panel,sizer1.GetChildren()[3].GetSizer(),input,
			proportion_st=proportion_st,flag_st=flag_st,style_tc=style_tc,proportion_tc=proportion_tc,flag_tc=flag_tc)
		
		input=[[axislabel[d]+': ', 'center ', 0.0] for d in range(self.mapsystem.dim)]
		input.append(['','radius ',1.0])
		
		self.TCListCircle=Utils._putTextCtrlFlexGrid(self.panel,sizer1.GetChildren()[4].GetSizer(),input,
			proportion_st=proportion_st,flag_st=flag_st,style_tc=style_tc,proportion_tc=proportion_tc,flag_tc=flag_tc)
		
		for i in range(3): sizer1.Show(i+2,i==0)
		
		#### Event Handling
		def OnSpinCtrlSample(event):
			self.sample=event.GetInt()
		def OnSpinCtrlIteration(event):
			self.iteration=event.GetInt()
		def OnRadioBoxType(event):
			self.type=event.GetSelection()
			sizer1=wx.xrc.XRCCTRL(self.panel,'StaticLine1').GetContainingSizer()
			for i in range(3):
				sizer1.Show(i+2, i==self.type)
			self.panel.Layout()
		def OnButtonDraw(event):
			self.SetRegion()
			self.recurrencetime.calc(self.sample,self.iteration)
			wx.xrc.XRCCTRL(self.panel,'TextCtrlAverage').SetValue(str(self.recurrencetime.average))
			self.distplotpanel.plot(self.recurrencetime.axis,self.recurrencetime.dist,'-')
			self.cumplotpanel.plot(self.recurrencetime.axis,self.recurrencetime.cum,'-')
		def OnButtonSet(event):
			dlg=Utils.RegionDialog(self,self.type,style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER|wx.CENTER)
			
			pages=self.GetParent().GetPages()
			if pages.has_key('Poincare Plot'):
				for (args,kwargs) in pages['Poincare Plot'].plotpanel.data:
					dlg.axes.plot(*args,**kwargs)
			
			if dlg.ShowModal() == wx.ID_OK:
				values=dlg.GetValues()
				if self.type == 0:
					self.TCListRect[0][0].SetValue(str(values[0]))
					self.TCListRect[0][1].SetValue(str(values[1]))
					self.TCListRect[1][0].SetValue(str(values[2]))
					self.TCListRect[1][1].SetValue(str(values[3]))
					
				if self.type == 1:
					self.TCListBox[0][0].SetValue(str(values[0]))
					self.TCListBox[1][0].SetValue(str(values[1]))
					self.TCListBox[2][0].SetValue(str(values[2]))
					
				if self.type == 2:
					self.TCListCircle[0][0].SetValue(str(values[0]))
					self.TCListCircle[1][0].SetValue(str(values[1]))
					self.TCListCircle[2][0].SetValue(str(values[2]))
			
			dlg.Destroy()
		
		self.Bind(wx.EVT_SPINCTRL, OnSpinCtrlSample, wx.xrc.XRCCTRL(self.panel,'SpinCtrlSample'))
		self.Bind(wx.EVT_SPINCTRL, OnSpinCtrlIteration, wx.xrc.XRCCTRL(self.panel,'SpinCtrlIteration'))
		self.Bind(wx.EVT_RADIOBOX, OnRadioBoxType, wx.xrc.XRCCTRL(self.panel,'RadioBoxType'))
		self.Bind(wx.EVT_BUTTON, OnButtonDraw, wx.xrc.XRCCTRL(self.panel,'ButtonDraw'))
		self.Bind(wx.EVT_BUTTON, OnButtonSet, wx.xrc.XRCCTRL(self.panel,'ButtonSet'))
		
		#### Creating PlotPanel and RecurrenceTime, Setting default values
		self.distplotpanel=parent.GetParent().MakePlotPanel(self.title+' Distrbution')
		self.cumplotpanel=parent.GetParent().MakePlotPanel(self.title+' Cumulative Distrbution')
		
		self.recurrencetime=maps.TimeStatistics.RecurrenceTime(self.mapsystem)
		
		self.sample=wx.xrc.XRCCTRL(self.panel,'SpinCtrlSample').GetValue()
		self.iteration=wx.xrc.XRCCTRL(self.panel,'SpinCtrlIteration').GetValue()
		self.type=wx.xrc.XRCCTRL(self.panel,'RadioBoxType').GetSelection()
		
		self.SetRegion()
	def __init__(self,parent,mapsystem,title):
		_SubPanel.__init__(self,parent,mapsystem,title)
		#### Loading XRC file and Setting the panel
		xmlresource=wx.xrc.XmlResource("OnSight/data/xrc/poincareplotpanel.xrc")
		self.panel=xmlresource.LoadPanel(self,"poincareplotpanel")
		
		sizer=wx.BoxSizer()
		sizer.Add(self.panel,proportion=1,flag= wx.ALL | wx.EXPAND)
		self.SetSizer(sizer)
		
		#### Creating TextCtrls and StaticTexts 
		axislabel=Utils.getAxisLabel(self.mapsystem)
		
		proportion_st=0
		proportion_tc=1
		style_tc=wx.TE_RIGHT
		flag_st=flag_tc=wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL
		
		input=[[axislabel[d]+': ', 'min ', 0.0, 'max ', 1.0] for d in range(self.mapsystem.dim)]
		
		sizer1=wx.xrc.XRCCTRL(self.panel,'StaticLine1').GetContainingSizer()
		self.TCListRect=Utils._putTextCtrlFlexGrid(self.panel,sizer1.GetChildren()[2].GetSizer(),input,
			proportion_st=proportion_st,flag_st=flag_st,style_tc=style_tc,proportion_tc=proportion_tc,flag_tc=flag_tc)
		
		input=[[axislabel[d]+': ', 'center ', 0.0] for d in range(self.mapsystem.dim)]
		input.append(['','edge ',1.0])
		
		self.TCListBox=Utils._putTextCtrlFlexGrid(self.panel,sizer1.GetChildren()[3].GetSizer(),input,
			proportion_st=proportion_st,flag_st=flag_st,style_tc=style_tc,proportion_tc=proportion_tc,flag_tc=flag_tc)
		
		input=[[axislabel[d]+': ', 'center ', 0.0] for d in range(self.mapsystem.dim)]
		input.append(['','radius ',1.0])
		
		self.TCListCircle=Utils._putTextCtrlFlexGrid(self.panel,sizer1.GetChildren()[4].GetSizer(),input,
			proportion_st=proportion_st,flag_st=flag_st,style_tc=style_tc,proportion_tc=proportion_tc,flag_tc=flag_tc)
		
		for i in range(3): sizer1.Show(i+2,i==0)
		
		#### Event Handling
		def OnSpinCtrlSample(event):
			self.sample=event.GetInt()
		def OnSpinCtrlIteration(event):
			self.iteration=event.GetInt()
		def OnRadioBoxType(event):
			self.type=event.GetSelection()
			sizer1=wx.xrc.XRCCTRL(self.panel,'StaticLine1').GetContainingSizer()
			for i in range(3):
				sizer1.Show(i+2, i==self.type)
			self.panel.Layout()
		def OnRadioBoxRandom(event):
			self.random=(event.GetSelection()==0)
		def OnCheckBoxTrajectory(event):
			self.trajectory=event.IsChecked()
			wx.xrc.XRCCTRL(self.panel,'ButtonPrev').Enable(enable=1-self.trajectory)
			wx.xrc.XRCCTRL(self.panel,'ButtonNext').Enable(enable=1-self.trajectory)
		def OnButtonDraw(event):
			self.SetInitialPoints()
			self.mapsystem.evolves(self.iteration)
			self.Draw()
		def OnButtonPrev(event):
			if self.iteration<=0: return
			self.iteration= self.iteration-1
			wx.xrc.XRCCTRL(self.panel,'SpinCtrlIteration').SetValue(self.iteration)
			OnButtonDraw(event)
		def OnButtonNext(event):
			self.iteration= self.iteration+1
			wx.xrc.XRCCTRL(self.panel,'SpinCtrlIteration').SetValue(self.iteration)
			OnButtonDraw(event)
		def OnButtonSet(event):
			dlg=Utils.RegionDialog(self,self.type,style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER| wx.CENTER)

			for (args,kwargs) in self.plotpanel.data:
				dlg.axes.plot(*args,**kwargs)
			
			if dlg.ShowModal() == wx.ID_OK:
				values=dlg.GetValues()
				if self.type == 0:
					self.TCListRect[0][0].SetValue(str(values[0]))
					self.TCListRect[0][1].SetValue(str(values[1]))
					self.TCListRect[1][0].SetValue(str(values[2]))
					self.TCListRect[1][1].SetValue(str(values[3]))
					
				if self.type == 1:
					self.TCListBox[0][0].SetValue(str(values[0]))
					self.TCListBox[1][0].SetValue(str(values[1]))
					self.TCListBox[2][0].SetValue(str(values[2]))
					
				if self.type == 2:
					self.TCListCircle[0][0].SetValue(str(values[0]))
					self.TCListCircle[1][0].SetValue(str(values[1]))
					self.TCListCircle[2][0].SetValue(str(values[2]))
			
			dlg.Destroy()

		self.Bind(wx.EVT_SPINCTRL, OnSpinCtrlSample, wx.xrc.XRCCTRL(self.panel,'SpinCtrlSample'))
		self.Bind(wx.EVT_SPINCTRL, OnSpinCtrlIteration, wx.xrc.XRCCTRL(self.panel,'SpinCtrlIteration'))
		self.Bind(wx.EVT_RADIOBOX, OnRadioBoxType, wx.xrc.XRCCTRL(self.panel,'RadioBoxType'))
		self.Bind(wx.EVT_RADIOBOX, OnRadioBoxRandom, wx.xrc.XRCCTRL(self.panel,'RadioBoxRandom'))
		self.Bind(wx.EVT_CHECKBOX, OnCheckBoxTrajectory, wx.xrc.XRCCTRL(self.panel,'CheckBoxTrajectory'))
		self.Bind(wx.EVT_BUTTON, OnButtonSet, wx.xrc.XRCCTRL(self.panel,'ButtonSet'))
		self.Bind(wx.EVT_BUTTON, OnButtonPrev, wx.xrc.XRCCTRL(self.panel,'ButtonPrev'))
		self.Bind(wx.EVT_BUTTON, OnButtonNext, wx.xrc.XRCCTRL(self.panel,'ButtonNext'))
		self.Bind(wx.EVT_BUTTON, OnButtonDraw, wx.xrc.XRCCTRL(self.panel,'ButtonDraw'))
		
		#### Creating PlotPanel, Setting default values
		self.plotpanel=parent.GetParent().MakePlotPanel(self.title)
		
		self.plotpanel.OnPress=self.OnPress
		
		self.sample=wx.xrc.XRCCTRL(self.panel,'SpinCtrlSample').GetValue()
		self.iteration=wx.xrc.XRCCTRL(self.panel,'SpinCtrlIteration').GetValue()
		self.type=wx.xrc.XRCCTRL(self.panel,'RadioBoxType').GetSelection()
		self.random=(wx.xrc.XRCCTRL(self.panel,'RadioBoxRandom').GetSelection()==0)
		self.trajectory=wx.xrc.XRCCTRL(self.panel,'CheckBoxTrajectory').IsChecked()
		
		self.SetInitialPoints()
		self.mapsystem.evolves(self.iteration)
		self.Draw()