@classmethod<EOL><INDENT>def from_ini(cls, ic, folder='<STR_LIT:.>', ini_file='<STR_LIT>', **kwargs):<DEDENT>
if not os.path.isabs(ini_file):<EOL><INDENT>ini_file = os.path.join(folder,ini_file)<EOL><DEDENT>bands = cls.get_bands(ini_file)<EOL>if not isinstance(ic, Isochrone):<EOL><INDENT>ic = get_ichrone(ic, bands)<EOL><DEDENT>logging.debug('<STR_LIT>'.format(ini_file))<EOL>c = configobj.ConfigObj(ini_file)<EOL>RA = c.get('<STR_LIT>')<EOL>dec = c.get('<STR_LIT>')<EOL>maxAV = c.get('<STR_LIT>')<EOL>if len(c.sections) == <NUM_LIT:0>:<EOL><INDENT>for k in c:<EOL><INDENT>kwargs[k] = _parse_config_value(c[k])<EOL><DEDENT>obs = None<EOL><DEDENT>else:<EOL><INDENT>columns = ['<STR_LIT:name>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>']<EOL>df = pd.DataFrame(columns=columns)<EOL>i = <NUM_LIT:0><EOL>for k in c:<EOL><INDENT>if type(c[k]) != configobj.Section:<EOL><INDENT>kwargs[k] = _parse_config_value(c[k])<EOL><DEDENT>else:<EOL><INDENT>instrument = k<EOL>if '<STR_LIT>' in c[k]:<EOL><INDENT>resolution = float(c[k]['<STR_LIT>'])<EOL>relative = True<EOL><DEDENT>else:<EOL><INDENT>resolution = <NUM_LIT> <EOL>relative = False<EOL><DEDENT>if '<STR_LIT>' in c[k]:<EOL><INDENT>relative = c[k]['<STR_LIT>']=='<STR_LIT:True>'<EOL><DEDENT>multiple = False<EOL>tags = []<EOL>bands = []<EOL>for label in c[k]:<EOL><INDENT>m = re.search('<STR_LIT>', label)<EOL>if m:<EOL><INDENT>multiple = True<EOL>if m.group(<NUM_LIT:1>) is not None:<EOL><INDENT>if m.group(<NUM_LIT:1>) not in tags:<EOL><INDENT>tags.append(m.group(<NUM_LIT:1>))<EOL><DEDENT><DEDENT><DEDENT>elif re.search('<STR_LIT>', label) or re.search('<STR_LIT:id>', label) orlabel in ['<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>continue<EOL><DEDENT>else:<EOL><INDENT>m = re.search('<STR_LIT>', label)<EOL>b = m.group(<NUM_LIT:1>)<EOL>if b not in bands:<EOL><INDENT>bands.append(b)<EOL><DEDENT><DEDENT><DEDENT>if len(bands) > <NUM_LIT:0> and (len(tags)==<NUM_LIT:0> or bands[<NUM_LIT:0>] in c[k]):<EOL><INDENT>tags.append('<STR_LIT>')<EOL><DEDENT>for b in bands:<EOL><INDENT>for tag in tags:<EOL><INDENT>if '<STR_LIT>'.format(b, tag) not in c[k]:<EOL><INDENT>continue<EOL><DEDENT>row = {}<EOL>row['<STR_LIT:name>'] = instrument<EOL>row['<STR_LIT>'] = b<EOL>row['<STR_LIT>'] = resolution<EOL>row['<STR_LIT>'] = relative<EOL>if '<STR_LIT>'.format(tag) in c[k]:<EOL><INDENT>row['<STR_LIT>'] = c[k]['<STR_LIT>'.format(tag)]<EOL>row['<STR_LIT>'] = c[k]['<STR_LIT>'.format(tag)]<EOL><DEDENT>else:<EOL><INDENT>row['<STR_LIT>'] = <NUM_LIT:0.><EOL>row['<STR_LIT>'] = <NUM_LIT:0.><EOL><DEDENT>mag, e_mag = c[k]['<STR_LIT>'.format(b,tag)]<EOL>row['<STR_LIT>'] = float(mag)<EOL>row['<STR_LIT>'] = float(e_mag)<EOL>if not np.isnan(row['<STR_LIT>']) and not np.isnan(row['<STR_LIT>']):<EOL><INDENT>df = df.append(pd.DataFrame(row, index=[i]))<EOL>i += <NUM_LIT:1><EOL><DEDENT><DEDENT>if relative:<EOL><INDENT>row = {}<EOL>row['<STR_LIT:name>'] = instrument<EOL>row['<STR_LIT>'] = b<EOL>row['<STR_LIT>'] = resolution<EOL>row['<STR_LIT>'] = relative<EOL>row['<STR_LIT>'] = <NUM_LIT:0.><EOL>row['<STR_LIT>'] = <NUM_LIT:0.><EOL>row['<STR_LIT>'] = <NUM_LIT:0.><EOL>row['<STR_LIT>'] = <NUM_LIT><EOL>df = df.append(pd.DataFrame(row, index=[i]))<EOL>i += <NUM_LIT:1><EOL><DEDENT><DEDENT><DEDENT><DEDENT>obs = ObservationTree.from_df(df)<EOL><DEDENT>if '<STR_LIT>' in c:<EOL><INDENT>obs = c['<STR_LIT>']<EOL><DEDENT>logging.debug('<STR_LIT>'.format(obs))<EOL>if '<STR_LIT:name>' not in kwargs:<EOL><INDENT>kwargs['<STR_LIT:name>'] = os.path.basename(folder)<EOL><DEDENT>new = StarModel(ic, obs=obs, **kwargs)<EOL>new._directory = os.path.abspath(folder)<EOL>return new<EOL>
Initialize a StarModel from a .ini file

The "classic" format (version <= 0.9) should still work for a single star,
where all properties are just listed in the file; e.g.,

    J = 10, 0.05
    H = 9.5, 0.05
    K = 9.0, 0.05
    Teff = 5000, 150

If there are multiple stars observed, you can either define them in
the ini file, or use the `obsfile` keyword, pointing to a file with
the summarized photometric observations.  In this case, spectroscopic/parallax
info should still be included in the .ini file; e.g.,

    obsfile = obs.csv
    Teff = 5000, 150

The obsfile should be a comma-separated table with the following columns:
`[name, band, resolution, mag, e_mag, separation, pa, relative]`.

  * `name` is the name of instrument
  * `band` is the photometric bandpass
  * `resolution` is the approximate spatial resolution of instrument
  * `mag`, `e_mag` describe magnitude of source (absolute or relative)
  * `separation`, `pa` describe position of source
  * `relative`: single-bit flag; if 1 then magnitudes taken with this
    instrument are assumed to be relative rather than absolute.

If an obsfile is not provided, you can also define all the same information
in the ini file, following these rules:

  * Every instrument/survey gets its own [section].  Sections are only
created for different photometric observations.

  * if photometry relates to *all* stars in aperture,
    there is no extra info in the section, just the photometry.  In this case, it is
    also assumed that the photometry is absolute. (`relative=False`)

  * If 'resolution' is an attribute under a particular survey section (and
'relative' is not explicitly stated), then the survey is assumed to have relative
photometry, and to be listing
information about companion stars.  In this case, there must be "separation"
and "PA" included for each companion.  If there is more than one companion star,
they must be identifed by tag, e.g., separation_1, PA_1, Ks_1, J_1, etc.  The
tag can be anything alphanumeric, but it must be consistent within a particular
section (instrument).  If there
is no tag, there is assumed to be only one companion detected.

  * If there are no sections, then bands will be interpreted at face value
and will all be assumed to apply to all stars modeled.

  * Default is to model each star in the highest-resolution observation as a
single star, at the same distance/age/feh/AV.


The `N` and `index`
parameters may also be provided, to specify the relations between the
model stars.  If these are not provided, then `N` will default to `1`
(one model star per star observed in highest-resolution observation)
and `index` will default to all `0` (all stars physically associated).