Two-color Imaging

This is an example using scopyon (https://scopyon.readthedocs.io/).


In [1]:
import scopyon

When you want to show debug messages, set the logging level.


In [2]:
import logging
logging.basicConfig(level=logging.DEBUG)

Set the configuration first.


In [3]:
config = scopyon.DefaultConfiguration()
config.default.detector.exposure_time = 33.0e-3  # second

A field of microscopic view could be calculated as follows:


In [4]:
pixel_length = config.default.detector.pixel_length / config.default.magnification
L_2 = config.default.detector.image_size[0] * pixel_length * 0.5

Randomly generate positions of 250 molecules in two dimensions.


In [5]:
import numpy.random
rng = numpy.random.RandomState(123)
N1 = 150
N2 = 50
N3 = 50
inputs = rng.uniform(-L_2, +L_2, size=(N1 + N2 + N3, 2))

Form an image where N1 and N2 molecules are labeled.


In [6]:
img1 = scopyon.form_image(inputs[: N1 + N2], config=config, rng=rng)


DEBUG:scopyon.io:     Type,Fluorophore
DEBUG:scopyon.io:     Maker,"Invitrogen(Life Technologies)"
DEBUG:scopyon.io:     ProductName,"Tetramethylrhodamine(TRITC)"
DEBUG:scopyon.io:     Comment,"Tetramethylrhodamine goat anti-mouse IgG antibody/pH 8.0"
DEBUG:scopyon.io:     Public,1
INFO:scopyon._epifm:--- Fluorophore: Tetramethylrhodamine(TRITC) PSF
INFO:scopyon._epifm:    Wave Length   =  5.780000000000062e-07 m
INFO:scopyon._epifm:    Normalization =  13564.06122650865
INFO:scopyon._epifm:    Fluorophore radius =  2e-08 m
INFO:scopyon._epifm:    PSF Normalization Factor =  13564.06122650865
INFO:scopyon._epifm:    Emission  : Wave Length =  5.780000000000062e-07 m
INFO:scopyon._epifm:--- Shutter:
INFO:scopyon._epifm:    Start-Time = 0.0 sec
INFO:scopyon._epifm:    End-Time   = None sec
INFO:scopyon._epifm:--- Light Source:LASER
INFO:scopyon._epifm:    Wave Length = 5.32e-07 m
INFO:scopyon._epifm:    Beam Flux Density = 400000.0 W/m2
INFO:scopyon._epifm:    1/e2 Radius = 2e-05 m
INFO:scopyon._epifm:    Angle = 1.2566370614359172 radian
DEBUG:scopyon.io:     Type,Dichroic
DEBUG:scopyon.io:     Maker,"Semrock"
DEBUG:scopyon.io:     ProductName,"FF562-Di03-25x36"
DEBUG:scopyon.io:     Comment,""
DEBUG:scopyon.io:     Public,1
INFO:scopyon._epifm:--- Dichroic Mirror:
INFO:scopyon._epifm:--- Magnification: x 241.0
INFO:scopyon._epifm:--- Detector:  EMCCD
INFO:scopyon._epifm:    Image Size  =  512 x 512
INFO:scopyon._epifm:    Pixel Size  =  1.6e-05 m/pixel
INFO:scopyon._epifm:    Focal Point =  [0. 0. 0.]
INFO:scopyon._epifm:    Exposure Time =  0.033 sec
INFO:scopyon._epifm:    Quantum Efficiency =  92.0 %
INFO:scopyon._epifm:    Readout Noise =  100 electron
INFO:scopyon._epifm:    Dark Count =  0 electron/sec
INFO:scopyon._epifm:    EM gain = x 300
INFO:scopyon._epifm:Focal Center: [0. 0. 0.]
INFO:scopyon._epifm:--- A/D Converter: 16-bit
INFO:scopyon._epifm:    Fullwell =  800000 electron
INFO:scopyon._epifm:    none-Fixed Pattern Noise: 0.0 count
INFO:scopyon._epifm:--- Excitation Filter:
INFO:scopyon._epifm:--- Emission Filter:
INFO:scopyon._epifm:--- Background: 
INFO:scopyon._epifm:    Mean = 0.01 photons
INFO:scopyon._epifm:--- Fluorescence: 
INFO:scopyon._epifm:    Quantum Yield =  0.61
INFO:scopyon._epifm:    Abs. Coefficient =  83400 1/(M cm)
INFO:scopyon._epifm:    Abs. Cross-section =  3.1888261070088875e-16 cm^2
INFO:scopyon._epifm:--- Photobleaching: 
INFO:scopyon._epifm:    Photobleaching half life  =  2.5
INFO:scopyon._epifm:processes = 1.
INFO:scopyon._epifm:time: 0.0 sec (0)
INFO:scopyon._epifm:center (width, height): 0.0 0.0
INFO:scopyon._epifm:scaling [m/pixel]: 6.639004149377593e-08
INFO:scopyon._epifm:    000-th file in 000-th frame: 0.0 + 0.033 sec
INFO:scopyon._epifm:Total camera_pixel = 2.190565e+04
INFO:scopyon._epifm:200 optoinfos are registered.
INFO:scopyon._epifm:Apply detector effects.

Generate another image where N2 and N3 molecules are labeled.


In [7]:
img2 = scopyon.form_image(inputs[150: ], config=config, rng=rng)


DEBUG:scopyon.io:     Type,Fluorophore
DEBUG:scopyon.io:     Maker,"Invitrogen(Life Technologies)"
DEBUG:scopyon.io:     ProductName,"Tetramethylrhodamine(TRITC)"
DEBUG:scopyon.io:     Comment,"Tetramethylrhodamine goat anti-mouse IgG antibody/pH 8.0"
DEBUG:scopyon.io:     Public,1
INFO:scopyon._epifm:--- Fluorophore: Tetramethylrhodamine(TRITC) PSF
INFO:scopyon._epifm:    Wave Length   =  5.780000000000062e-07 m
INFO:scopyon._epifm:    Normalization =  13564.06122650865
INFO:scopyon._epifm:    Fluorophore radius =  2e-08 m
INFO:scopyon._epifm:    PSF Normalization Factor =  13564.06122650865
INFO:scopyon._epifm:    Emission  : Wave Length =  5.780000000000062e-07 m
INFO:scopyon._epifm:--- Shutter:
INFO:scopyon._epifm:    Start-Time = 0.0 sec
INFO:scopyon._epifm:    End-Time   = None sec
INFO:scopyon._epifm:--- Light Source:LASER
INFO:scopyon._epifm:    Wave Length = 5.32e-07 m
INFO:scopyon._epifm:    Beam Flux Density = 400000.0 W/m2
INFO:scopyon._epifm:    1/e2 Radius = 2e-05 m
INFO:scopyon._epifm:    Angle = 1.2566370614359172 radian
DEBUG:scopyon.io:     Type,Dichroic
DEBUG:scopyon.io:     Maker,"Semrock"
DEBUG:scopyon.io:     ProductName,"FF562-Di03-25x36"
DEBUG:scopyon.io:     Comment,""
DEBUG:scopyon.io:     Public,1
INFO:scopyon._epifm:--- Dichroic Mirror:
INFO:scopyon._epifm:--- Magnification: x 241.0
INFO:scopyon._epifm:--- Detector:  EMCCD
INFO:scopyon._epifm:    Image Size  =  512 x 512
INFO:scopyon._epifm:    Pixel Size  =  1.6e-05 m/pixel
INFO:scopyon._epifm:    Focal Point =  [0. 0. 0.]
INFO:scopyon._epifm:    Exposure Time =  0.033 sec
INFO:scopyon._epifm:    Quantum Efficiency =  92.0 %
INFO:scopyon._epifm:    Readout Noise =  100 electron
INFO:scopyon._epifm:    Dark Count =  0 electron/sec
INFO:scopyon._epifm:    EM gain = x 300
INFO:scopyon._epifm:Focal Center: [0. 0. 0.]
INFO:scopyon._epifm:--- A/D Converter: 16-bit
INFO:scopyon._epifm:    Fullwell =  800000 electron
INFO:scopyon._epifm:    none-Fixed Pattern Noise: 0.0 count
INFO:scopyon._epifm:--- Excitation Filter:
INFO:scopyon._epifm:--- Emission Filter:
INFO:scopyon._epifm:--- Background: 
INFO:scopyon._epifm:    Mean = 0.01 photons
INFO:scopyon._epifm:--- Fluorescence: 
INFO:scopyon._epifm:    Quantum Yield =  0.61
INFO:scopyon._epifm:    Abs. Coefficient =  83400 1/(M cm)
INFO:scopyon._epifm:    Abs. Cross-section =  3.1888261070088875e-16 cm^2
INFO:scopyon._epifm:--- Photobleaching: 
INFO:scopyon._epifm:    Photobleaching half life  =  2.5
INFO:scopyon._epifm:processes = 1.
INFO:scopyon._epifm:time: 0.0 sec (0)
INFO:scopyon._epifm:center (width, height): 0.0 0.0
INFO:scopyon._epifm:scaling [m/pixel]: 6.639004149377593e-08
INFO:scopyon._epifm:    000-th file in 000-th frame: 0.0 + 0.033 sec
INFO:scopyon._epifm:Total camera_pixel = 1.087719e+04
INFO:scopyon._epifm:100 optoinfos are registered.
INFO:scopyon._epifm:Apply detector effects.

Make a two-color image by merging two images.


In [8]:
img = scopyon.Image.RGB(red=img1, green=img2)

In [9]:
img