当前位置: 首页>>代码示例>>Python>>正文


Python Basemap.lonmax方法代码示例

本文整理汇总了Python中mpl_toolkits.basemap.Basemap.lonmax方法的典型用法代码示例。如果您正苦于以下问题:Python Basemap.lonmax方法的具体用法?Python Basemap.lonmax怎么用?Python Basemap.lonmax使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mpl_toolkits.basemap.Basemap的用法示例。


在下文中一共展示了Basemap.lonmax方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import lonmax [as 别名]

#.........这里部分代码省略.........

			# Erase the individual xml files
			cmd = "rm %s/ModelSource_bin*.xml" % self.outdir
#			print cmd
			os.system(cmd)

			print 'Done.'

			Results = {'MaxTS':None, 'MaxRA':None, 'MaxDec':None, 'Error':None, 'Index':None, 'IndexError':None, 'Flux':None,'FluxError':None, 'MaxBin':None}
			return Results

		else:

			MaxRa = RaDecPairs[MaxBin][0]
			MaxDec = RaDecPairs[MaxBin][1]

		# Define default spectral parameters
		index = 'NA'
		indexError = 'NA'
		flux = 'NA'
		fluxError = 'NA'

		if UseGtlike == True:

			# Extract the fit parameters for the bin with the maximum TS (gtlike)
			MaxBinFile = "%s/dtsmap_bin%s.log" % (LogDirectory, MaxBin)
			for line in fileinput.input([MaxBinFile]):
				if 'Index:' in line: 
					lineContents = line.split()	
					index = lineContents[1]
					indexError = lineContents[3]
				if 'Flux:' in line: 
					lineContents = line.split()	
					flux = lineContents[1]
					fluxError = lineContents[3]
					break
			fileinput.close()

		else:

			# Extract the spectral fit parameters for the bin with the maximum TS (pyLikelihood)
			MaxBinFile = "%s/dtsmap_bin%s.log" % (LogDirectory, MaxBin)
			for line in fileinput.input([MaxBinFile]):
				if 'Flux =' in line: 
					lineContents = line.split()	
					flux = float(lineContents[2])
					fluxError = float(lineContents[4])
				if 'Index =' in line: 
					lineContents = line.split()	
					index = float(lineContents[2])
					indexError = float(lineContents[4])
			fileinput.close()


		# Rotate and flip the matrix in order to it to match ra and dec ordering conventions
		TSMapRotated = numpy.rot90(TSMap)
		TSMapFlippedUp = numpy.flipud(TSMapRotated)
		TSMapFlippedLeft2Right = numpy.fliplr(TSMapFlippedUp)
		MaxRa = RaDecPairs[numpy.nanargmax(TSMap)][0]
		MaxDec = RaDecPairs[numpy.nanargmax(TSMap)][1]

		# Import the basemap module
		sys.path.append("/nfs/slac/g/ki/ki08/kocevski/LATBA/lib/python_rhel6-64/")
		from mpl_toolkits.basemap import Basemap

		# Create the figure
		fig = plot.figure()
		ax = fig.add_subplot(111)

		# Create a base map on which to plot the results
		#m = Basemap(llcrnrlon=ra_range[-1], llcrnrlat=dec_range[0], urcrnrlon=ra_range[0], urcrnrlat=dec_range[-1], projection='laea', lon_0 = ra, lat_0 = dec,resolution ='l',area_thresh=1000.)# ,celestial=True )
		m = Basemap(height=5.5e5,width=5.5e5, projection='laea', lon_0 = ra*-1, lat_0 = dec, resolution ='l', area_thresh=1000., celestial=True )

		# Set the plot limits (in map coordinates)
		xMin, yMin = m(ra_range[0], dec_range[0])
		xMax, yMax = m(ra_range[-1], dec_range[-1])
		m.lonmin = xMin
		m.lonmax = xMax
		m.latmin = yMin
		m.latmax = yMax

		# Plot the matrix as an image
		extent=[xMax, xMin, yMin, yMax]
		#m.imshow(TSMapFlippedLeft2Right, origin='lower', extent=extent)
		m.imshow(TSMapFlippedLeft2Right, origin='lower')

		# Setup the map grid
		m.drawmapboundary(fill_color='#ffffff')
		m.drawparallels(numpy.arange(181)-90,labels=[1,0,0,0], fmt=customDecLabel, color='grey', linewidth=0)
		m.drawmeridians(numpy.arange(0,360,1),labels=[0,0,0,1], fmt=customRALabel, color='grey', linewidth=0)
		m.suppress_ticks = False
		m.fix_aspect = False
	
		# Force the aspect ratio to be 1:1
		try:
			forceAspect(ax,aspect=1)
			#extent=[xMax, xMin, yMin, yMax]
			#ax.set_aspect(abs((extent[1]-extent[0])/(extent[3]-extent[2])))
		except Exception, message:
			print traceback.format_exc()
