Exemple #1
0
    def plotTempSpecies(self,star_grid=[],models=[],include_total=1,\
                        power=[1],fn_plt='',cfg=''):
        """ 
        Plotting the temperature stratification of the dust for the species 
        separately, per model.
        
        @keyword star_grid: parameter sets, if [], the parameter
                            sets are determined from the model ids
        
                            (default: [])
        @type star_grid: list[Star()]
        @keyword models: The model_ids, if [], the parameter sets are expected
                         in star_grid
                         
                         (default: [])
        @type models: list[string]
        @keyword include_total: Include the sum of all temperature profiles as 
                                well for comparison. 
                                        
                                (default: 0)
        @type include_total: bool
        @keyword power: A list of values for s in below formula. If [] no power
                        law is included. Power law parameters  are taken from 
                        star_grid[0].
                                
                        See Thesis p32, where power is s in 
                        T(r) = T_eff*(2*r/R_STAR)**(-2/(4+s)).
                
                        (default: [1])
        @type power: list        
        @keyword fn_plt: A plot filename for the tiled plot.
                         
                         (default: '')
        @type fn_plt: string
        @keyword cfg: path to the Plotting2.plotCols config file. If default, 
                      the hard-coded default plotting options are used.
                          
                      (default: '')
        @type cfg: string
                
        """

        print '***********************************'
        print '** Starting to plot dust temperature for separate species.'
        if not star_grid and not models:
            print 'Input is undefined. Aborting.'
            return
        elif not star_grid and models:
            star_grid = self.makeMCMaxStars(models=models, id_type='MCMax')
            raise IOError('Reading dust species temperatures from a model id'+\
                          ' list only, not yet implemented.')
            #- Requires star.dust_list and T_CONTACT to be taken from the log file.
            #- It's possible, but needs some programming
        cfg_dict = Plotting2.readCfg(cfg)
        if cfg_dict.has_key('power'):
            power = cfg_dict['power']
        if cfg_dict.has_key('filename'):
            fn_plt = cfg_dict['filename']
            del cfg_dict['filename']
        else:
            fn_plt = os.path.join(self.pplot, 'Td_species')
        plot_filenames = []
        for star in star_grid:
            if not int(star['T_CONTACT']):
                rads = [
                    star.getDustRad(species=species)
                    for species in star.getDustList()
                ]
                temps = [
                    star.getDustTemperature(species=species)
                    for species in star.getDustList()
                ]
                rads = [
                    r[t <= star['T_DES_%s' % sp]]
                    for r, t, sp in zip(rads, temps, star.getDustList())
                ]
                temps = [
                    t[t <= star['T_DES_%s' % sp]]
                    for t, sp in zip(temps, star.getDustList())
                ]
                keytags = list(star.getDustList())
            else:
                include_total = 1
                print 'Thermal contact is on. All dust species share the ' + \
                      'same temperature profile. Vertical lines indicate ' + \
                      'inner radii of dust species.'
                rads, temps, keytags = [], [], []

            if include_total:
                rad = star.getDustRad()
                temp, key = star.getDustTemperature(add_key=1)
                rads.append(rad[rad>star['R_INNER_DUST']\
                                 *star.Rsun*star['R_STAR']])
                temps.append(temp[rad>star['R_INNER_DUST']\
                                  *star.Rsun*star['R_STAR']])
                keytags.append(key)

            #-- Add power laws if requested
            for s in power:
                rad = star_grid[0].getDustRad(unit='rstar')
                tstar = star_grid[0]['T_STAR']
                temp,key = Profiler.dustTemperaturePowerLaw(rad=rad,add_key=1,\
                                                            tstar=tstar,s=s)
                rads.append(rad)
                temps.append(temp)
                keytags.append(key)

            filename = '_'.join([fn_plt, star['LAST_MCMAX_MODEL']])
            plot_filenames.append(Plotting2.plotCols(x=rads,y=temps,\
                        cfg=cfg_dict,filename=filename,xaxis='$r$ (cm)',\
                        yaxis='$T_\mathrm{d}$ (K)',keytags=keytags,\
                        xmax=star['R_OUTER_DUST']*star.Rsun*star['R_STAR'],\
                        xmin=star['R_STAR']*star.Rsun,fontsize_axis=26,\
                        xlogscale=1,ylogscale=1,fontsize_key=16,\
                        figsize=(12.5,8),transparent=0,linewidth=3,\
                        fontsize_ticklabels=26,\
                        vert_lines=[star['R_INNER_DUST']\
                                        *star.Rsun*star['R_STAR']]))
        if len(plot_filenames) != len(star_grid):
            print 'At least one of the models does not yet have a MCMax model.'
        if plot_filenames[0][-4:] == '.pdf':
            new_filename = fn_plt + '.pdf'
            DataIO.joinPdf(old=plot_filenames, new=new_filename)
            print '** Your plots can be found at:'
            print new_filename
            print '***********************************'
        else:
            print '** Plots can be found at:'
            print '\n'.join(plot_filenames)
            print '***********************************'
