def make_lawn_measurements(experiment_root, annotations, remake_lawns=False):
    if not (pathlib.Path(experiment_root) / 'derived_data' /
            'lawn_masks').exists() or remake_lawns:
        process_data.annotate(experiment_root,
                              position_annotators=[process_data.annotate_lawn])

    measures = [process_data.LawnMeasurements()]
    measurement_name = 'lawn_measures'

    process_data.measure_worms(experiment_root, annotations, measures,
                               measurement_name)
def make_gfp_measurements(experiment_root,
                          annotations,
                          fl_measurement_name='gfp',
                          adult_only=True):
    measures = [process_data.FluorMeasurements(fl_measurement_name)]
    measurement_name = 'fluorescence_measures'

    if adult_only:
        annotations = load_data.filter_annotations(
            annotations, elegant_filters.filter_by_stage('adult')).copy()
    process_data.measure_worms(experiment_root, annotations, measures,
                               measurement_name)
def make_multipass_measurements(experiment_root, annotations, adult_only=True):
    experiment_metadata = load_data.read_metadata(experiment_root)
    microns_per_pixel = 1.3 * 5 / (experiment_metadata['objective'] *
                                   experiment_metadata['optocoupler'])
    measures = [MultipassPoseMeasurements(microns_per_pixel=microns_per_pixel)]
    measurement_name = 'multipass_measures'

    if adult_only:
        annotations = load_data.filter_annotations(
            annotations, elegant_filters.filter_by_stage('adult')).copy()

    process_data.measure_worms(experiment_root, annotations, measures,
                               measurement_name)
def make_mask_measurements(experiment_root, annotations=None, adult_only=True):
    #process_data.annotate(experiment_root, annotators=[annotate_timepoints]) # Why?

    experiment_metadata = load_data.read_metadata(experiment_root)
    microns_per_pixel = 1.3 * 5 / (experiment_metadata['objective'] *
                                   experiment_metadata['optocoupler'])
    measures = [MaskPoseMeasurements(microns_per_pixel=microns_per_pixel)]
    measurement_name = 'mask_measures'

    if annotations is None:
        annotations = load_data.read_annotations(experiment_root)
        annotations = load_data.filter_annotations(annotations,
                                                   filter_excluded)

    annotations = load_data.filter_annotations(
        annotations, elegant_filters.filter_living_timepoints)
    if adult_only:
        annotations = load_data.filter_annotations(
            annotations, elegant_filters.filter_by_stage('adult'))

    process_data.measure_worms(experiment_root, annotations, measures,
                               measurement_name)
def make_basic_measurements(experiment_root, annotations):
    measures = [process_data.BasicMeasurements()]
    measurement_name = 'core_measures'

    process_data.measure_worms(experiment_root, annotations, measures,
                               measurement_name)