Exemplo n.º 1
0
def julien( ref_data ):
        from utilities    import print_msg
        from filter       import fit_tanh, filt_tanl
        from utilities    import center_2D
        #  Prepare the reference in 2D alignment, i.e., low-pass filter and center.
        #  Input: list ref_data
        #   0 - mask
        #   1 - center flag
        #   2 - raw average
        #   3 - fsc result
        #  Output: filtered, centered, and masked reference image
        #  apply filtration (FRC) to reference image:
        global  ref_ali2d_counter
        ref_ali2d_counter += 1
        ref_ali2d_counter  = ref_ali2d_counter % 50
        print_msg("ref_ali2d   #%6d\n"%(ref_ali2d_counter))
        fl = min(0.1+ref_ali2d_counter*0.003, 0.4)
        aa = 0.1
        msg = "Tangent filter:  cut-off frequency = %10.3f        fall-off = %10.3f\n"%(fl, aa)
        print_msg(msg)
        tavg = filt_tanl(ref_data[2], fl, aa)
        cs = [0.0]*2
        if ref_data[1] > 0:
                tavg, cs[0], cs[1] = center_2D(tavg, ref_data[1])
                msg = "Center x = %10.3f, y       = %10.3f\n"%(cs[0], cs[1])
                print_msg(msg)
        return  tavg, cs
Exemplo n.º 2
0
def ref_ali2d_c(ref_data):
    from utilities import print_msg
    from filter import fit_tanh, filt_tanl
    from utilities import center_2D
    #  Prepare the reference in 2D alignment, i.e., low-pass filter and center.
    #  Input: list ref_data
    #   0 - mask
    #   1 - center flag
    #   2 - raw average
    #   3 - fsc result
    #  Output: filtered, centered, and masked reference image
    #  apply filtration (FRC) to reference image:
    global ref_ali2d_counter
    ref_ali2d_counter += 1
    print_msg("ref_ali2d   #%6d\n" % (ref_ali2d_counter))
    fl = min(0.1 + ref_ali2d_counter * 0.003, 0.4)
    aa = 0.1
    msg = "Tangent filter:  cut-off frequency = %10.3f        fall-off = %10.3f\n" % (
        fl, aa)
    print_msg(msg)
    tavg = filt_tanl(ref_data[2], fl, aa)
    cs = [0.0] * 2
    if (ref_data[1] > 0):
        tavg, cs[0], cs[1] = center_2D(tavg, ref_data[1])
        msg = "Center x = %10.3f, y       = %10.3f\n" % (cs[0], cs[1])
        print_msg(msg)
    return tavg, cs
Exemplo n.º 3
0
def ref_random(ref_data):
    from utilities import print_msg
    from filter import fit_tanh, filt_tanl
    from utilities import center_2D
    #  Prepare the reference in 2D alignment, i.e., low-pass filter and center.
    #  Input: list ref_data
    #   0 - mask
    #   1 - center flag
    #   2 - raw average
    #   3 - fsc result
    #  Output: filtered, centered, and masked reference image
    #  apply filtration (FRC) to reference image:
    global ref_ali2d_counter
    ref_ali2d_counter += 1
    print_msg("ref_ali2d   #%6d\n" % (ref_ali2d_counter))
    """
	fl, aa = fit_tanh(ref_data[3])
	msg = "Tangent filter:  cut-off frequency = %10.3f        fall-off = %10.3f\n"%(fl, aa)
	print_msg(msg)
	tavg = filt_tanl(ref_data[2], fl, aa)
	"""
    # ONE CAN USE BUTTERWORTH FILTER
    #lowfq, highfq = filt_params( ref_data[3], low = 0.1)
    #tavg  = filt_btwl( ref_data[2], lowfq, highfq)
    #msg = "Low frequency = %10.3f        High frequency = %10.3f\n"%(lowfq, highfq)
    #print_msg(msg)
    #  ONE CAN CHANGE THE MASK AS THE PROGRAM PROGRESSES
    #from morphology import adaptive_mask
    #ref_data[0] = adaptive_mask(tavg)
    #  CENTER
    cs = [0.0] * 2
    tavg, cs[0], cs[1] = center_2D(ref_data[2], ref_data[1])
    '''
	from math import exp
	nx = tavg.get_xsize()
	ft = []
	good = True
	for i in xrange(nx):
		if(good):
			ex = exp((float(i)/float(nx))**2/2.0/0.12**2)
			if(ex>100.): good = False
		ft.append(ex)
	from filter import filt_table
	tavg = filt_table(tavg, ft)
	'''
    if (ref_data[1] > 0):
        msg = "Center x =      %10.3f        Center y       = %10.3f\n" % (
            cs[0], cs[1])
        print_msg(msg)
    return tavg, cs
Exemplo n.º 4
0
def ref_random( ref_data ):
	from utilities    import print_msg
	from filter       import fit_tanh, filt_tanl
	from utilities    import center_2D
	#  Prepare the reference in 2D alignment, i.e., low-pass filter and center.
	#  Input: list ref_data
	#   0 - mask
	#   1 - center flag
	#   2 - raw average
	#   3 - fsc result
	#  Output: filtered, centered, and masked reference image
	#  apply filtration (FRC) to reference image:
	global  ref_ali2d_counter
	ref_ali2d_counter += 1
	print_msg("ref_ali2d   #%6d\n"%(ref_ali2d_counter))
	"""
	fl, aa = fit_tanh(ref_data[3])
	msg = "Tangent filter:  cut-off frequency = %10.3f        fall-off = %10.3f\n"%(fl, aa)
	print_msg(msg)
	tavg = filt_tanl(ref_data[2], fl, aa)
	"""	
	# ONE CAN USE BUTTERWORTH FILTER
	#lowfq, highfq = filt_params( ref_data[3], low = 0.1)
	#tavg  = filt_btwl( ref_data[2], lowfq, highfq)
	#msg = "Low frequency = %10.3f        High frequency = %10.3f\n"%(lowfq, highfq)
	#print_msg(msg)
	#  ONE CAN CHANGE THE MASK AS THE PROGRAM PROGRESSES
	#from morphology import adaptive_mask
	#ref_data[0] = adaptive_mask(tavg)
	#  CENTER
	cs = [0.0]*2
	tavg, cs[0], cs[1] = center_2D(ref_data[2], ref_data[1])
	'''
	from math import exp
	nx = tavg.get_xsize()
	ft = []
	good = True
	for i in xrange(nx):
		if(good):
			ex = exp((float(i)/float(nx))**2/2.0/0.12**2)
			if(ex>100.): good = False
		ft.append(ex)
	from filter import filt_table
	tavg = filt_table(tavg, ft)
	'''
	if(ref_data[1] > 0):
		msg = "Center x =      %10.3f        Center y       = %10.3f\n"%(cs[0], cs[1])
		print_msg(msg)
	return  tavg, cs