def __init__(self, sldir='<STR_LIT>', num=<NUM_LIT:1>, num_type='<STR_LIT>',<EOL>prof_ind_name='<STR_LIT>',<EOL>profile_prefix='<STR_LIT>', data_suffix='<STR_LIT>', mass=None,<EOL>Z=None,give_filename=None,data_set='<STR_LIT>'):
self.prof_ind_name = prof_ind_name<EOL>self.sldir         = sldir<EOL>if mass is not None and Z is not None:<EOL><INDENT>try:<EOL><INDENT>print('<STR_LIT>'+nugrid_path)<EOL><DEDENT>except:<EOL><INDENT>raise IOError("<STR_LIT>")<EOL><DEDENT>if (data_set=='<STR_LIT>'):<EOL><INDENT>setsZs=[<NUM_LIT>,<NUM_LIT>,<NUM_LIT>,<NUM_LIT>,<NUM_LIT>]<EOL>setsnames=['<STR_LIT>','<STR_LIT>','<STR_LIT>','<STR_LIT>','<STR_LIT>']<EOL><DEDENT>elif (data_set=='<STR_LIT>'):<EOL><INDENT>setsZs=[<NUM_LIT>,<NUM_LIT>]<EOL>setsnames=['<STR_LIT>','<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>raise IOError("<STR_LIT>")                  <EOL><DEDENT>idx=np.abs(np.array(setsZs)-Z).argmin()<EOL>setname=setsnames[idx]<EOL>realZ=setsZs[idx]<EOL>print('<STR_LIT>'+setname+'<STR_LIT>'+str(realZ)+'<STR_LIT:)>')<EOL>mod_dir = nugrid_path+'<STR_LIT>'+data_set+'<STR_LIT:/>'+setname+'<STR_LIT>'<EOL>if not os.path.exists(mod_dir):<EOL><INDENT>print('<STR_LIT>', mod_dir)<EOL>raise IOError("<STR_LIT>")<EOL><DEDENT>list=[el for el in os.listdir(mod_dir) if el[<NUM_LIT:0>]=='<STR_LIT:M>']<EOL>if len(list) == <NUM_LIT:0>:<EOL><INDENT>raise IOError("<STR_LIT>"+mod_dir)<EOL><DEDENT>setmasses=[el[<NUM_LIT:1>:el.index('<STR_LIT>')] for el in list]<EOL>for i in range(len(setmasses)):<EOL><INDENT>if setmasses[i][-<NUM_LIT:1>]=='<STR_LIT:.>': setmasses[i]=setmasses[i][:-<NUM_LIT:1>]<EOL>setmasses[i] = float(setmasses[i])<EOL><DEDENT>idx2=np.abs(np.array(setmasses)-mass).argmin()<EOL>modname=list[idx2]<EOL>realmass=setmasses[idx2]<EOL>print('<STR_LIT>'+str(realmass))<EOL>mod_dir+=modname<EOL>if '<STR_LIT>' not in os.listdir(mod_dir):<EOL><INDENT>raise IOError("<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>self.sldir=mod_dir+'<STR_LIT>'<EOL>sldir = mod_dir+'<STR_LIT>'<EOL><DEDENT><DEDENT>if give_filename is not None and num_type is not '<STR_LIT>':<EOL><INDENT>raise KeyError("<STR_LIT>")<EOL><DEDENT>if num_type is '<STR_LIT>' or num_type is '<STR_LIT>':<EOL><INDENT>self._profiles_index()<EOL><DEDENT>if num_type is '<STR_LIT>':<EOL><INDENT>amods=array(self.model)<EOL>if amods[<NUM_LIT:0>]>num:<EOL><INDENT>num = amods[<NUM_LIT:0>]  <EOL><DEDENT>elif amods[-<NUM_LIT:1>]<num:<EOL><INDENT>num = amods[-<NUM_LIT:1>]<EOL><DEDENT>else:<EOL><INDENT>nearmods=[where(amods<=num)[<NUM_LIT:0>][-<NUM_LIT:1>],where(amods>=num)[<NUM_LIT:0>][<NUM_LIT:0>]]<EOL>sometable={}<EOL>for thing in nearmods:<EOL><INDENT>sometable[abs(self.model[thing]-num)]=thing<EOL><DEDENT>nearest = min(abs(self.model[nearmods[<NUM_LIT:0>]]-num),abs(self.model[nearmods[<NUM_LIT:1>]]-num))<EOL>num = self.model[sometable[nearest]]<EOL><DEDENT>print('<STR_LIT>'+str(num))<EOL>num_type = '<STR_LIT>'<EOL><DEDENT>if num_type is '<STR_LIT>':<EOL><INDENT>try:<EOL><INDENT>log_num=self.log_ind[num]<EOL><DEDENT>except KeyError:<EOL><INDENT>print('<STR_LIT>')<EOL>print("<STR_LIT>")<EOL>return<EOL><DEDENT><DEDENT>elif num_type is '<STR_LIT>':<EOL><INDENT>log_num=self._log_file_ind(num)<EOL>if log_num == -<NUM_LIT:1>:<EOL><INDENT>print("<STR_LIT>")<EOL>return<EOL><DEDENT><DEDENT>elif num_type is '<STR_LIT>':<EOL><INDENT>log_num = num<EOL><DEDENT>elif num_type is '<STR_LIT>':<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>print('<STR_LIT>')<EOL>return<EOL><DEDENT>if num_type is '<STR_LIT>':<EOL><INDENT>filename = sldir+'<STR_LIT:/>'+give_filename<EOL>if not os.path.exists(filename):<EOL><INDENT>print('<STR_LIT>'+give_filename+'<STR_LIT>'+sldir)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>filename=self.sldir+'<STR_LIT:/>'+profile_prefix+str(log_num)+data_suffix<EOL>if not os.path.exists(filename):<EOL><INDENT>profile_prefix='<STR_LIT>'<EOL>filename=self.sldir+'<STR_LIT:/>'+profile_prefix+str(log_num)+data_suffix<EOL>if not os.path.exists(filename):<EOL><INDENT>print('<STR_LIT>'+sldir)<EOL>print('<STR_LIT>'+sldir)<EOL><DEDENT><DEDENT><DEDENT>print('<STR_LIT>'+filename+'<STR_LIT>')<EOL>header_attr = _read_mesafile(filename,only='<STR_LIT>')<EOL>num_zones=int(header_attr['<STR_LIT>'])<EOL>header_attr,cols,data = _read_mesafile(filename,data_rows=num_zones,only='<STR_LIT:all>')<EOL>self.cols        = cols<EOL>self.header_attr = header_attr<EOL>self.data        = data<EOL>
read a profile.data profile file

