Home | Trees | Indices | Help |
---|
|
1 # -*- coding: utf-8 -*- 2 3 """ 4 Preparing input for LIME. 5 6 Author: R. Lombaert 7 8 """ 9 10 import os 11 import numpy as np 12 13 from cc.tools.io import DataIO 14 from cc.data import Data 1517 18 ''' 19 Prepare inputfiles for LIME from a GASTRoNOoM and MCMax model. 20 21 Input is taken from the model ouput and written into files. The output 22 folder can be chosen. The model_id tag can be replaced with an arbitrary 23 string. 24 25 Input is converted to SI units, except opacities, which are in cm2/g. 26 27 @param star: The model object including the GASTRoNOoM and MCMax model ids. 28 @type star: Star() 29 @param path: The target folder for the files. 30 @type path: str 31 32 @keyword repl_str: Replacement string for the model_id tag. 33 34 (default: '') 35 @type repl_str: str 36 37 ''' 38 39 #-- First opacities and t_dust, which are not part of the GASTRoNOoM output 40 mcmid = star['LAST_MCMAX_MODEL'] 41 fnopac = os.path.join(path,'opac_%s.dat'%(repl_str and repl_str or mcmid)) 42 DataIO.writeCols(fnopac,star.getWeightedKappas()) 43 44 #-- Write dust temperature to a file. 45 fntd = os.path.join(path,'td_%s.dat'%(repl_str and repl_str or mcmid)) 46 rad = star.getDustRad(unit='m') 47 td = star.getDustTemperature() 48 DataIO.writeCols(fntd,[rad,td]) 49 50 #-- Finally the gas properties 51 if not repl_str: repl_str = star['LAST_GASTRONOOM_MODEL'] 52 53 #-- Radius for nh2 and vel 54 rad = star.getGasRad(unit='m',ftype='fgr_all') 55 if rad.size > 10000: 56 icutoff = np.argmin(abs(rad-1e14)) 57 rad = Data.reduceArray(rad,20,1e14,'remove') 58 else: 59 icutoff = None 60 61 #-- h2 number density 62 nh2 = star.getGasNumberDensity(ftype='fgr_all') 63 nh2 = nh2*10**6 64 if not icutoff is None: 65 nh2 = Data.reduceArray(nh2,20,nh2[icutoff],'remove') 66 fnnh2 = os.path.join(path,'nh2_%s.dat'%repl_str) 67 DataIO.writeCols(fnnh2,[rad,nh2]) 68 69 #-- Velocity profile 70 vel = star.getGasVelocity(ftype='fgr_all') 71 vel = vel*10**-2 72 if not icutoff is None: 73 vel = Data.reduceArray(vel,20,vel[icutoff],'remove') 74 fnvel = os.path.join(path,'vg_%s.dat'%repl_str) 75 DataIO.writeCols(fnvel,[rad,vel]) 76 77 #-- CO abundance 78 rad = star.getGasRad(ftype='1',mstr='12C16O',unit='m') 79 nh2 = star.getGasNumberDensity(ftype='1',mstr='12C16O') 80 nco = star.getGasNumberDensity(ftype='1',mstr='12C16O',molecule=1) 81 aco = nco/nh2 82 fnaco = os.path.join(path,'aco_%s.dat'%repl_str) 83 DataIO.writeCols(fnaco,[rad,aco])84
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Mon Nov 7 18:01:59 2016 | http://epydoc.sourceforge.net |