Beispiel #1
0
 def write_phat_inputs(self, a1, a2, ofile):
     nm.write_namelist('spins.in', ['spins'], ['a', 'athin', 'ofile'],
                       [a1, a2, '"' + ofile + '"'], [3])
Beispiel #2
0
 def set_grtrans_input_file(self, fname, oname):
     nm.write_namelist('files.in', ['files'], ['ifile', 'ofile'],
                       ['"' + fname + '"', '"' + oname + '"'], [2])
     self.ifile = fname
     self.ofile = oname
Beispiel #3
0
    def write(self, fname):
        argst = ['mdot', 'mbh']
        argsharm = ['dfile', 'hfile', 'nt', 'indf']
        argsmb09 = ['gfile', 'dfile', 'nt', 'nfiles', 'indf', 'jonfix', 'sim']
        argsthick = [
            'gfile', 'dfile', 'nt', 'nfiles', 'indf', 'jonfix', 'offset',
            'sim', 'dindf', 'magcrit'
        ]
        argsp = [
            'nw', 'wmin', 'wmax', 'nfreq_tab', 'fmin', 'fmax', 'rmax', 'nr',
            'sigt', 'fcol'
        ]
        argsj = ['dfile']
        argsn = ['dfile', 'tscl', 'rscl']
        argsh = ['rspot', 'r0spot', 'n0spot']
        names = [
            'geodata', 'fluiddata', 'emisdata', 'general', 'harm', 'analytic'
        ]
        args = [
            'standard', 'mumin', 'mumax', 'nmu', 'phi0', 'spin', 'uout', 'uin',
            'rcut', 'nrotype', 'gridvals', 'nn', 'i1', 'i2', 'extra', 'debug'
        ]
        nargs = [len(args)]
        args1 = [
            'fname', 'dt', 'nt', 'nload', 'nmdot', 'mdotmin', 'mdotmax',
            'sigcut', 'betaeconst', 'betaecrit', 'ximax', 'bscl', 'pscl',
            'pegasratio'
        ]
        nargs.append(len(args1))
        args2 = [
            'ename', 'mbh', 'nfreq', 'fmin', 'fmax', 'muval', 'gmin', 'gmax',
            'p1', 'p2', 'fpositron', 'jetalpha', 'stype', 'delta', 'nweights',
            'coefindx'
        ]
        nargs.append(len(args2))
        args3 = ['use_geokerr', 'nvals', 'iname', 'cflag']
        nargs.append(len(args3))
        args4 = [
            'fdfile', 'fgfile', 'fhfile', 'fnt', 'fnfiles', 'findf', 'fjonfix',
            'foffset', 'fsim', 'fdindf', 'fmagcrit', 'fscalefac'
        ]
        nargs.append(len(args4))
        args5 = [
            'fnw', 'fwmin', 'fwmax', 'fnfreq_tab', 'ffmin', 'ffmax', 'frmax',
            'fnr', 'fsigt', 'ffcol', 'frspot', 'fr0spot', 'fn0spot', 'ftscl',
            'frscl', 'fmdot', 'fnscl', 'fnnthscl', 'fnnthp', 'fbeta', 'fbl06',
            'fnp', 'ftp', 'frin', 'frout', 'fthin', 'fthout', 'fphiin',
            'fphiout'
        ]
        nargs.append(len(args5))
        args = args
        args.extend(args1)
        args.extend(args2)
        args.extend(args3)
        args.extend(args4)
        args.extend(args5)
        nnstr = ''
        gridstr = ''
        cindxstr = ''
        for i in range(len(self.nn[:-1])):
            nnstr += str(self.nn[i]) + ','
        nnstr += str(self.nn[-1])
        for i in range(len(self.epcoefindx[:-1])):
            cindxstr += str(self.epcoefindx[i]) + ','
        cindxstr += str(self.epcoefindx[-1])
        for i in range(len(self.gridvals[:-1])):
            gridstr += str(self.gridvals[i]) + ','
        gridstr += str(self.gridvals[-1])

        vals = [
            self.standard, self.mumin, self.mumax, self.nmu, self.phi0,
            self.spin, self.uout, self.uin, self.rcut, self.nrotype, gridstr,
            nnstr, self.i1, self.i2, self.extra, self.debug
        ]
        vals.extend([
            "'" + self.fname + "'", self.dt, self.nt, self.nload, self.nmdot,
            self.mdotmin, self.mdotmax, self.sigcut, self.betaeconst,
            self.betaecrit, self.ximax, self.bscl, self.pscl, self.pegasratio
        ])
        vals.extend([
            "'" + self.ename + "'", self.mbh, self.nfreq, self.fmin, self.fmax,
            self.muval, self.gmin, self.gmax, self.p1, self.p2, self.fpositron,
            self.jetalpha, "'" + self.stype + "'", self.delta, self.nweights,
            cindxstr
        ])
        vals.extend(
            [self.use_geokerr, self.nvals, "'" + self.iname + "'", self.cflag])
        #        print(self.fname)

        # default values for fluid arguments that can change depending on model, work with thickdisk
        self.fdfile = self.tdfile
        self.fgfile = self.tgfile
        self.fhfile = self.hhfile
        self.fnt = self.tnt
        self.fnfiles = self.tnfiles
        self.findf = self.tindf
        self.fjonfix = self.tjonfix
        self.foffset = self.toff
        self.fsim = self.tsim
        self.fdindf = self.tdindf
        self.fmagcrit = self.tmagcrit

        # assign mb09 fluid arguments
        if self.fname == 'MB09':
            namesmb09 = ['mb09']
            valsmb09 = [
                "'" + self.mgfile + "'", "'" + self.mdfile + "'", self.mnt,
                self.mnfiles, self.mindf, self.mjonfix, self.msim
            ]
            nargsmb09 = [len(argsmb09)]

            self.fdfile = self.mdfile
            self.fgfile = self.mgfile
            self.fnt = self.mnt
            self.findf = self.mindf
            self.fjonfix = self.mjonfix
            self.fsim = self.msim
            self.fnfiles = self.mnfiles

        # assign harm fluid arguments
        if self.fname in [
                'HARM', 'KORAL', 'KORALNTH', 'KORAL3D', 'KORAL3D_DISK',
                'KORAL3D_TOPJET', 'KORAL3D_BOTJET', 'KORALH5'
        ]:

            namesharm = ['harm']
            valsharm = [
                "'" + self.hdfile + "'", "'" + self.hhfile + "'", self.hnt,
                self.hindf
            ]
            nargsharm = [len(argsharm)]

            self.fdfile = self.hdfile
            self.fhfile = self.hhfile
            self.fnt = self.hnt
            self.findf = self.hindf
            self.fgfile = self.hgfile

        if self.fname == 'THICKDISK':
            namesthick = ['thickdisk']
            valsthick = [
                "'" + self.tgfile + "'", "'" + self.tdfile + "'", self.tnt,
                self.tnfiles, self.tindf, self.tjonfix, self.toff,
                "'" + self.tsim + "'", self.tdindf, self.tmagcrit
            ]
            nargsthick = [len(argsthick)]

        if self.fname == 'THINDISK':
            namest = ['thindisk']
            valst = [self.tmdot, self.mbh]
            nargst = [len(argst)]
