Esempio n. 1
0
    def __init__(self, filename, frame_sx, frame_sy, type):

        self.i3_bin = readinsight3.I3Reader(filename)

        self.frame_sx = frame_sx
        self.frame_sy = frame_sy
        self.last_frame = -1
        self.last_i = 0
        self.mol_items = []
        self.type = type
Esempio n. 2
0
import matplotlib.pyplot as pyplot
import numpy
import sys

import sa_library.gaussfit as gaussfit
import sa_library.readinsight3 as readinsight3
import sa_library.ia_utilities_c as utilC

if (len(sys.argv) != 3):
    print "usage: <true locations> <measured locations>"
    exit()

# For converting XY units to nanometers.
pixel_size = 160.0

truth_i3 = readinsight3.I3Reader(sys.argv[1])
measured_i3 = readinsight3.I3Reader(sys.argv[2])

all_dx = None
all_dy = None
all_dz = None
for i in range(truth_i3.getNumberFrames()):
    t_locs = truth_i3.getMoleculesInFrame(i+1)
    m_locs = measured_i3.getMoleculesInFrame(i+1, good_only = False)

    p_index = utilC.peakToPeakIndex(m_locs['xc'], m_locs['yc'], t_locs['xc'], t_locs['yc'])
    dx = numpy.zeros(m_locs.size)
    dy = numpy.zeros(m_locs.size)
    dz = numpy.zeros(m_locs.size)
    for i in range(m_locs.size):
        dx[i] = pixel_size * (m_locs['xc'][i] - t_locs['xc'][p_index[i]])
#
# Convert a .bin format file to the Single Molecule
# Localization Challenge format.
#
# Hazen 03/14
#

import sys

import sa_library.readinsight3 as readinsight3

if (len(sys.argv)!=4):
    print "usage: <bin_file> <smlc_file> <pix_to_nm>"
    exit()

i3_reader = readinsight3.I3Reader(sys.argv[1])
i3_block = i3_reader.nextBlock(block_size = 1000, good_only = False)

smlc_file_fp = open(sys.argv[2], "w")
smlc_file_fp.write("frame,xnano,ynano,intensity\n")

pix_to_nm = float(sys.argv[3])

print "Saving Localizations"
localization_number = 0
while (type(i3_block) != type(False)):

    print " saving localization", localization_number

    for i in range(len(i3_block)):
        fr = i3_block['fr'][i]