Exemple #2
0
 def plotTempSpecies(self,star_grid=[],models=[],include_total=1,\
                     power=[1],fn_plt='',cfg=''):
     
     """ 
     Plotting the temperature stratification of the dust for the species 
     separately, per model.
     
     @keyword star_grid: parameter sets, if [], the parameter
                         sets are determined from the model ids
     
                         (default: [])
     @type star_grid: list[Star()]
     @keyword models: The model_ids, if [], the parameter sets are expected
                      in star_grid
                      
                      (default: [])
     @type models: list[string]
     @keyword include_total: Include the sum of all temperature profiles as 
                             well for comparison. 
                                     
                             (default: 0)
     @type include_total: bool
     @keyword power: A list of values for s in below formula. If [] no power
                     law is included. Power law parameters  are taken from 
                     star_grid[0].
                             
                     See Thesis p32, where power is s in 
                     T(r) = T_eff*(2*r/R_STAR)**(-2/(4+s)).
             
                     (default: [1])
     @type power: list        
     @keyword fn_plt: A plot filename for the tiled plot.
                      
                      (default: '')
     @type fn_plt: string
     @keyword cfg: path to the Plotting2.plotCols config file. If default, 
                   the hard-coded default plotting options are used.
                       
                   (default: '')
     @type cfg: string
             
     """            
     
     print '***********************************'
     print '** Starting to plot dust temperature for separate species.'
     if not star_grid and not models:
         print 'Input is undefined. Aborting.'
         return        
     elif not star_grid and models:
         star_grid = self.makeMCMaxStars(models=models,id_type='MCMax')
         raise IOError('Reading dust species temperatures from a model id'+\
                       ' list only, not yet implemented.')
         #- Requires star.dust_list and T_CONTACT to be taken from the log file. 
         #- It's possible, but needs some programming
     cfg_dict = Plotting2.readCfg(cfg)
     if cfg_dict.has_key('power'):
         power = cfg_dict['power']
     if cfg_dict.has_key('filename'):
         fn_plt = cfg_dict['filename']
         del cfg_dict['filename']    
     else:
         fn_plt = os.path.join(self.pplot,'Td_species')
     plot_filenames = []
     for star in star_grid:
         if not int(star['T_CONTACT']):
             rads = [star.getDustRad(species=species)
                     for species in star.getDustList()]
             temps = [star.getDustTemperature(species=species)
                      for species in star.getDustList()]
             rads = [r[t<=star['T_DES_%s'%sp]] 
                     for r,t,sp in zip(rads,temps,star.getDustList())]
             temps = [t[t<=star['T_DES_%s'%sp]] 
                     for t,sp in zip(temps,star.getDustList())]
             keytags = list(star.getDustList())
         else:
             include_total = 1
             print 'Thermal contact is on. All dust species share the ' + \
                   'same temperature profile. Vertical lines indicate ' + \
                   'inner radii of dust species.'
             rads, temps, keytags = [], [], []
         
         if include_total:
             rad = star.getDustRad()
             temp, key = star.getDustTemperature(add_key=1)
             rads.append(rad[rad>star['R_INNER_DUST']\
                              *star.Rsun*star['R_STAR']])
             temps.append(temp[rad>star['R_INNER_DUST']\
                               *star.Rsun*star['R_STAR']])
             keytags.append(key)
     
         #-- Add power laws if requested
         for s in power:
             rad = star_grid[0].getDustRad(unit='rstar')
             tstar = star_grid[0]['T_STAR']
             temp,key = Profiler.dustTemperaturePowerLaw(rad=rad,add_key=1,\
                                                         tstar=tstar,s=s)
             rads.append(rad)
             temps.append(temp)
             keytags.append(key)
             
         filename = '_'.join([fn_plt,star['LAST_MCMAX_MODEL']])
         plot_filenames.append(Plotting2.plotCols(x=rads,y=temps,\
                     cfg=cfg_dict,filename=filename,xaxis='$r$ (cm)',\
                     yaxis='$T_\mathrm{d}$ (K)',keytags=keytags,\
                     xmax=star['R_OUTER_DUST']*star.Rsun*star['R_STAR'],\
                     xmin=star['R_STAR']*star.Rsun,fontsize_axis=26,\
                     xlogscale=1,ylogscale=1,fontsize_key=16,\
                     figsize=(12.5,8),transparent=0,linewidth=3,\
                     fontsize_ticklabels=26,\
                     vert_lines=[star['R_INNER_DUST']\
                                     *star.Rsun*star['R_STAR']]))
     if len(plot_filenames) != len(star_grid):
         print 'At least one of the models does not yet have a MCMax model.'        
     if plot_filenames[0][-4:] == '.pdf':
         new_filename = fn_plt + '.pdf'
         DataIO.joinPdf(old=plot_filenames,new=new_filename)
         print '** Your plots can be found at:'
         print new_filename
         print '***********************************'
     else:
         print '** Plots can be found at:'
         print '\n'.join(plot_filenames)
         print '***********************************'
