Author: tlinnet Date: Fri Jul 25 13:59:26 2014 New Revision: 24746 URL: http://svn.gna.org/viewcvs/relax?rev=24746&view=rev Log: Split out the writing of dispersion graph files in specific_analyses.relax_disp.data.plot_disp_curves(). This is to prepare for a stand-alone function to plot R1rho graphs, interpolating theta through spin-lock offset rather than spin-lock field strength. sr #3124(https://gna.org/support/?3124): Grace graphs production for R1rho analysis with R2_eff as function of Omega_eff. sr #3138(https://gna.org/support/?3138): Interpolating theta through spin-lock offset [Omega], rather than spin-lock field strength [w1]. Modified: branches/r1rho_plotting/specific_analyses/relax_disp/data.py Modified: branches/r1rho_plotting/specific_analyses/relax_disp/data.py URL: http://svn.gna.org/viewcvs/relax/branches/r1rho_plotting/specific_analyses/relax_disp/data.py?rev=24746&r1=24745&r2=24746&view=diff ============================================================================== --- branches/r1rho_plotting/specific_analyses/relax_disp/data.py (original) +++ branches/r1rho_plotting/specific_analyses/relax_disp/data.py Fri Jul 25 13:59:26 2014 @@ -1561,6 +1561,46 @@ # Default hardcoded colours (one colour for each magnetic field strength). colour_order = [4, 15, 2, 13, 11, 1, 3, 5, 6, 7, 8, 9, 10, 12, 14] * 1000 + # Plot dispersion curves, extending over number of dispersion points. + plot_disp_curves_disp(dir=dir, num_points=num_points, extend=extend, force=force, proton_mmq_flag=proton_mmq_flag, colour_order=colour_order) + + # Write a python "grace to PNG/EPS/SVG..." conversion script. + # Open the file for writing. + file_name = "grace2images.py" + file = open_write_file(file_name, dir, force) + + # Write the file. + script_grace2images(file=file) + + # Close the batch script, then make it executable (expanding any ~ characters). + file.close() + if dir: + dir = expanduser(dir) + chmod(dir + sep + file_name, S_IRWXU|S_IRGRP|S_IROTH) + else: + file_name = expanduser(file_name) + chmod(file_name, S_IRWXU|S_IRGRP|S_IROTH) + + +def plot_disp_curves_disp(dir=None, num_points=1000, extend=500.0, force=False, proton_mmq_flag=None, colour_order=None): + """Custom 2D Grace plotting function for the dispersion curves, looping over dispersion points. + + One file will be created per spin system. + + @keyword dir: The optional directory to place the file into. + @type dir: str + @keyword num_points: The number of points to generate the interpolated fitted curves with. + @type num_points: int + @keyword extend: How far to extend the interpolated fitted curves to (in Hz). + @type extend: float + @param force: Boolean argument which if True causes the files to be overwritten if it already exists. + @type force: bool + @keyword proton_mmq_flag: The flag specifying if proton SQ or MQ CPMG data exists for the spin. + @type proton_mmq_flag: bool + @keyword colour_order: List of colours for xmgrace. + @type colour_order: list of int. + """ + # Loop over each spin. for spin, spin_id in spin_loop(return_id=True, skip_desel=True): # Skip protons for MMQ data. @@ -1586,6 +1626,13 @@ # Interpolate through disp points. file_name, interpolated_flag, back_calc, cpmg_frqs_new, spin_lock_nu1_new = plot_disp_curves_interpolate_disp(spin, spin_id, num_points, extend) + else: + # The unique file name. + file_name = "disp%s.agr" % spin_id.replace('#', '_').replace(':', '_').replace('@', '_') + back_calc = None + cpmg_frqs_new = None + spin_lock_nu1_new = None + # Open the file for writing. file_path = get_file_path(file_name, dir) file = open_write_file(file_name, dir, force) @@ -1649,23 +1696,6 @@ # Add the file to the results file list. add_result_file(type='grace', label='Grace', file=file_path) - - # Write a python "grace to PNG/EPS/SVG..." conversion script. - # Open the file for writing. - file_name = "grace2images.py" - file = open_write_file(file_name, dir, force) - - # Write the file. - script_grace2images(file=file) - - # Close the batch script, then make it executable (expanding any ~ characters). - file.close() - if dir: - dir = expanduser(dir) - chmod(dir + sep + file_name, S_IRWXU|S_IRGRP|S_IROTH) - else: - file_name = expanduser(file_name) - chmod(file_name, S_IRWXU|S_IRGRP|S_IROTH) def plot_disp_curves_interpolate_disp(spin, spin_id, num_points, extend):