#            nm.write_namelist('thindisk.in',namest,argst,valst,nargst)
        if self.fname == 'SHELL':
            namest = ['shell']
            valst = [self.tmdot, self.mbh]
            nargst = [len(argst)]
        elif self.fname == 'PHATDISK':
            namesp = ['phatdisk']
            namest = ['thindisk']
            valst = [self.tmdot, self.mbh]
            valsp = [
                self.pnw, self.pwmin, self.pwmax, self.pnfreq_tab, self.pfmin,
                self.pfmax, self.prmax, self.pnr, self.psigt, self.pfcol
            ]
            nargst = [len(argst)]
            nargsp = [len(argsp)]
#            nm.write_namelist('thindisk.in',namest,argst,valst,nargst)
#            nm.write_namelist('phatdisk.in',namesp,argsp,valsp,nargsp)
        elif self.fname == 'FFJET':
            namesj = ['ffjet']
            valsj = ["'" + self.jdfile + "'"]
            nargsj = [len(argsj)]
            #            nm.write_namelist('ffjet.in',namesj,argsj,valsj,nargsj)
            self.fdfile = self.jdfile
        elif self.fname == 'RRJET':
            namesj = ['rrjet']
            vals
        elif self.fname == 'NUMDISK':
            namesn = ['numdisk']
            valsn = ["'" + self.ndfile + "'", self.ntscl, self.nrscl]
            nargsn = [len(argsn)]
#            nm.write_namelist('numdisk.in',namesn,argsn,valsn,nargsn)
        elif self.fname == 'HOTSPOT':
            namesh = ['hotspot']
            valsh = [self.hrspot, self.hr0spot, self.hn0spot]
            nargsh = [len(argsh)]
#            nm.write_namelist('hotspot.in',namesh,argsh,valsh,nargsh)
        elif self.fname == 'SCHNITTMAN':
            namesh = ['hotspot']
            valsh = [self.hrspot, self.hr0spot, self.hn0spot]
            nargsh = [len(argsh)]