Exemple #3
0
    def plotTemp(self, star_grid=[], models=[], power=[1], fn_plt='', cfg=''):
        """ 
        Plotting the temperature stratification of the dust.
        
        All models are shown in one plot.
        
        @keyword star_grid: parameter sets, if [], the parameter
                            sets are determined from the model ids
        
                            (default: [])
        @type star_grid: list[Star()]
        @keyword models: The model_ids, if [], the parameter sets are expected
                         in star_grid
                         
                         (default: [])
        @type models: list[string]
        @keyword power: A list of values for s in below formula. If [] no power
                        law is included. Power law parameters  are taken from 
                        star_grid[0].
                                
                        See Thesis p32, where power is s in 
                        T(r) = T_eff*(2*r/R_STAR)**(-2/(4+s)).
                
                        (default: [1])
        @type power: list        
        @keyword fn_plt: A plot filename for the tiled plot.
                         
                         (default: '')
        @type fn_plt: string
        @keyword cfg: path to the Plotting2.plotCols config file. If default,
                      the hard-coded default plotting options are used.
                          
                      (default: '')
        @type cfg: string
        
        """

        print '***********************************'
        print '** Starting to plot dust temperature stratification.'
        if not star_grid and not models:
            print 'Input is undefined. Aborting.'
            return
        elif not star_grid and models:
            star_grid = self.makeMCMaxStars(models=models)
        cfg_dict = Plotting2.readCfg(cfg)
        if cfg_dict.has_key('power'):
            power = cfg_dict['power']
        if cfg_dict.has_key('filename'):
            fn_plt = cfg_dict['filename']
            del cfg_dict['filename']
        else:
            fn_plt = os.path.join(self.pplot, 'Td_avg')
        rads = []
        temps = []
        keytags = []
        for star in star_grid:
            rad = star.getDustRad()
            temp, key = star.getDustTemperature(add_key=1)
            rads.append(rad)
            temps.append(temp)
            keytags.append(key)

        #-- Add power laws if requested
        for s in power:
            rad = star_grid[0].getDustRad(unit='rstar')
            tstar = star_grid[0]['T_STAR']
            temp,key = Profiler.dustTemperaturePowerLaw(rad=rad,add_key=1,\
                                                        tstar=tstar,s=s)
            rads.append(rad)
            temps.append(temp)
            keytags.append(key)

        title = 'Average Dust Temperature Stratification for %s'\
                %(self.star_name_plots)
        filename = Plotting2.plotCols(x=rads,y=temps,filename=fn_plt,\
                                      yaxis='$T_\mathrm{d}$ (K)',\
                                      plot_title=title,xaxis='$R$ (cm)',\
                                      key_location=(0.05,0.05),cfg=cfg_dict,\
                                      xlogscale=1,ylogscale=1,fontsize_key=20,\
                                      keytags=keytags,fontsize_axis=26,\
                                      figsize=(12.5,8),linewidth=3,\
                                      fontsize_ticklabels=26,)
        print '** Your plots can be found at:'
        print filename
        print '***********************************'
