Giter Site home page Giter Site logo

smbanalyze's Introduction

smbanalyze

Load the package:

from matplotlib.pyplot import *
from smbanalyze import *

New Features

Save or load an experiment:

pull = experiment.Pulling.load('filename.exp')
pull.save('filename2.exp')

Experiment Workflow

Tips

  1. Use generically named yet descriptive variables to allow for some automation with IPython macros.

  2. The new experiment.List collection object has some useful features demonstrated below. We will continue to add features to make manipulating multiple experiments easier. Requests welcome!

Example

pulls = experiment.fromMatch('SJ2UL')
mol = pulls.matching('s1m1')

hstart = 850  # extension to start fit
hend = 9      # force to stop fit
p = mol.next() # Imagine this is line [3] in IPython

# For now, simply print this force offset
mean( p.fec.force[10:20] )
p.fitHandles(hstart, hend)
p.plot()

# make a macro of previous
macro fitp 4-6
macro nextp 3

rstart = 1000
rend = 15
p.fitRip(rstart, rend) # line [11]

# Optional. Now just adjust rstart as needed before running this macro
macro fitrip 11

nextp
fitp
rstart = 1010
fitrip

Advanced Usage

Process images using give roi file and background in the current directory:

fcalc.processMatch('SJF4', roi='roi.txt', background='SJF_background.img')

Remember, in IPython, you can change directories with cd and list contents with ls.

Load a pulling data:

pull = experiment.fromFile('SJF4_s1m1_4')
pull.plot()

# or from multiple files
pulls = experiment.fromMatch('SJF4', 's1m1')
for a_pull in pulls:
  figure()
  a_pull.plot(FEC=True)

Fit to the section before the rip and automatically plot if the figure is open:

# x is the MINIMUM extension and f is the MAXIMUM force to fit to
# can also use x=(min,max) and f=(min,max)
fit = pull.fitHandles(x=750, f=9)
# can also get the fit and parameters through
pull.handles.parameters
pull.handles['Lc']

Fit the upper portion to get the rip size:

pull.fitRip(f=(10,20))

Basic Usage

Loading a single image:

img = image.fromFile('test_s1m1.img')
background = image.fromFile('background.img', background=True)

image_bg = image.fromFile('test_s1m1.img', background='background.img')

# is true!
image - background == image_bg

# Properties
img.frames
img.width
img.height
img.times

# display frames -- starts with 0
image_bg.show(0)
image_bg.show(10)

Get out the donor/acceptor counts:

ROIs = image.ROI.fromFile('roi1.txt')
image_bg.addROI(*ROIs)

# or bottom,left and top,right and origin
donorROI = Image.ROI( (5,5), (20,25), origin='relative', name='donor' )
# left, right, bottom, top
acceptorROI = Image.ROI.fromCorners( 50, 60, 90, 100, origin='absolute', name='acceptor' )
image_bg.addROI(donorROI,acceptorROI)

donor,acceptor = image_bg.donor,image_bg.acceptor

Origin reflects whether the pixels are numbered with respect to the CCD origin ('absolute') or the image origin ('relative'). Absolute ROIs are robust to changes in the subimage coordinates.

To calculate fret:

fret = fcalc.calculate(image_bg) # optional: beta= , gamma=

# Access as named fields
fret.time, fret.donor, fret.acceptor, fret.fret

# or as a tuple (order matters!)
T,donor,acceptor,f = fret

# and save to a file
fcalc.toFile('saveTo.fret', fret)

fret is a special "named tuple" from the collections package in the python library with more flexible usage, as shown above. Don't be confused; it's just a tuple in which each position also has a name which you can see with fret._fields.

Plot the data:

fplot.plot(fret, title='test1')

# Rerunning this command overwrites the current figure
# but if you want a new figure
figure()
fret.plot(fret)

# and if you have pulling data
pull = TrapData.fromFile('test_s1m1.str')
fplot.plot(fret, pull=pull)

# and if you want to see an FEC
fplot.plot(pull, FEC=True)
# this works too, though they don't align
fplot.plot(fret, pull, FEC=True)

smbanalyze's People

Contributors

cfperez avatar

Watchers

James Cloos avatar Kevin R. Wheeler avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.