workflows/shared/imaging/imaging_shared.py
def threshold_list(imagelist, threshold, fractional_threshold, use_moment0=True, prefix=''):
    """ Find actual threshold for list of results, optionally using moment 0

    :param imagelist:
    :param threshold: Absolute threshold
    :param fractional_threshold: Fractional  threshold
    :param use_moment0: Use moment 0 for threshold
    :return:
    """
    peak = 0.0
    for i, result in enumerate(imagelist):
        if use_moment0:
            moments = calculate_image_frequency_moments(result)
            this_peak = numpy.max(numpy.abs(moments.data[0, ...] / result.shape[0]))
            peak = max(peak, this_peak)
            log.info("threshold_list: using moment 0, sub_image %d, peak = %f," % (i, this_peak))
        else:
            ref_chan = result.data.shape[0] // 2
            this_peak = numpy.max(numpy.abs(result.data[ref_chan]))
            peak = max(peak, this_peak)
            log.info("threshold_list: using refchan %d , sub_image %d, peak = %f," % (ref_chan, i, this_peak))

    actual = max(peak * fractional_threshold, threshold)
    
    
    if use_moment0:
        log.info("threshold_list %s: Global peak in moment 0 = %.6f, sub-image clean threshold will be %.6f" % (prefix,
                                                                                                           peak,
                                                                                                   actual))
    else:
        log.info("threshold_list %s: Global peak = %.6f, sub-image clean threshold will be %.6f" % (prefix, peak,
                                                                                                   actual))
    
    return actual
 Find actual threshold for list of results, optionally using moment 0

    :param imagelist:
    :param threshold: Absolute threshold
    :param fractional_threshold: Fractional  threshold
    :param use_moment0: Use moment 0 for threshold
    :return:
    
Find actual threshold for list of results, optionally using moment 0
Find actual threshold for list of results optionally using moment 0
def threshold_list(imagelist, threshold, fractional_threshold, use_moment0=True, prefix=''):
    peak = 0.0
    for i, result in enumerate(imagelist):
        if use_moment0:
            moments = calculate_image_frequency_moments(result)
            this_peak = numpy.max(numpy.abs(moments.data[0, ...] / result.shape[0]))
            peak = max(peak, this_peak)
            log.info("threshold_list: using moment 0, sub_image %d, peak = %f," % (i, this_peak))
        else:
            ref_chan = result.data.shape[0] // 2
            this_peak = numpy.max(numpy.abs(result.data[ref_chan]))
            peak = max(peak, this_peak)
            log.info("threshold_list: using refchan %d , sub_image %d, peak = %f," % (ref_chan, i, this_peak))
    actual = max(peak * fractional_threshold, threshold)
    if use_moment0:
        log.info("threshold_list %s: Global peak in moment 0 = %.6f, sub-image clean threshold will be %.6f" % (prefix,
                                                                                                           peak,
                                                                                                   actual))
    else:
        log.info("threshold_list %s: Global peak = %.6f, sub-image clean threshold will be %.6f" % (prefix, peak,
                                                                                                   actual))
    return actual
def threshold_list ( imagelist , threshold , fractional_threshold , use_moment0 = True , prefix = '' ) : peak = 0.0 for i , result in enumerate ( imagelist ) : if use_moment0 : moments = calculate_image_frequency_moments ( result ) this_peak = numpy . max ( numpy . abs ( moments . data [ 0 , ... ] / result . shape [ 0 ] ) ) peak = max ( peak , this_peak ) log . info ( "threshold_list: using moment 0, sub_image %d, peak = %f," % ( i , this_peak ) ) else : ref_chan = result . data . shape [ 0 ] // 2 this_peak = numpy . max ( numpy . abs ( result . data [ ref_chan ] ) ) peak = max ( peak , this_peak ) log . info ( "threshold_list: using refchan %d , sub_image %d, peak = %f," % ( ref_chan , i , this_peak ) ) actual = max ( peak * fractional_threshold , threshold ) if use_moment0 : log . info ( "threshold_list %s: Global peak in moment 0 = %.6f, sub-image clean threshold will be %.6f" % ( prefix , peak , actual ) ) else : log . info ( "threshold_list %s: Global peak = %.6f, sub-image clean threshold will be %.6f" % ( prefix , peak , actual ) ) return actual
Find actual threshold for list of results, optionally using moment 0
Find actual threshold for list of results optionally using moment 0
""" Find actual threshold for list of results, optionally using moment 0

    :param imagelist:
    :param threshold: Absolute threshold
    :param fractional_threshold: Fractional  threshold
    :param use_moment0: Use moment 0 for threshold
    :return:
    """
None
imagelist
None
threshold
None
fractional_threshold
None
use_moment0
Use moment 0 for threshold
Use moment 0 for threshold
prefix