Exemple #4
0
 def plotTemp(self,star_grid=[],models=[],power=[1],fn_plt='',cfg=''):
     
     """ 
     Plotting the temperature stratification of the dust.
     
     All models are shown in one plot.
     
     @keyword star_grid: parameter sets, if [], the parameter
                         sets are determined from the model ids
     
                         (default: [])
     @type star_grid: list[Star()]
     @keyword models: The model_ids, if [], the parameter sets are expected
                      in star_grid
                      
                      (default: [])
     @type models: list[string]
     @keyword power: A list of values for s in below formula. If [] no power
                     law is included. Power law parameters  are taken from 
                     star_grid[0].
                             
                     See Thesis p32, where power is s in 
                     T(r) = T_eff*(2*r/R_STAR)**(-2/(4+s)).
             
                     (default: [1])
     @type power: list        
     @keyword fn_plt: A plot filename for the tiled plot.
                      
                      (default: '')
     @type fn_plt: string
     @keyword cfg: path to the Plotting2.plotCols config file. If default,
                   the hard-coded default plotting options are used.
                       
                   (default: '')
     @type cfg: string
     
     """
     
     print '***********************************'
     print '** Starting to plot dust temperature stratification.'
     if not star_grid and not models:
         print 'Input is undefined. Aborting.'
         return        
     elif not star_grid and models:
         star_grid = self.makeMCMaxStars(models=models)
     cfg_dict = Plotting2.readCfg(cfg)
     if cfg_dict.has_key('power'):
         power = cfg_dict['power']
     if cfg_dict.has_key('filename'):
         fn_plt = cfg_dict['filename']
         del cfg_dict['filename']    
     else:
         fn_plt = os.path.join(self.pplot,'Td_avg')
     rads = []
     temps = []
     keytags = []
     for star in star_grid:
         rad = star.getDustRad()
         temp,key = star.getDustTemperature(add_key=1) 
         rads.append(rad)
         temps.append(temp)
         keytags.append(key)
     
     #-- Add power laws if requested
     for s in power:
         rad = star_grid[0].getDustRad(unit='rstar')
         tstar = star_grid[0]['T_STAR']
         temp,key = Profiler.dustTemperaturePowerLaw(rad=rad,add_key=1,\
                                                     tstar=tstar,s=s)
         rads.append(rad)
         temps.append(temp)
         keytags.append(key)
         
     title = 'Average Dust Temperature Stratification for %s'\
             %(self.star_name_plots)
     filename = Plotting2.plotCols(x=rads,y=temps,filename=fn_plt,\
                                   yaxis='$T_\mathrm{d}$ (K)',\
                                   plot_title=title,xaxis='$R$ (cm)',\
                                   key_location=(0.05,0.05),cfg=cfg_dict,\
                                   xlogscale=1,ylogscale=1,fontsize_key=20,\
                                   keytags=keytags,fontsize_axis=26,\
                                   figsize=(12.5,8),linewidth=3,\
                                   fontsize_ticklabels=26,)
     print '** Your plots can be found at:'
     print filename
     print '***********************************'