开发者ID:dankocevski,项目名称:dtsmap,代码行数:104,代码来源:dtsmap.py

示例2: Plot

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import lonmax [as 别名]

#.........这里部分代码省略.........
		os.system(cmd)

		# Erase the individual xml files
		cmd = "rm %s/ModelSource_bin*.xml" % self.outdir
#			print cmd
		os.system(cmd)

		print 'Done.'

		Results = {'MaxTS':None, 'MaxRA':None, 'MaxDec':None, 'Error':None, 'Index':None, 'IndexError':None, 'Flux':None,'FluxError':None, 'MaxBin':None}
		return Results

	else:

		MaxRa = RaDecPairs[MaxBin][0]
		MaxDec = RaDecPairs[MaxBin][1]

	# Define default spectral parameters
	index = 'NA'
	indexError = 'NA'
	flux = 'NA'
	fluxError = 'NA'

	if UseGtlike == True:

		# Extract the fit parameters for the bin with the maximum TS (gtlike)
		MaxBinFile = "%s/dtsmap_bin%s.log" % (LogDirectory, MaxBin)
		for line in fileinput.input([MaxBinFile]):
			if 'Index:' in line: 
				lineContents = line.split()	
				index = lineContents[1]
				indexError = lineContents[3]
			if 'Flux:' in line: 
				lineContents = line.split()	
				flux = lineContents[1]
				fluxError = lineContents[3]
				break
		fileinput.close()

	else:

		# Extract the spectral fit parameters for the bin with the maximum TS (pyLikelihood)
		MaxBinFile = "%s/dtsmap_bin%s.log" % (LogDirectory, MaxBin)
		for line in fileinput.input([MaxBinFile]):
			if 'Flux =' in line: 
				lineContents = line.split()	
				flux = float(lineContents[2])
				fluxError = float(lineContents[4])
			if 'Index =' in line: 
				lineContents = line.split()	
				index = float(lineContents[2])
				indexError = float(lineContents[4])
		fileinput.close()


	# Rotate and flip the matrix in order to it to match ra and dec ordering conventions
	TSMapRotated = numpy.rot90(TSMap)
	TSMapFlippedUp = numpy.flipud(TSMapRotated)
	TSMapFlippedLeft2Right = numpy.fliplr(TSMapFlippedUp)
	MaxRa = RaDecPairs[numpy.nanargmax(TSMap)][0]
	MaxDec = RaDecPairs[numpy.nanargmax(TSMap)][1]

	# Import the basemap module
	sys.path.append("/nfs/slac/g/ki/ki08/kocevski/LATBA/lib/python_rhel6-64/")
	from mpl_toolkits.basemap import Basemap

	# Create the figure
	fig = plot.figure()
	ax = fig.add_subplot(111)

	# Create a base map on which to plot the results
	m = Basemap(height=5.5e5,width=5.5e5, projection='laea', lon_0 = ra*-1, lat_0 = dec, resolution ='l', area_thresh=1000., celestial=True )

	# Set the plot limits (in map coordinates)
	xMin, yMin = m(ra_range[0], dec_range[0])
	xMax, yMax = m(ra_range[-1], dec_range[-1])
	m.lonmin = xMin
	m.lonmax = xMax
	m.latmin = yMin
	m.latmax = yMax

	# Plot the matrix as an image
	extent=[xMax, xMin, yMin, yMax]
	#m.imshow(TSMapFlippedLeft2Right, origin='lower', extent=extent)
	m.imshow(TSMapFlippedLeft2Right, origin='lower')

	# Setup the map grid
	m.drawmapboundary(fill_color='#ffffff')
	m.drawparallels(numpy.arange(181)-90,labels=[1,0,0,0], fmt=customDecLabel, color='grey', linewidth=0.25)
	m.drawmeridians(numpy.arange(0,360,1),labels=[0,0,0,1], fmt=customRALabel, color='grey', linewidth=0.25)
	m.suppress_ticks = False
	m.fix_aspect = False

	# Force the aspect ratio to be 1:1
	try:
		forceAspect(ax,aspect=1)
		#extent=[xMax, xMin, yMin, yMax]
		#ax.set_aspect(abs((extent[1]-extent[0])/(extent[3]-extent[2])))
	except Exception, message:
		print traceback.format_exc()
开发者ID:dankocevski,项目名称:FAVA,代码行数:104,代码来源:MakeTSMap.py


注:本文中的mpl_toolkits.basemap.Basemap.lonmax方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。