def classic_order_param(self, res_num, s2, colour_start, colour_end, colour_list): """Function for generating the bond width and colours for order parameters.""" # The bond width (aiming for a width range of 2 to 0 for S2 values of 0.0 to 1.0). if s2 <= 0.0: width = 2.0 else: width = 2.0 * (1.0 - s2**2) # Catch invalid widths. if width <= 0.0: width = 0.001 # Colour value (quartic). colour_value = s2 ** 4 # Catch invalid colours. if colour_value < 0.0: colour_value = 0.0 elif colour_value > 1.0: colour_value = 1.0 # Default colours. if colour_start == None: colour_start = 'red' if colour_end == None: colour_end = 'yellow' # Get the RGB colour array. rgb_array = linear_gradient(colour_value, colour_start, colour_end, colour_list) # Colour the peptide bond. self.classic_colour(res_num, width, rgb_array)
def classic_correlation_time(self, res_num, te, colour_start, colour_end, colour_list): """Function for generating the bond width and colours for correlation times.""" # The te value in picoseconds. te = te * 1e12 # The bond width (aiming for a width range of 2 to 0 for te values of 0 to 10 ns). width = 2.0 - 200.0 / (te + 100.0) # Catch invalid widths. if width <= 0.0: width = 0.001 # Colour value (hyperbolic). colour_value = 1.0 / (te / 100.0 + 1.0) # Catch invalid colours. if colour_value < 0.0: colour_value = 0.0 elif colour_value > 1.0: colour_value = 1.0 # Default colours. if colour_start == None: colour_start = 'turquoise' if colour_end == None: colour_end = 'blue' # Get the RGB colour array (swap the colours because of the inverted hyperbolic colour value). rgb_array = linear_gradient(colour_value, colour_end, colour_start, colour_list) # Colour the peptide bond. self.classic_colour(res_num, width, rgb_array)
def classic_rex(self, res_num, rex, colour_start, colour_end, colour_list): """Function for generating the bond width and colours for correlation times.""" # The 1st spectrometer frequency. if not hasattr(cdp, 'spectrometer_frq'): raise RelaxError("No spectrometer frequency information is present in the current data pipe.") if hasattr(cdp, 'ri_ids'): frq = cdp.spectrometer_frq[cdp.ri_ids[0]] else: # Take the highest frequency, if all else fails. frqs = sorted(cdp.spectrometer_frq.values()) frq = frqs[-1] # The Rex value. rex = rex * (2.0 * pi * frq)**2 # The bond width (aiming for a width range of 2 to 0 for Rex values of 0 to 25 s^-1). width = 2.0 - 2.0 / (rex/5.0 + 1.0) # Catch invalid widths. if width <= 0.0: width = 0.001 # Colour value (hyperbolic). colour_value = 1.0 / (rex + 1.0) # Catch invalid colours. if colour_value < 0.0: colour_value = 0.0 elif colour_value > 1.0: colour_value = 1.0 # Default colours. if colour_start == None: colour_start = 'yellow' if colour_end == None: colour_end = 'red' # Get the RGB colour array (swap the colours because of the inverted hyperbolic colour value). rgb_array = linear_gradient(colour_value, colour_end, colour_start, colour_list) # Colour the peptide bond. self.classic_colour(res_num, width, rgb_array)