def plot_isopattern(self,isos,normiso,spec=None,tpulse='all',dcycle=500,fign=1,deltay=False,logy=False,
                        iniabufile='iniab2.0E-02GN93.ppn',legend=None,plt_symb='o',plt_col='k',plt_lt='-',
                        plt_lw=1.,plt_show=True):
        '''
        This routine plots isotopic pattern plots for different input along with grain data.

        Parameters
        ----------
        isos : list / string
            Enter the list of isotopes that you want to consider here. The list should
            be given in the standard format, e.g., ['Fe-54','Fe-56','Fe-57','Fe-58'] or
            give the element as a string if you want to consider all stable isotopes,
            e.g., 'Fe'
        normiso : string
            Give the isotope all the ratios should be normalized to here, e.g., 'Fe-56'
        spec : string, optional
            What specifications do you want to do when coming from nugridse models. Choose 'surf' for
            surface models or 'exp' for explosions (out files)
        tpulse : string, optional
            In case you have an AGB star, here you decide which thermal pulse to plot. You can choose
            'all' (default) to plot all TPs, 'c' or 'o' for all Carbon (C/O > 1) or all Oxygen
            (C/O < 1) rich, respectively, or 'last' for the last thermal pulse only
        dcycle : integer, optional
            Difference between cycles to take for thermal pulse searching, if searching is
            deactivated, dcycle describes how often cycles are sampled.  The default is 500.
        fign : integer, optional
            Number of the figure
        deltay : boolean, optional
            Do you want to do delta values on y axis or regular ratios?
        logy : boolean, optional
            Y axis logarithmic?
        iniabufile : string, optional
            Initial abundance file. Use absolute path for your file or filename to choose a
            given file in USEEPP. Attention: You need a standard tree checked out from SVN
        legend : string, optional
            Legend for your model / grains. For grains the legend is automatically taken from the
            grain class
        plt_symb : string, optional
            Symbol for the plot. In case of grains, this is handled automatically.
        plt_col : string / float, optional
            Color for plotted curve. In case of grains, this is handled automatically.
        plt_lt : string, optional
            line type for plot.
        plt_lw : float, optional
            Line width for plot.
        plt_show : boolean, optional
            Show plot?
        '''

        from . import utils as u

        ### WORK ON PATH ###
        # define svn path form path where script runs, depending on standard input or not
        if len(iniabufile.split('/')) == 1 :   # means not an absolute path!
            scriptpathtmp = __file__
            if len(scriptpathtmp.split('/')) == 1:   # in folder where nugridse is
                scriptpathtmp = os.path.abspath('.') + '/nugridse.py'   # to get the current dir
            svnpathtmp = '/'
            for i in range(len(scriptpathtmp.split('/'))-3):   # -3 to go to folders up!
                if scriptpathtmp.split('/')[i] != '':
                    svnpathtmp += scriptpathtmp.split('/')[i] + '/'
            iniabufile = svnpathtmp + 'frames/mppnp/USEEPP/' + iniabufile   # make absolute path for iniabufile


        ### make a list of isotopes in case an element is specified and not a list of isotopes ###
        if type(isos) == str:
            tmp = u.iniabu.stable_el
            tmp2 = -1
            for i in range(len(tmp)):
                if isos == tmp[i][0]:
                    tmp2 = tmp[i]
                    break

            if tmp2==-1:
                print('No valid element selected. Abort.')
                return None

            isos_tmp = []
            for i in range(1,len(tmp2)):
                isos_tmp.append([isos + '-' + str(int(tmp2[i])),normiso])
            isos = isos_tmp
            # isos is now a list in the sense of [['Fe-54','Fe-56'],['Fe-56','Fe-56'],...]
        elif type(isos) == list:
            isos_tmp = []
            for i in range(len(isos)):
                isos_tmp.append([isos[i], normiso])
            isos = isos_tmp
        else:
            print('Specify a valid isotope, see docstring.')
            return None

        # make a list with all isotopes just as a list (not the fraction as isos)
        isoslist = []
        for i in range(len(isos)):
            isoslist.append(isos[i][0])

        # find out where normisotope sits
        for i in range(len(isos)):
            if isos[i][0] == isos[i][1]:
                posnorm = i
                break

        ### get solar system ratios for the isotopes that are specified in the input file ###
        inut = u.iniabu(iniabufile)
        ss_rat = []
        for i in range(len(isos)):
            ss_rat.append(inut.isoratio_init(isos[i]))
        # make number ratios
        for i in range(len(isos)):
            ss_rat[i] *= (old_div(float(isos[i][1].split('-')[1]), float(isos[i][0].split('-')[1])))

        ### DO PLOTS FROM NUGRIDSE CLASS ###
        if self._classTest() == 'se':
            if spec==None:
                spec = str(eval(input('Please specify \'surf\' for surface models (AGB stars) or \'exp\' for explosive'
                             'models and zone finding, etc., and press enter: ')))

            ### SURFACE MODELS - PLOT AGB STAR STUFF ###
            if spec == 'surf':
                print('Plotting AGB star stuff')

                # read in thermal pulse position and co ratio
                tp_pos, co_return = self._tp_finder(dcycle)
                tp_pos_tmp = []
                co_return_tmp  = []
                tp_pos_tmp.append(1)
                co_return_tmp.append(co_return[0])
                for i in range(len(tp_pos)):
                    tp_pos_tmp.append(tp_pos[i])
                    co_return_tmp.append(co_return[i])
                tp_pos = tp_pos_tmp
                co_return = co_return_tmp

                # read in data
                iso_alldata = self.get(tp_pos,isoslist)
                norm_isotope = np.zeros(len(iso_alldata))
                for i in range(len(iso_alldata)):
                    norm_isotope[i] = iso_alldata[i][posnorm]
                # now make ratios iso_ratios out of iso_alldata
                iso_ratios = np.zeros((len(iso_alldata),len(iso_alldata[0])))
                for i in range(len(iso_ratios)):
                    for j in range(len(iso_ratios[i])):
                        iso_ratios[i][j] = old_div(iso_alldata[i][j], norm_isotope[i])

                # make number ratios
                for i in range(len(iso_ratios)):
                    for j in range(len(iso_ratios[i])):
                        iso_ratios[i][j] *= old_div(float(isos[j][1].split('-')[1]), float(isos[j][0].split('-')[1]))

                # if delta values are requested, need to calculate those now
                if deltay:
                    for i in range(len(iso_ratios)):
                        for j in range(len(iso_ratios[i])):
                            iso_ratios[i][j] = (old_div(iso_ratios[i][j], ss_rat[j]) - 1.) * 1000.

                ### now prepare data to plot ###

                 # make style list
                style = []

                if tpulse == 'last':
                    ydata = [iso_ratios[len(iso_ratios)-1]]
                    style = [[plt_symb + plt_lt,  plt_col, plt_col, '7.', '1', legend]]
                elif tpulse == 'o':
                    ydata = []
                    style = []
                    for i in range(len(co_return)):
                        if co_return[i] < 1:
                            ydata.append(iso_ratios[i])
                            style.append([plt_symb + plt_lt,  plt_col, plt_col, '7.', '1', legend])
                    if ydata == []:
                        print('No O rich thermal pulses found.')
                        return None
                else:   # this means carbon rich, either only or all, but make marker size first
                    msizelst = []   # marker size list for all subsequent ones
                    crich_list = []
                    for i in range(len(co_return)):
                        if co_return[i] >= 1:
                            crich_list.append(co_return[i])
                    crich_max = np.max(crich_list)
                    crich_min = np.min(crich_list)
                    slope_tmp = old_div(9., (crich_max-crich_min))
                    b_tmp = 3. - slope_tmp * crich_min
                    for i in range(len(crich_list)):
                        msizelst.append(crich_list[i] * slope_tmp + b_tmp)
                    # make ydata and style
                    ydata = []
                    style = []
                    j=0
                    for i in range(len(co_return)):
                        if co_return[i] < 1.:
                            j += 1
                            if tpulse == 'all':
                                ydata.append(iso_ratios[i])
                                style.append([plt_symb + '--', plt_col, plt_col, 1., 1., None])
                        else:
                            ydata.append(iso_ratios[i])
                            style.append([plt_symb + plt_lt, plt_col, plt_col, msizelst[i-j], 1., legend])

            ### EXPLOSIVE MODELS ###
            elif spec=='exp':
                print('Explosive models not yet implemented... sorry')
                return None
            else:
                print('You did not specify a useful spec argument -> abort.')
                return None

        ###### PLOT ######

        ### make ratios for data to plot, first find where the normiso sits ###
        # make x axis vector
        xdata = []
        for i in range(len(isos)):
            xdata.append(int(isos[i][0].split('-')[1]))

        # Size of font etc.
        params = {'axes.labelsize':  20,
                  'text.fontsize':   14,
                  'legend.fontsize': 14,
                  'xtick.labelsize': 14,
                  'ytick.labelsize': 14}
        pl.rcParams.update(params)

        # plot
        pl.figure(fign)
        for i in range(len(ydata)):
            pl.plot(xdata,ydata[i],style[i][0],c=style[i][1],mfc=style[i][2],ms=float(style[i][3]),
                    label=style[i][5],linewidth=plt_lw,mew=float(style[i][4]))

        # limits and x axis scale and handling
        pl.xlim([xdata[0]-0.5,xdata[len(xdata)-1]+0.5])

        # labels and axis scaling
        pl.xlabel('Mass number')
        if deltay:
            pl.ylabel('$\delta (^i$' + normiso.split('-')[0] + ' / solar)')
        else:
            pl.ylabel('$^{i}$'+ normiso.split('-')[0] + ' / solar')

        # borders of plot
        pl.gcf().subplots_adjust(bottom=0.15)
        pl.gcf().subplots_adjust(left=0.15)

        # log
        if logy:
            pl.semilogy()

        if plt_show:
            pl.show()
