Example #1
0
def fretfec(p, stylefec='-', stylefret='o:', axes=(), fec_opts={}, fret_opts={}):
  if any(axes):
    axfret,axforce = axes
  else:
    axfret, axforce = twinxaxis()
  fret,ext = to_fret_ext(p)
  plt.hold(True)
  fec_opts.setdefault('axes', axforce)
  setdefaults(fret_opts, **fretfec.fret_opts)
  setdefaults(fec_opts, **fretfec.fec_opts)
  fec(p, stylefec, **fec_opts)
  axfret.plot(ext, fret, stylefret, **fret_opts)
  plt.xlabel('Extension (nm)')
  plt.ylabel('FRET efficiency')
  axforce.autoscale_view(tight=True)
  return axfret, axforce
Example #2
0
def segmented(p,
              stylefec='-',
              stylefret='o:',
              every=1,
              boundaries=[],
              colors=[],
              axes=(),
              exps=[],
              **options):
    axfret, axforce = axes if any(axes) else subplots(2)
    stylefret = stylefret or stylefec
    linewidth = options.pop('linewidth', 3)
    ratio = p['sampling_ratio']
    trap = p.trap
    fret, ext = to_fret_ext(p)
    plt.hold(True)
    for x in exps:
        axforce.plot(x.trap.ext, x.trap.f, 'k:', lw=1.5)
    for start_n in range(len(fret)):
        if start_n == 0 or start_n in boundaries or (not boundaries
                                                     and start_n % every == 0):
            color = colors.pop(0) if colors else next_color_in_cycle()
        fret_segment = fret[start_n:start_n + 2]
        ext_segment = ext[start_n:start_n + 2]
        axfret.plot(ext_segment,
                    fret_segment,
                    stylefret,
                    color=color,
                    markeredgewidth=0,
                    **options)
        fecext, fecf = trap[start_n * ratio:(start_n + 1) * ratio + 1].fec
        axforce.plot(fecext,
                     fecf,
                     stylefec,
                     color=color,
                     markeredgewidth=0,
                     lw=linewidth,
                     **options)
    axfret.set_ylim(-0.05, 1.05)
    axforce.autoscale_view(tight=True)
    axfret.set_xlim(axforce.get_xlim())
    axforce.set_ylabel('Force (pN)')
    axfret.set_ylabel('FRET efficiency')
    axfret.set_xlabel('Extension (nm)')
Example #3
0
def fretfec(p,
            stylefec='-',
            stylefret='o:',
            axes=(),
            fec_opts={},
            fret_opts={}):
    if any(axes):
        axfret, axforce = axes
    else:
        axfret, axforce = twinxaxis()
    fret, ext = to_fret_ext(p)
    plt.hold(True)
    fec_opts.setdefault('axes', axforce)
    setdefaults(fret_opts, **fretfec.fret_opts)
    setdefaults(fec_opts, **fretfec.fec_opts)
    fec(p, stylefec, **fec_opts)
    axfret.plot(ext, fret, stylefret, **fret_opts)
    plt.xlabel('Extension (nm)')
    plt.ylabel('FRET efficiency')
    axforce.autoscale_view(tight=True)
    return axfret, axforce
Example #4
0
def segmented(p, stylefec='-', stylefret='o:', every=1, boundaries=[], colors=[], axes=(), exps=[], **options):
  axfret, axforce = axes if any(axes) else subplots(2)
  stylefret=stylefret or stylefec
  linewidth = options.pop('linewidth', 3)
  ratio = p['sampling_ratio']
  trap = p.trap
  fret, ext = to_fret_ext(p)
  plt.hold(True)
  for x in exps:
    axforce.plot(x.trap.ext, x.trap.f, 'k:', lw=1.5)
  for start_n in range(len(fret)):
    if start_n == 0 or start_n in boundaries or (not boundaries and start_n%every==0):
      color = colors.pop(0) if colors else next_color_in_cycle()
    fret_segment = fret[start_n:start_n+2]
    ext_segment = ext[start_n:start_n+2]
    axfret.plot(ext_segment, fret_segment, stylefret, color=color, markeredgewidth=0, **options)
    fecext,fecf = trap[start_n*ratio:(start_n+1)*ratio+1].fec
    axforce.plot(fecext, fecf, stylefec, color=color, markeredgewidth=0, lw=linewidth, **options)
  axfret.set_ylim(-0.05,1.05)
  axforce.autoscale_view(tight=True)
  axfret.set_xlim(axforce.get_xlim())
  axforce.set_ylabel('Force (pN)')
  axfret.set_ylabel('FRET efficiency')
  axfret.set_xlabel('Extension (nm)')