예제 #1
0
def main():
    """Main entry point for running sg-prototype."""
    mod = ArgSchemaParser(schema_type=InputParameters,
                          output_schema_type=OutputParameters)
    output = {}
    # YOUR STUFF GOES HERE
    output.update({"input_parameters": mod.args})
    if "output_json" in mod.args:
        mod.output(output)
    else:
        print(mod.get_output_json(output))
예제 #2
0
def main():
    """Main entry point for running AllenSDK Eye Tracking."""
    try:
        mod = ArgSchemaParser(schema_type=InputParameters,
                              output_schema_type=OutputParameters)

        istream = CvInputStream(mod.args["input_source"])

        ostream = setup_annotation(
            istream.frame_shape,
            **mod.args.get("annotation", DEFAULT_ANNOTATION))

        qc_params = mod.args.get("qc", {})
        generate_plots = qc_params.get("generate_plots",
                                       EyeTracker.DEFAULT_GENERATE_QC_OUTPUT)

        tracker = EyeTracker(istream, ostream, mod.args.get("starburst", {}),
                             mod.args.get("ransac",
                                          {}), mod.args["pupil_bounding_box"],
                             mod.args["cr_bounding_box"], generate_plots,
                             **mod.args.get("eye_params", {}))
        cr_params, pupil_params, cr_err, pupil_err = tracker.process_stream(
            start=mod.args.get("start_frame", 0),
            stop=mod.args.get("stop_frame", None),
            step=mod.args.get("frame_step", 1))

        output = write_output(mod.args["output_dir"], cr_params, pupil_params,
                              tracker.mean_frame)

        pupil_intensity = None
        if tracker.adaptive_pupil:
            pupil_intensity = tracker.pupil_colors
        if generate_plots:
            write_QC_output(tracker.annotator,
                            cr_params,
                            pupil_params,
                            cr_err,
                            pupil_err,
                            tracker.mean_frame,
                            pupil_intensity=pupil_intensity,
                            **mod.args)

        output["input_parameters"] = mod.args
        if "output_json" in mod.args:
            mod.output(output, indent=1)
        else:
            print(json.dumps(mod.get_output_json(output), indent=1))
    except marshmallow.ValidationError as e:
        print(e)
        argparser = schema_argparser(InputParameters())
        argparser.print_usage()
예제 #3
0
def main():

    from ._schemas import InputParameters, OutputParameters

    mod = ArgSchemaParser(schema_type=InputParameters,
                          output_schema_type=OutputParameters)

    output = calculate_quality_metrics(mod.args)

    output.update({"input_parameters": mod.args})
    if "output_json" in mod.args:
        mod.output(output, indent=2)
    else:
        print(mod.get_output_json(output))
예제 #4
0
def main():

    from ._schemas import InputParameters, OutputParameters

    mod = ArgSchemaParser(schema_type=InputParameters,
                          output_schema_type=OutputParameters)

    output = classify_noise_templates(mod.args)

    output.update({"input_parameters": mod.args})
    if "output_json" in mod.args:
        mod.output(output, indent=2)
    else:
        print(mod.get_output_json(output))
예제 #5
0
def main():
    from ._schemas import InputParameters, OutputParameters

    mod = ArgSchemaParser(schema_type=InputParameters,
                          output_schema_type=OutputParameters)
    # output = calculate_stimulus_metrics_ondisk(mod.args)
    output = calculate_stimulus_metrics_gather(mod.args)
    if MPI_rank == 0:
        output.update({"input_parameters": mod.args})
        if "output_json" in mod.args:
            mod.output(output, indent=2)
        else:
            log_info(mod.get_output_json(output))
    barrier()
예제 #6
0
def main():

    from ._schemas import InputParameters, OutputParameters
    """Main entry point:"""
    mod = ArgSchemaParser(schema_type=InputParameters,
                          output_schema_type=OutputParameters)

    output = get_psth_events(mod.args)

    output.update({"input_parameters": mod.args})
    if "output_json" in mod.args:
        mod.output(output, indent=2)
    else:
        print(mod.get_output_json(output))
예제 #7
0
def main():

    from ._schemas import InputParameters, OutputParameters

    mod = ArgSchemaParser(schema_type=InputParameters,
                          output_schema_type=OutputParameters)

    output = run_automerging(mod.args)

    output.update({"input_parameters": mod.args})
    if "output_json" in mod.args:
        mod.output(output, indent=2)
    else:
        print(mod.get_output_json(output))
예제 #8
0
def main():

    from ._schemas import InputParameters, OutputParameters
    """Main entry point:"""
    mod = ArgSchemaParser(schema_type=InputParameters,
                          output_schema_type=OutputParameters)

    if mod.args['tPrime_helper_params']['tPrime_3A']:
        output = call_TPrime_3A(mod.args)
    else:
        output = call_TPrime(mod.args)

    output.update({"input_parameters": mod.args})
    if "output_json" in mod.args:
        mod.output(output, indent=2)
    else:
        print(mod.get_output_json(output))
예제 #9
0
def main():
    """Main entry point for running AllenSDK Eye Tracking."""
    try:
        mod = ArgSchemaParser(schema_type=InputParameters,
                              output_schema_type=OutputParameters)

        starburst_args = get_starburst_args(mod.args["starburst"])

        istream = CvInputStream(mod.args["input_source"])

        im_shape = istream.frame_shape

        ostream = setup_annotation(im_shape, **mod.args["annotation"])

        tracker = EyeTracker(im_shape, istream, ostream, starburst_args,
                             mod.args["ransac"],
                             mod.args["pupil_bounding_box"],
                             mod.args["cr_bounding_box"],
                             mod.args["qc"]["generate_plots"],
                             **mod.args["eye_params"])
        pupil_parameters, cr_parameters = tracker.process_stream(
            start=mod.args.get("start_frame", 0),
            stop=mod.args.get("stop_frame", None),
            step=mod.args.get("frame_step", 1))

        output = write_output(mod.args["output_dir"], cr_parameters,
                              pupil_parameters, tracker.mean_frame)

        if mod.args["qc"]["generate_plots"]:
            write_QC_output(tracker.annotator, cr_parameters, pupil_parameters,
                            tracker.mean_frame, **mod.args)

        output["input_parameters"] = mod.args
        if "output_json" in mod.args:
            mod.output(output, indent=1)
        else:
            print(json.dumps(mod.get_output_json(output), indent=1))
    except marshmallow.ValidationError as e:
        print(e)
        argparser = schema_argparser(InputParameters())
        argparser.print_usage()