Ejemplo n.º 1
0
def zFitting(h5_name, parameters, fit_tracks):
    """
    Does z fitting for the '3d' model.
    """
    [wx_params, wy_params] = parameters.getWidthParams()
    [min_z, max_z] = parameters.getZRange()
    z_step = parameters.getAttr("z_step", 1.0e-3)

    if fit_tracks:
        fitzC.fitzTracks(h5_name, parameters.getAttr("cutoff"), wx_params,
                         wy_params, min_z, max_z, z_step)
    else:
        fitzC.fitzRaw(h5_name, parameters.getAttr("cutoff"), wx_params,
                      wy_params, min_z, max_z, z_step)
Ejemplo n.º 2
0
def test_fitz_c_2():
    """
    Test that localizations with wx, wy values that are not near
    the calibration curve are assigned z values less than z minimum.
    """
    # Load 3D parameters.
    settings = storm_analysis.getData("test/data/test_3d_3d.xml")
    parameters = params.ParametersDAO().initFromFile(settings)

    [wx_params, wy_params] = parameters.getWidthParams()
    [min_z, max_z] = parameters.getZRange()
    pixel_size = parameters.getAttr("pixel_size")

    # Calculate widths.
    z_vals = numpy.arange(-250.0, 251.0, 100)
    [sx, sy] = fitzC.calcSxSy(wx_params, wy_params, z_vals)

    # Create HDF5 file with these widths.
    peaks = {
        "x": numpy.zeros(sx.size),
        "xsigma": sx / pixel_size + numpy.ones(sx.size),
        "ysigma": sy / pixel_size + numpy.ones(sx.size)
    }

    h5_name = storm_analysis.getPathOutputTest("test_sa_hdf5.hdf5")
    storm_analysis.removeFile(h5_name)

    with saH5Py.SAH5Py(h5_name, is_existing=False) as h5:
        h5.setMovieInformation(256, 256, 10, "XYZZY")
        h5.setPixelSize(pixel_size)
        h5.addLocalizations(peaks, 1)

    # Calculate Z values.
    fitzC.fitzRaw(h5_name, 1.5, wx_params, wy_params, min_z, max_z, 1.0e-3)

    # Check Z values.
    with saH5Py.SAH5Py(h5_name) as h5:
        locs = h5.getLocalizationsInFrame(1)
        assert (numpy.allclose(locs["z"],
                               min_z * numpy.ones(sx.size) - 1.0e-3))
Ejemplo n.º 3
0
def test_fitz_c_2():
    """
    Test that localizations with wx, wy values that are not near
    the calibration curve are assigned z values less than z minimum.
    """
    # Load 3D parameters.
    settings = storm_analysis.getData("test/data/test_3d_3d.xml")
    parameters = params.ParametersDAO().initFromFile(settings)

    [wx_params, wy_params] = parameters.getWidthParams()
    [min_z, max_z] = parameters.getZRange()
    pixel_size = parameters.getAttr("pixel_size")

    # Calculate widths.
    z_vals = numpy.arange(-250.0, 251.0, 100)
    [sx, sy] = fitzC.calcSxSy(wx_params, wy_params, z_vals)

    # Create HDF5 file with these widths.
    peaks = {"x" : numpy.zeros(sx.size),
             "xsigma" : sx/pixel_size + numpy.ones(sx.size),
             "ysigma" : sy/pixel_size + numpy.ones(sx.size)}

    h5_name = storm_analysis.getPathOutputTest("test_sa_hdf5.hdf5")
    storm_analysis.removeFile(h5_name)
    
    with saH5Py.SAH5Py(h5_name, is_existing = False) as h5:
        h5.setMovieInformation(256, 256, 10, "XYZZY")
        h5.setPixelSize(pixel_size)
        h5.addLocalizations(peaks, 1)

    # Calculate Z values.
    fitzC.fitzRaw(h5_name, 1.5, wx_params, wy_params, min_z, max_z, 1.0e-3)

    # Check Z values.
    with saH5Py.SAH5Py(h5_name) as h5:
        locs = h5.getLocalizationsInFrame(1)
        assert(numpy.allclose(locs["z"], min_z*numpy.ones(sx.size)-1.0e-3))
Ejemplo n.º 4
0
def zFitting(h5_name, parameters, fit_tracks):
    """
    Does z fitting for the '3d' model.
    """
    [wx_params, wy_params] = parameters.getWidthParams()
    [min_z, max_z] = parameters.getZRange()
    z_step = parameters.getAttr("z_step", 1.0e-3)

    if fit_tracks:
        fitzC.fitzTracks(h5_name,
                         parameters.getAttr("cutoff"),
                         wx_params,
                         wy_params,
                         min_z,
                         max_z,
                         z_step)
    else:
        fitzC.fitzRaw(h5_name,
                      parameters.getAttr("cutoff"),
                      wx_params,
                      wy_params,
                      min_z,
                      max_z,
                      z_step)