def plot_isopattern ( self , isos , normiso , spec = None , tpulse = 'all' , dcycle = 500 , fign = 1 , deltay = False , logy = False , iniabufile = 'iniab2.0E-02GN93.ppn' , legend = None , plt_symb = 'o' , plt_col = 'k' , plt_lt = '-' , plt_lw = 1. , plt_show = True ) : from . import utils as u if len ( iniabufile . split ( '/' ) ) == 1 : scriptpathtmp = __file__ if len ( scriptpathtmp . split ( '/' ) ) == 1 : scriptpathtmp = os . path . abspath ( '.' ) + '/nugridse.py' svnpathtmp = '/' for i in range ( len ( scriptpathtmp . split ( '/' ) ) - 3 ) : if scriptpathtmp . split ( '/' ) [ i ] != '' : svnpathtmp += scriptpathtmp . split ( '/' ) [ i ] + '/' iniabufile = svnpathtmp + 'frames/mppnp/USEEPP/' + iniabufile if type ( isos ) == str : tmp = u . iniabu . stable_el tmp2 = - 1 for i in range ( len ( tmp ) ) : if isos == tmp [ i ] [ 0 ] : tmp2 = tmp [ i ] break if tmp2 == - 1 : print ( 'No valid element selected. Abort.' ) return None isos_tmp = [ ] for i in range ( 1 , len ( tmp2 ) ) : isos_tmp . append ( [ isos + '-' + str ( int ( tmp2 [ i ] ) ) , normiso ] ) isos = isos_tmp elif type ( isos ) == list : isos_tmp = [ ] for i in range ( len ( isos ) ) : isos_tmp . append ( [ isos [ i ] , normiso ] ) isos = isos_tmp else : print ( 'Specify a valid isotope, see docstring.' ) return None isoslist = [ ] for i in range ( len ( isos ) ) : isoslist . append ( isos [ i ] [ 0 ] ) for i in range ( len ( isos ) ) : if isos [ i ] [ 0 ] == isos [ i ] [ 1 ] : posnorm = i break inut = u . iniabu ( iniabufile ) ss_rat = [ ] for i in range ( len ( isos ) ) : ss_rat . append ( inut . isoratio_init ( isos [ i ] ) ) for i in range ( len ( isos ) ) : ss_rat [ i ] *= ( old_div ( float ( isos [ i ] [ 1 ] . split ( '-' ) [ 1 ] ) , float ( isos [ i ] [ 0 ] . split ( '-' ) [ 1 ] ) ) ) if self . _classTest ( ) == 'se' : if spec == None : spec = str ( eval ( input ( 'Please specify \'surf\' for surface models (AGB stars) or \'exp\' for explosive' 'models and zone finding, etc., and press enter: ' ) ) ) if spec == 'surf' : print ( 'Plotting AGB star stuff' ) tp_pos , co_return = self . _tp_finder ( dcycle ) tp_pos_tmp = [ ] co_return_tmp = [ ] tp_pos_tmp . append ( 1 ) co_return_tmp . append ( co_return [ 0 ] ) for i in range ( len ( tp_pos ) ) : tp_pos_tmp . append ( tp_pos [ i ] ) co_return_tmp . append ( co_return [ i ] ) tp_pos = tp_pos_tmp co_return = co_return_tmp iso_alldata = self . get ( tp_pos , isoslist ) norm_isotope = np . zeros ( len ( iso_alldata ) ) for i in range ( len ( iso_alldata ) ) : norm_isotope [ i ] = iso_alldata [ i ] [ posnorm ] iso_ratios = np . zeros ( ( len ( iso_alldata ) , len ( iso_alldata [ 0 ] ) ) ) for i in range ( len ( iso_ratios ) ) : for j in range ( len ( iso_ratios [ i ] ) ) : iso_ratios [ i ] [ j ] = old_div ( iso_alldata [ i ] [ j ] , norm_isotope [ i ] ) for i in range ( len ( iso_ratios ) ) : for j in range ( len ( iso_ratios [ i ] ) ) : iso_ratios [ i ] [ j ] *= old_div ( float ( isos [ j ] [ 1 ] . split ( '-' ) [ 1 ] ) , float ( isos [ j ] [ 0 ] . split ( '-' ) [ 1 ] ) ) if deltay : for i in range ( len ( iso_ratios ) ) : for j in range ( len ( iso_ratios [ i ] ) ) : iso_ratios [ i ] [ j ] = ( old_div ( iso_ratios [ i ] [ j ] , ss_rat [ j ] ) - 1. ) * 1000. style = [ ] if tpulse == 'last' : ydata = [ iso_ratios [ len ( iso_ratios ) - 1 ] ] style = [ [ plt_symb + plt_lt , plt_col , plt_col , '7.' , '1' , legend ] ] elif tpulse == 'o' : ydata = [ ] style = [ ] for i in range ( len ( co_return ) ) : if co_return [ i ] < 1 : ydata . append ( iso_ratios [ i ] ) style . append ( [ plt_symb + plt_lt , plt_col , plt_col , '7.' , '1' , legend ] ) if ydata == [ ] : print ( 'No O rich thermal pulses found.' ) return None else : msizelst = [ ] crich_list = [ ] for i in range ( len ( co_return ) ) : if co_return [ i ] >= 1 : crich_list . append ( co_return [ i ] ) crich_max = np . max ( crich_list ) crich_min = np . min ( crich_list ) slope_tmp = old_div ( 9. , ( crich_max - crich_min ) ) b_tmp = 3. - slope_tmp * crich_min for i in range ( len ( crich_list ) ) : msizelst . append ( crich_list [ i ] * slope_tmp + b_tmp ) ydata = [ ] style = [ ] j = 0 for i in range ( len ( co_return ) ) : if co_return [ i ] < 1. : j += 1 if tpulse == 'all' : ydata . append ( iso_ratios [ i ] ) style . append ( [ plt_symb + '--' , plt_col , plt_col , 1. , 1. , None ] ) else : ydata . append ( iso_ratios [ i ] ) style . append ( [ plt_symb + plt_lt , plt_col , plt_col , msizelst [ i - j ] , 1. , legend ] ) elif spec == 'exp' : print ( 'Explosive models not yet implemented... sorry' ) return None else : print ( 'You did not specify a useful spec argument -> abort.' ) return None xdata = [ ] for i in range ( len ( isos ) ) : xdata . append ( int ( isos [ i ] [ 0 ] . split ( '-' ) [ 1 ] ) ) params = { 'axes.labelsize' : 20 , 'text.fontsize' : 14 , 'legend.fontsize' : 14 , 'xtick.labelsize' : 14 , 'ytick.labelsize' : 14 } pl . rcParams . update ( params ) pl . figure ( fign ) for i in range ( len ( ydata ) ) : pl . plot ( xdata , ydata [ i ] , style [ i ] [ 0 ] , c = style [ i ] [ 1 ] , mfc = style [ i ] [ 2 ] , ms = float ( style [ i ] [ 3 ] ) , label = style [ i ] [ 5 ] , linewidth = plt_lw , mew = float ( style [ i ] [ 4 ] ) ) pl . xlim ( [ xdata [ 0 ] - 0.5 , xdata [ len ( xdata ) - 1 ] + 0.5 ] ) pl . xlabel ( 'Mass number' ) if deltay : pl . ylabel ( '$\delta (^i$' + normiso . split ( '-' ) [ 0 ] + ' / solar)' ) else : pl . ylabel ( '$^{i}$' + normiso . split ( '-' ) [ 0 ] + ' / solar' ) pl . gcf ( ) . subplots_adjust ( bottom = 0.15 ) pl . gcf ( ) . subplots_adjust ( left = 0.15 ) if logy : pl . semilogy ( ) if plt_show : pl . show ( )
This routine plots isotopic pattern plots for different input along with grain data.

        Parameters
        ----------
        isos : list / string
            Enter the list of isotopes that you want to consider here. The list should
            be given in the standard format, e.g., ['Fe-54','Fe-56','Fe-57','Fe-58'] or
            give the element as a string if you want to consider all stable isotopes,
            e.g., 'Fe'
        normiso : string
            Give the isotope all the ratios should be normalized to here, e.g., 'Fe-56'
        spec : string, optional
            What specifications do you want to do when coming from nugridse models. Choose 'surf' for
            surface models or 'exp' for explosions (out files)
        tpulse : string, optional
            In case you have an AGB star, here you decide which thermal pulse to plot. You can choose
            'all' (default) to plot all TPs, 'c' or 'o' for all Carbon (C/O > 1) or all Oxygen
            (C/O < 1) rich, respectively, or 'last' for the last thermal pulse only
        dcycle : integer, optional
            Difference between cycles to take for thermal pulse searching, if searching is
            deactivated, dcycle describes how often cycles are sampled.  The default is 500.
        fign : integer, optional
            Number of the figure
        deltay : boolean, optional
            Do you want to do delta values on y axis or regular ratios?
        logy : boolean, optional
            Y axis logarithmic?
        iniabufile : string, optional
            Initial abundance file. Use absolute path for your file or filename to choose a
            given file in USEEPP. Attention: You need a standard tree checked out from SVN
        legend : string, optional
            Legend for your model / grains. For grains the legend is automatically taken from the
            grain class
        plt_symb : string, optional
            Symbol for the plot. In case of grains, this is handled automatically.
        plt_col : string / float, optional
            Color for plotted curve. In case of grains, this is handled automatically.
        plt_lt : string, optional
            line type for plot.
        plt_lw : float, optional
            Line width for plot.
        plt_show : boolean, optional
            Show plot?