示例#1
0
    def makeMCMaxStars(self, models):
        '''
        Set parameters for star_list taken from the MCMax database.
        
        Based on the model id of MCMax.
        
        @param models: model_ids for the MCMax db
        @type models: list(string)
        @return: The model instances 
        @rtype: list(Star())
        
        '''

        star_grid = Star.makeStars(models=models,code='MCMax',id_type='MCMax',\
                                   path=self.path)
        for star, model in zip(star_grid, models):
            filepath = os.path.join(cc.path.mout,'models',\
                                    star['LAST_MCMAX_MODEL'])
            denstemp = os.path.join(filepath, 'denstemp.dat')
            logfile = os.path.join(filepath, 'log.dat')
            grid_shape = DataIO.getMCMaxOutput(filename=denstemp,incr=1,\
                                               keyword='NGRAINS',single=0)[0]
            star.update({'NTHETA':int(grid_shape[1]),\
                         'NRAD':int(grid_shape[0]),\
                         'T_STAR':float(DataIO.getMCMaxOutput(filename=logfile,\
                                                incr=0,\
                                                keyword='STELLAR TEMPERATURE',\
                                                single=0)[0][2]),\
                         'R_STAR':float(DataIO.getMCMaxOutput(filename=logfile,\
                                                incr=0,\
                                                keyword='STELLAR RADIUS',\
                                                single=0)[0][2])})
        return star_grid
示例#2
0
 def makeMCMaxStars(self,models):
     
     '''
     Set parameters for star_list taken from the MCMax database.
     
     Based on the model id of MCMax.
     
     @param models: model_ids for the MCMax db
     @type models: list(string)
     @return: The model instances 
     @rtype: list(Star())
     
     '''
     
     star_grid = Star.makeStars(models=models,code='MCMax',id_type='MCMax',\
                                path=self.path)
     for star,model in zip(star_grid,models):    
         filepath = os.path.join(cc.path.mout,'models',\
                                 star['LAST_MCMAX_MODEL'])
         denstemp = os.path.join(filepath,'denstemp.dat')
         logfile = os.path.join(filepath,'log.dat')
         grid_shape = DataIO.getMCMaxOutput(filename=denstemp,incr=1,\
                                            keyword='NGRAINS',single=0)[0]
         star.update({'NTHETA':int(grid_shape[1]),\
                      'NRAD':int(grid_shape[0]),\
                      'T_STAR':float(DataIO.getMCMaxOutput(filename=logfile,\
                                             incr=0,\
                                             keyword='STELLAR TEMPERATURE',\
                                             single=0)[0][2]),\
                      'R_STAR':float(DataIO.getMCMaxOutput(filename=logfile,\
                                             incr=0,\
                                             keyword='STELLAR RADIUS',\
                                             single=0)[0][2])})            
     return star_grid