Parameters
----------
sldir : string
    Directory path of LOGS.
num : integer
    by default this is the i.  profile file (profile.data or
    log.data) available (e.g. num=1 is the 1. available profile
    file), however if you give
num_type : string, optional
    If 'model' (exact) or 'nearest_model': get the profile
    profile.data file for model (or cycle number) used by the
    stellar evolution code

    If 'profile_num': num will be interpreted as the
    profile.data or log.data number profile_num (profile_num is
    the number that appears in the file names of type
    profile23.data or log23.data)

    If 'profiles_i': the ith file in profiles.index file

    If 'explicit': the exact file path of the profile file
    should be given in the variable give_filename.

    The default is "nearest_model".
prof_ind_name : string, optional
    Use this optional argument if the profiles.index file has
    an alternative name, for example, do
    superpro=ms.profile('LOGS',1,prof_ind_name='super.prof')
profile_prefix : string, optional
    Prifix in the profile name.  The default is "profile".
data_suffix : string, optional
    Optional arguments that allow you to change the defaults
    for the profile.data profile files.
mass : integer or float, optional
    The user may select a mass and metallicity instead of providing
    the sldir explicitly, if they are using the VOSpace data. If mass
    is provided then Z should also be provided.
    The default is None (i.e. user gives sldir explicitly)
Z : float, optional
    See 'mass' above.
    The default is None (i.e. user gives sldir explicitly)

Examples
--------
initialise a mesa_profile instance for cycle 2000 like this:

>>>my_profile1=ms.mesa_profile('LOGS',2000)

or like this:

>>>my_profile2=ms.mesa_profile(mass=2,Z=0.01,num=2000)