• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python torch.set_font_sizes函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中torch.set_font_sizes函数的典型用法代码示例。如果您正苦于以下问题:Python set_font_sizes函数的具体用法?Python set_font_sizes怎么用?Python set_font_sizes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: load_src

def load_src(name, fpath):
    import os, imp
    return imp.load_source(name, os.path.join(os.path.dirname(__file__), fpath))

load_src("torch", "../torchpack/torch.py")
load_src("hgspy", "../torchpack/hgspy.py")

import torch
import hgspy

DPI = 300
figformat = 'png'
plot_size = 5
fontsize = 16
torch.set_font_sizes(fontsize=16)

inputfile1 = "data/galsim/starpop-hm-a.txt"

data1 = np.genfromtxt(inputfile1, skip_header=1)

def plot_scatter(ax, dat, colormap):
    x = dat[:,12]
    y = dat[:,13]

    xy = np.vstack([x,y])
    z = scipy.stats.gaussian_kde(xy)(xy)

    idx = z.argsort()
    x, y, z = x[idx], y[idx], z[idx]
开发者ID:hgsteggles,项目名称:Torch,代码行数:29,代码来源:galaxy-stars.py


示例2: load_src

def load_src(name, fpath):
    import os, imp
    return imp.load_source(name, os.path.join(os.path.dirname(__file__), fpath))

load_src("torch", "../torchpack/torch.py")
load_src("hgspy", "../torchpack/hgspy.py")

import torch
import hgspy

DPI = 300
figformat = 'png'
plot_size = 5
fontsize = 16
outputfile_qlyc = "mass-vs-qlyc.png"
torch.set_font_sizes(fontsize)

data = np.genfromtxt("refdata/zams.txt", skip_header=1)

### Data set up.

mass = data[:,0]
qlyc = data[:,6]

### Plotting.
plotter = torch.Plotter(1, 1, plot_size, figformat, DPI)

###	Axes.
grid = plotter.axes1D((1,1), aspect_ratio=0.75)
grid[0].set_xlabel(plotter.format_label(torch.VarType('M_\star', units='M_{\odot}')))
grid[0].set_ylabel(plotter.format_label(torch.VarType('Q_\\mathrm{Lyc}', units='s^{-1}', isLog10=True)))
开发者ID:hgsteggles,项目名称:Torch,代码行数:31,代码来源:mass-qlyc.py


示例3: plot

def plot():
	import warnings
	import sys
	def load_src(name, fpath):
		import os, imp
		return imp.load_source(name, os.path.join(os.path.dirname(__file__), fpath))

	load_src("torch", "../torchpack/torch.py")
	load_src("hgspy", "../torchpack/hgspy.py")

	import torch
	import hgspy

	DPI = 300
	figformat = 'png'
	plot_size = 5
	fontsize = 16
	plot_type = "ssw" # ["if", "hii", "ssw"]
	outputfile_qlyc = "henney-" + plot_type + ".png"

	torch.set_font_sizes(fontsize)

	### Data
	lmp = []
	lmn = []
	lhp = []
	lhn = []
	lcie = []
	lpdr = []
	ltot = []

	if plot_type == "ssw":
		nh = 1
	elif plot_type == "hii":
		nh = 1000
	else:
		nh = 10000

	hii = 1.0
	if plot_type == "if":
		hii = 0.5
	N = 1001
	minlogT = 4.0
	maxlogT = 8.0
	if plot_type == "if" or plot_type == "hii":
		minlogT = 3.8
		maxlogT = 4.0
	isLog = True

	nhii = hii * nh
	nhi = (1.0 - hii) * nh

	if not isLog:
		tem = np.linspace(10.0**minlogT, 10.0**maxlogT, N, endpoint=True)
	else:
		tem = np.linspace(minlogT, maxlogT, N, endpoint=True)

	for i in range(len(tem)):
		itemp = tem[i]
		if isLog:
			itemp = math.pow(10.0, itemp)
		lmp.append(coolCollExcIonMetals(nhii, itemp))
		lmn.append(coolCollExcNeuMetals(nhii, nhi, itemp))
		lhp.append(coolFreeFree(nhii, itemp))
		lhn.append(coolCollExcNeuHydrogen(nhii, nhi, itemp))
		lcie.append(coolCIE(nhii, itemp))
		lpdr.append(coolPDR(nhi, itemp))
		ltot.append(lmp[i] + lmn[i] + lhp[i] + lhn[i] + lcie[i] + lpdr[i])

	### Plotting.
	plotter = torch.Plotter(1, 1, plot_size, figformat, DPI)

	###	Axes.
	grid = plotter.axes1D((1,1), aspect_ratio=0.75)
	grid[0].set_xlabel(plotter.format_label(torch.VarType('T', units='K', isLog10=True)))
	grid[0].set_ylabel(plotter.format_label(torch.VarType('C', units='erg\\:s^{-1}\\:cm^{-3}', isLog10=False)))

	### Plot.
	if plot_type == "if":
		grid[0].plot(tem, lmn, label=r"$C_\mathrm{M^0}$", color='m')
		grid[0].plot(tem, lhn, label=r"$C_\mathrm{H^0}$", color='y')
		grid[0].plot(tem, lmp, label=r"$C_\mathrm{M^+}$", color='g')
		grid[0].plot(tem, lhp, label=r"$C_\mathrm{H^+}$", color='r')
		grid[0].plot(tem, ltot, label=r"$C_\mathrm{tot}$", color='k')
	elif plot_type == "hii":
		grid[0].plot(tem, lmp, label=r"$C_\mathrm{M^+}$", color='g')
		grid[0].plot(tem, lhp, label=r"$C_\mathrm{H^+}$", color='r')
		grid[0].plot(tem, ltot, label=r"$C_\mathrm{tot}$", color='k')
	elif plot_type == "ssw":
		grid[0].plot(tem, lmp, label=r"$C_\mathrm{M^+}$", color='g')
		grid[0].plot(tem, lhp, label=r"$C_\mathrm{H^+}$", color='r')
		grid[0].plot(tem, lcie, label=r"$C_\mathrm{CIE}$", color='b')
		grid[0].plot(tem, ltot, label=r"$C_\mathrm{tot}$", color='k')

	grid[0].set_xlim([minlogT, maxlogT])
	if plot_type == "ssw":
		grid[0].legend(loc='upper right')
	else:
		grid[0].legend(loc='upper left')

#.........这里部分代码省略.........
开发者ID:hgsteggles,项目名称:Torch,代码行数:101,代码来源:henney-cooling.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python torch.sigmoid函数代码示例发布时间:2022-05-27
下一篇:
Python torch.save函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap