Source code for schrodinger.application.phase.utils
"""
Utility functions for the phase module
"""
[docs]def get_denovo_parameters(slider_level):
    """
    Returns tuple that contains Phase DeNovo distBuff and angleLRC parameters
    for a given slider level. Both parameters are interpolated between min and
    max values depending on the slider level.
    :param slider_level: slider value, which can be between 0 and 1.0.
    :type slider_level: float
    :return: tuple that contains DeNovo parameters based on slider level
    :rtype: tuple
    """
    def linear_f(x, start_point, end_point):
        """
        This function does linear interpolation between given end points.
        Allowed x values range between 0 and 1.0.
        :param x: x-value at which function value needs to be determined.
        :type x: int
        :param start_point: function value when x=0
        :type start_point: float
        :param end_point: function value when x=max
        :type end_point: float
        :return: tuple that contains DeNovo buffer distance and angle
            parameters
        :rtype: tuple
        """
        return start_point + (end_point - start_point) * x
    dist_buff_min = 1.5
    dist_buff_max = 0.5
    angle_lrc_min = 30.0
    angle_lrc_max = 100.0
    dist_buff = linear_f(slider_level, dist_buff_min, dist_buff_max)
    angle_lrc = linear_f(slider_level, angle_lrc_min, angle_lrc_max)
    return dist_buff, angle_lrc