#            nm.write_namelist('hotspot.in',namesh,argsh,valsh,nargsh)
#        else:
#            print('ERROR -- Unrecognized fluid name in grtrans_batch: ', self.fname)
#        print(args)
#        print(vals)
#        print(nargs)
        vals.extend([
            "'" + self.fdfile + "'", "'" + self.fgfile + "'",
            "'" + self.fhfile + "'", self.fnt, self.fnfiles, self.findf,
            self.fjonfix, self.foffset, "'" + self.fsim + "'", self.fdindf,
            self.fmagcrit, self.fscalefac
        ])
        vals.extend([
            self.pnw, self.pwmin, self.pwmax, self.pnfreq_tab, self.pfmin,
            self.pfmax, self.prmax, self.pnr, self.psigt, self.pfcol,
            self.hrspot, self.hr0spot, self.hn0spot, self.ntscl, self.nrscl,
            self.tmdot, self.snscl, self.snnthscl, self.snnthp, self.sbeta,
            self.sbl06, self.snp, self.snt, self.srin, self.srout, self.sthin,
            self.sthout, self.sphiin, self.sphiout
        ])
        nm.write_namelist(fname, names, args, vals, nargs)
Beispiel #4
0
 def write_phat_inputs(self,a1,a2,ofile):
     nm.write_namelist('spins.in',['spins'],['a','athin','ofile'],[a1,a2,'"'+ofile+'"'],[3])
Beispiel #5
0
 def set_grtrans_input_file(self,fname,oname):
     nm.write_namelist('files.in',['files'],['ifile','ofile'],['"'+fname+'"','"'+oname+'"'],[2])
     self.ifile=fname
     self.ofile=oname
Beispiel #6
0
    def write(self,fname):
        argst=['mdot','mbh']
        argsharm=['dfile','hfile','nt','indf']
        argsmb09=['gfile','dfile','nt','nfiles','indf','jonfix','sim']
        argsthick=['gfile','dfile','nt','nfiles','indf','jonfix','offset','sim','dindf','magcrit']
        argsp=['nw','wmin','wmax','nfreq_tab','fmin','fmax','rmax','nr','sigt','fcol']
        argsj=['dfile']
        argsn=['dfile','tscl','rscl']
        argsh=['rspot','r0spot','n0spot']
        names=['geodata','fluiddata','emisdata','general','harm','analytic']
        args=['standard','mumin','mumax','nmu','phi0','spin','uout','uin','rcut','nrotype','gridvals','nn','i1','i2','extra','debug']
        nargs=[len(args)]
        args1=['fname','dt','nt','nload','nmdot','mdotmin','mdotmax']
        nargs.append(len(args1))
        args2=['ename','mbh','nfreq','fmin','fmax','muval','gmin','gmax','p1','p2','jetalpha','stype','delta','nweights','coefindx']
        nargs.append(len(args2))
        args3=['use_geokerr','nvals','iname','cflag']
        nargs.append(len(args3))
        args4=['fdfile','fgfile','fhfile','fnt','fnfiles','findf','fjonfix','foffset','fsim','fdindf','fmagcrit']
        nargs.append(len(args4))
        args5=['fnw','fwmin','fwmax','fnfreq_tab','ffmin','ffmax','frmax','fnr','fsigt','ffcol','frspot','fr0spot','fn0spot','ftscl','frscl','fmdot','fnscl','fnnthscl','fnnthp','fbeta','fbl06','fnp','ftp','frin','frout','fthin','fthout','fphiin','fphiout']
        nargs.append(len(args5))
        args=args
        args.extend(args1)
        args.extend(args2)
        args.extend(args3)
        args.extend(args4)
        args.extend(args5)
        nnstr = ''; gridstr = ''; cindxstr = ''
        for i in range(len(self.nn[:-1])):
            nnstr += str(self.nn[i])+','
        nnstr += str(self.nn[-1])
        for i in range(len(self.epcoefindx[:-1])):
            cindxstr += str(self.epcoefindx[i])+','
        cindxstr += str(self.epcoefindx[-1])
        for i in range(len(self.gridvals[:-1])):
            gridstr += str(self.gridvals[i])+','
        gridstr += str(self.gridvals[-1])
#        nnstr = str(self.nn[0])+','+str(self.nn[1])+','+str(self.nn[2])
#        gridstr = str(self.gridvals[0])+','+str(self.gridvals[1])+','+str(self.gridvals[
        vals=[self.standard,self.mumin,self.mumax,self.nmu,self.phi0,self.spin,self.uout,self.uin,self.rcut,self.nrotype,gridstr,nnstr,self.i1,self.i2,self.extra,self.debug]
        vals.extend(["'"+self.fname+"'",self.dt,self.nt,self.nload,self.nmdot,self.mdotmin,self.mdotmax])
        vals.extend(["'"+self.ename+"'",self.mbh,self.nfreq,self.fmin,self.fmax,self.muval,self.gmin,self.gmax,self.p1,self.p2,self.jetalpha,"'"+self.stype+"'",self.delta,self.nweights,cindxstr])
        vals.extend([self.use_geokerr,self.nvals,"'"+self.iname+"'",self.cflag])
        print self.fname
