def extract_field(state, field='<STR_LIT>'):
es, pp = field.split('<STR_LIT:->')  <EOL>if pp == '<STR_LIT>':<EOL><INDENT>o = state.get('<STR_LIT>')<EOL>if isinstance(o, peri.comp.comp.ComponentCollection):<EOL><INDENT>wts = <NUM_LIT:0>*o.get()[state.inner]<EOL>for c in o.comps:<EOL><INDENT>if isinstance(c, peri.comp.objs.PlatonicSpheresCollection):<EOL><INDENT>wts += c.get()[state.inner]<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>wts = o.get()[state.inner]<EOL><DEDENT><DEDENT>elif pp == '<STR_LIT>':<EOL><INDENT>wts = state.get('<STR_LIT>').get()[state.inner]<EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if es == '<STR_LIT>':<EOL><INDENT>out = (<NUM_LIT:1>-state.data) * (wts > <NUM_LIT>)<EOL><DEDENT>elif es == '<STR_LIT>':<EOL><INDENT>out = wts<EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>return norm(clip(roll(out)))<EOL>
Given a state, extracts a field. Extracted value depends on the value
of field:
    'exp-particles' : The inverted data in the regions of the particles,
            zeros otherwise -- i.e. particles + noise.
    'exp-platonic'  : Same as above, but nonzero in the region of the
            entire platonic image -- i.e. platonic + noise.
    'sim-particles' : Just the particles image; no noise from the data.
    'sim-platonic'  : Just the platonic image; no noise from the data.