예제 #1
0
def _test_rcc_1():
    """
    Test RCC drift correction.
    """
    # Calculate drift correction.
    param_name = storm_analysis.getData("test/data/test_drift.xml")
    parameters = params.ParametersCommon().initFromFile(param_name)

    data_name = storm_analysis.getData("test/data/test_drift.hdf5")
    h5_name = storm_analysis.getPathOutputTest("test_rcc_hdf5.hdf5")

    # Make a copy of the original as it will get modified and then
    # git will pick this up.
    shutil.copyfile(data_name, h5_name)

    drift_output = storm_analysis.getPathOutputTest("test_drift_drift.txt")

    [min_z, max_z] = parameters.getZRange()
    rccDriftCorrection.rccDriftCorrection(h5_name, drift_output,
                                          parameters.getAttr("frame_step"),
                                          parameters.getAttr("d_scale"), min_z,
                                          max_z, True)

    # Verify results.
    diffs = veri.verifyDriftCorrection(
        storm_analysis.getData("test/data/test_drift.txt"), drift_output)

    if (diffs[0] > 0.1):
        raise Exception("Frame numbers do not match.")

    # These thresholds are somewhat arbitrary.
    if (diffs[1] > 0.1) or (diffs[2] > 0.1):
        raise Exception("XY drift correction error.")

    if (diffs[3] > 0.03):
        raise Exception("Z drift correction error.")
def trackDriftCorrect(h5_name, params_file):

    parameters = params.ParametersCommon().initFromFile(params_file)
    std_analysis.trackDriftCorrect(h5_name, parameters)
예제 #3
0
        "The name of the output movie (with background subtracted). This will be in .dax format."
    )
    parser.add_argument('--xml',
                        dest='settings',
                        type=str,
                        required=True,
                        help="The name of the settings xml file.")

    args = parser.parse_args()

    # Load movies and parameters.
    input_movie = datareader.inferReader(args.in_movie)
    [w, h, l] = input_movie.filmSize()

    output_movie = daxwriter.DaxWriter(args.out_movie, h, w)
    parameters = params.ParametersCommon().initFromFile(args.settings)

    n_frames = parameters.getAttr("max_frame")
    if (n_frames > l) or (n_frames == -1):
        n_frames = l

    # Default to a sample size if the settings file does not specify this.
    sample_size = 100
    if (parameters.getAttr("static_background_estimate", 0) > 0):
        sample_size = parameters.getAttr("static_background_estimate")
    else:
        print(
            "Did not find parameter 'static_background_estimate' in parameters file, defaulting to",
            sample_size)

    sbge = StaticBGEstimator(input_movie,