# default values for fluid arguments that can change depending on model, work with thickdisk
        self.fdfile = self.tdfile; self.fgfile = self.tgfile; self.fhfile = self.hhfile
        self.fnt = self.tnt; self.fnfiles = self.tnfiles; self.findf = self.tindf
        self.fjonfix = self.tjonfix; self.foffset = self.toff; self.fsim = self.tsim
        self.fdindf = self.tdindf; self.fmagcrit = self.tmagcrit
        if self.fname=='MB09':
            namesmb09=['mb09']
            valsmb09=["'"+self.mgfile+"'","'"+self.mdfile+"'",self.mnt,self.mnfiles,self.mindf,self.mjonfix,self.msim]
            nargsmb09=[len(argsmb09)]
        # assign mb09 fluid arguments
            self.fdfile = self.mdfile
            self.fgfile = self.mgfile
            self.fnt = self.mnt
            self.findf = self.mindf
            self.fjonfix = self.mjonfix
            self.fsim = self.msim
            self.fnfiles = self.mnfiles
        if self.fname=='HARM':
            namesharm=['harm']
            valsharm=["'"+self.hdfile+"'","'"+self.hhfile+"'",self.hnt,self.hindf]
            nargsharm=[len(argsharm)]
        # assign harm fluid arguments
            self.fdfile = self.hdfile
            self.fhfile = self.hhfile
            self.fnt = self.hnt
            self.findf = self.hindf
        if self.fname=='THICKDISK':
            namesthick=['thickdisk']
            valsthick=["'"+self.tgfile+"'","'"+self.tdfile+"'",self.tnt,self.tnfiles,self.tindf,self.tjonfix,self.toff,"'"+self.tsim+"'",self.tdindf,self.tmagcrit]
            nargsthick=[len(argsthick)]
        if self.fname=='THINDISK':
            namest=['thindisk']
            valst=[self.tmdot,self.mbh]
            nargst=[len(argst)]
#            nm.write_namelist('thindisk.in',namest,argst,valst,nargst)
        elif self.fname=='PHATDISK':
            namesp=['phatdisk']
            namest=['thindisk']
            valst=[self.tmdot,self.mbh]
            valsp=[self.pnw,self.pwmin,self.pwmax,self.pnfreq_tab,self.pfmin,self.pfmax,self.prmax,self.pnr,self.psigt,self.pfcol]
            nargst=[len(argst)]
            nargsp=[len(argsp)]
#            nm.write_namelist('thindisk.in',namest,argst,valst,nargst)
#            nm.write_namelist('phatdisk.in',namesp,argsp,valsp,nargsp)
        elif self.fname=='FFJET':
            namesj=['ffjet']
            valsj=["'"+self.jdfile+"'"]
            nargsj=[len(argsj)]
#            nm.write_namelist('ffjet.in',namesj,argsj,valsj,nargsj)
            self.fdfile = self.jdfile
        elif self.fname=='NUMDISK':
            namesn=['numdisk']
            valsn=["'"+self.ndfile+"'",self.ntscl,self.nrscl]
            nargsn=[len(argsn)]
#            nm.write_namelist('numdisk.in',namesn,argsn,valsn,nargsn)
        elif self.fname=='HOTSPOT':
            namesh=['hotspot']
            valsh=[self.hrspot,self.hr0spot,self.hn0spot]
            nargsh=[len(argsh)]
#            nm.write_namelist('hotspot.in',namesh,argsh,valsh,nargsh)
        elif self.fname=='SCHNITTMAN':
            namesh=['hotspot']
            valsh=[self.hrspot,self.hr0spot,self.hn0spot]
            nargsh=[len(argsh)]
#            nm.write_namelist('hotspot.in',namesh,argsh,valsh,nargsh)
#        else:
#            print 'ERROR -- Unrecognized fluid name in grtrans_batch: ', self.fname
#        print args
#        print vals
#        print nargs
        vals.extend(["'"+self.fdfile+"'","'"+self.fgfile+"'","'"+self.fhfile+"'",self.fnt,self.fnfiles,self.findf,self.fjonfix,self.foffset,"'"+self.fsim+"'",self.fdindf,self.fmagcrit])
        vals.extend([self.pnw,self.pwmin,self.pwmax,self.pnfreq_tab,self.pfmin,self.pfmax,self.prmax,self.pnr,self.psigt,self.pfcol,self.hrspot,self.hr0spot,self.hn0spot,self.ntscl,self.nrscl,self.tmdot,self.snscl,self.snnthscl,self.snnthp,self.sbeta,self.sbl06,self.snp,self.snt,self.srin,self.srout,self.sthin,self.sthout,self.sphiin,self.sphiout])
        nm.write_namelist(fname,names,args,vals,nargs)