本文整理汇总了Python中hyperion.model.Model.set_pda方法的典型用法代码示例。如果您正苦于以下问题:Python Model.set_pda方法的具体用法?Python Model.set_pda怎么用?Python Model.set_pda使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hyperion.model.Model
的用法示例。
在下文中一共展示了Model.set_pda方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run_thermal_hyperion
# 需要导入模块: from hyperion.model import Model [as 别名]
# 或者: from hyperion.model.Model import set_pda [as 别名]
def run_thermal_hyperion(self, nphot=1e6, mrw=False, pda=False, \
niterations=20, percentile=99., absolute=2.0, relative=1.02, \
max_interactions=1e8, mpi=False, nprocesses=None):
d = []
for i in range(len(self.grid.dust)):
d.append(IsotropicDust( \
self.grid.dust[i].nu[::-1].astype(numpy.float64), \
self.grid.dust[i].albedo[::-1].astype(numpy.float64), \
self.grid.dust[i].kext[::-1].astype(numpy.float64)))
m = HypModel()
if (self.grid.coordsystem == "cartesian"):
m.set_cartesian_grid(self.grid.w1*AU, self.grid.w2*AU, \
self.grid.w3*AU)
elif (self.grid.coordsystem == "cylindrical"):
m.set_cylindrical_polar_grid(self.grid.w1*AU, self.grid.w3*AU, \
self.grid.w2)
elif (self.grid.coordsystem == "spherical"):
m.set_spherical_polar_grid(self.grid.w1*AU, self.grid.w2, \
self.grid.w3)
for i in range(len(self.grid.density)):
if (self.grid.coordsystem == "cartesian"):
m.add_density_grid(numpy.transpose(self.grid.density[i], \
axes=(2,1,0)), d[i])
if (self.grid.coordsystem == "cylindrical"):
m.add_density_grid(numpy.transpose(self.grid.density[i], \
axes=(1,2,0)), d[i])
if (self.grid.coordsystem == "spherical"):
m.add_density_grid(numpy.transpose(self.grid.density[i], \
axes=(2,1,0)), d[i])
sources = []
for i in range(len(self.grid.stars)):
sources.append(m.add_spherical_source())
sources[i].luminosity = self.grid.stars[i].luminosity * L_sun
sources[i].radius = self.grid.stars[i].radius * R_sun
sources[i].temperature = self.grid.stars[i].temperature
m.set_mrw(mrw)
m.set_pda(pda)
m.set_max_interactions(max_interactions)
m.set_n_initial_iterations(niterations)
m.set_n_photons(initial=nphot, imaging=0)
m.set_convergence(True, percentile=percentile, absolute=absolute, \
relative=relative)
m.write("temp.rtin")
m.run("temp.rtout", mpi=mpi, n_processes=nprocesses)
n = ModelOutput("temp.rtout")
grid = n.get_quantities()
self.grid.temperature = []
temperature = grid.quantities['temperature']
for i in range(len(temperature)):
if (self.grid.coordsystem == "cartesian"):
self.grid.temperature.append(numpy.transpose(temperature[i], \
axes=(2,1,0)))
if (self.grid.coordsystem == "cylindrical"):
self.grid.temperature.append(numpy.transpose(temperature[i], \
axes=(2,0,1)))
if (self.grid.coordsystem == "spherical"):
self.grid.temperature.append(numpy.transpose(temperature[i], \
axes=(2,1,0)))
os.system("rm temp.rtin temp.rtout")