Ejemplo n.º 1
0
"""

from cddm import viewer
from cddm import sim
from cddm import video
from cddm import conf
import numpy as np

conf.set_verbose(2)

n = 16
PERIOD = n * 2
NFRAMES_DUAL = 1024 * 4
NFRAMES_SINGLE = NFRAMES_DUAL  #// 2 // n

t1, t2 = sim.create_random_times1(nframes=NFRAMES_DUAL, n=n)

MARGIN = 32
SHAPE = (512, 512)
#final shape will be 512x512, but here we add some border area so that after
#cropping the image to 512x512 this removes mirroring condition at the borders of
#the simulation.
SIMSHAPE = SHAPE[0] + 2 * MARGIN, SHAPE[1] + 2 * MARGIN
SIMFRAMES = max(max(t1), max(t2)) + 1
NPARTICLES = 100

#def _add_frames_and_crop(frames1, frames2):
#    """adds two frames dogether from a multi-frame input data nad crops results"""
#    return tuple(((frame1+frame2)[MARGIN:SIMSHAPE[0]-MARGIN,0:SHAPE[1]] for frame1, frame2 in zip(frames1, frames2)))

Ejemplo n.º 2
0
import numpy as np
import scipy.ndimage as nd

from examples.paper.two_component.conf import NFRAMES_DUAL, N_PARAMETER, SIMSHAPE, BACKGROUND, DELTA1, DELTA2, VMAX, DT_DUAL,\
    INTENSITY1,INTENSITY2, SIGMA1,SIGMA2, SHAPE, DUST1_PATH, DUST2_PATH, SATURATION, BIT_DEPTH, NOISE_MODEL, READOUT_NOISE,  NUM_PARTICLES1,NUM_PARTICLES2, APPLY_DUST

SAVEFIG = False


def move_pixels(frames, ni=10):
    f1, f2 = frames
    return nd.zoom(f1, 1.04)[10:512 + 10, 10:512 + 10], f2


#random time according to Eq.7 from the SoftMatter paper
t1, t2 = create_random_times1(NFRAMES_DUAL, n=N_PARAMETER)

#: this creates a brownian motion frame iterator.
#: each element of the iterator is a tuple holding a single numpy array (frame)
video1 = simple_brownian_video(t1,
                               t2,
                               shape=SIMSHAPE,
                               background=BACKGROUND,
                               num_particles=NUM_PARTICLES1,
                               dt=DT_DUAL,
                               sigma=SIGMA1,
                               delta=DELTA1,
                               intensity=INTENSITY1,
                               dtype="uint16")

video2 = simple_brownian_video(t1,
Ejemplo n.º 3
0
 def test_dual_video(self):
     t1, t2 = create_random_times1(32, 2)
     t1, t2 = create_random_times2(32, 2)
     video = simple_brownian_video(t1, t2)
     for frames in video:
         pass