Hi,

I have a recommendation for the print statements for this function.
There are quite a lot, and most users will probably not be interested
in seeing them.  Therefore you could set a verbosity argument for the
function which defaults to False.  If it is set to True, then the
print statements are activated:

    # Loop over the index of spins, then exp_type, frq, offset
    if verbosity:
        print("Printing the following")
        print("exp_type curspin_id frq offset{ppm}
offsets[ei][si][mi][oi]{rad/s} ei mi oi si di
cur_spin.chemical_shift{ppm} chemical_shifts[ei][si][mi]{rad/s}
spin_lock_nu1{Hz} tilt_angles[ei][si][mi][oi]{rad}")

You can see how often I use this trick with:

$ grep -r verbosity . --exclude-dir=.svn

That way you can have print statements that can be turned on and off
at any time.

Regards,

Edward


On 7 March 2014 13:21,  <tlin...@nmr-relax.com> wrote:
> Author: tlinnet
> Date: Fri Mar  7 13:21:33 2014
> New Revision: 22440
>
> URL: http://svn.gna.org/viewcvs/relax?rev=22440&view=rev
> Log:
> Moved calc_rotating_frame_params() to specific_analysis.relax_disp.disp_data.
>
> Regarding sr #3124, (https://gna.org/support/index.php?3124) - Grace graphs 
> production for R1rho analysis with R2_eff as function of Omega_eff.
>
> This is in a response to message: 
> http://www.mail-archive.com/relax-devel@gna.org/msg05080.html.
>
> Modified:
>     trunk/specific_analyses/relax_disp/disp_data.py
>
> Modified: trunk/specific_analyses/relax_disp/disp_data.py
> URL: 
> http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/relax_disp/disp_data.py?rev=22440&r1=22439&r2=22440&view=diff
> ==============================================================================
> --- trunk/specific_analyses/relax_disp/disp_data.py     (original)
> +++ trunk/specific_analyses/relax_disp/disp_data.py     Fri Mar  7 13:21:33 
> 2014
> @@ -68,7 +68,7 @@
>  from lib.software.grace import write_xy_data, write_xy_header, 
> script_grace2images
>  from lib.warnings import RelaxWarning, RelaxNoSpinWarning
>  from pipe_control import pipes
> -from pipe_control.mol_res_spin import check_mol_res_spin_data, 
> exists_mol_res_spin_data, generate_spin_id_unique, return_spin, spin_loop
> +from pipe_control.mol_res_spin import check_mol_res_spin_data, 
> exists_mol_res_spin_data, find_index, generate_spin_id_unique, get_spin_ids, 
> return_spin, spin_loop
>  from pipe_control.result_files import add_result_file
>  from pipe_control.selection import desel_spin
>  from pipe_control.sequence import return_attached_protons
> @@ -154,6 +154,64 @@
>
>      # Return the value.
>      return intensity
> +
> +
> +def calc_rotating_frame_params():
> +    """Calculates and rotating frame parameters, calculated from:
> +    - The spectrometer frequency.
> +    - The spin-lock or hard pulse offset.
> +    - The dispersion point data (the spin-lock field strength in Hz).
> +
> +    The return will be for each spin,
> +    - The average resonance offset in the rotating frame ( Domega = 
> w_{pop_ave} - w_rf  ) [rad/s]
> +    - Rotating frame tilt angle ( theta = arctan(w_1 / Omega) ) [rad]
> +    - Effective field in rotating frame ( w_eff = sqrt( Omega^2 + w_1^2 ) ) 
> [rad/s]
> +
> +    Calculations are mentioned in the 
> U{manual<http://www.nmr-relax.com/manual/Dispersion_model_summary.html>}
> +    """
> +    # Get the field count
> +    field_count = cdp.spectrometer_frq_count
> +
> +    # Get the spin_lock_field points
> +    spin_lock_nu1 = return_spin_lock_nu1(ref_flag=False)
> +
> +    # Initialize data containers
> +    all_spin_ids = get_spin_ids()
> +
> +    # Containers for only selected spins
> +    cur_spin_ids = []
> +    cur_spins = []
> +    for curspin_id in all_spin_ids:
> +        # Get the spin
> +        curspin = return_spin(curspin_id)
> +
> +        # Check if is selected
> +        if curspin.select == True:
> +            cur_spin_ids.append(curspin_id)
> +            cur_spins.append(curspin)
> +
> +    # The offset and R1 data.
> +    chemical_shifts, offsets, tilt_angles, Delta_omega, w_eff = 
> return_offset_data(spins=cur_spins, spin_ids=cur_spin_ids, 
> field_count=field_count, fields=spin_lock_nu1)
> +
> +    # Loop over the index of spins, then exp_type, frq, offset
> +    print("Printing the following")
> +    print("exp_type curspin_id frq offset{ppm} 
> offsets[ei][si][mi][oi]{rad/s} ei mi oi si di cur_spin.chemical_shift{ppm} 
> chemical_shifts[ei][si][mi]{rad/s} spin_lock_nu1{Hz} 
> tilt_angles[ei][si][mi][oi]{rad}")
> +    for si in range(len(cur_spin_ids)):
> +        theta_spin_dic = dict()
> +        curspin_id = cur_spin_ids[si]
> +        cur_spin = cur_spins[si]
> +        for exp_type, frq, offset, ei, mi, oi in 
> loop_exp_frq_offset(return_indices=True):
> +            # Loop over the dispersion points.
> +            spin_lock_fields = spin_lock_nu1[ei][mi][oi]
> +            for di in range(len(spin_lock_fields)):
> +                print("%-8s %-10s %11.1f %8.4f %12.5f %i  %i  %i  %i  %i 
> %7.3f %12.5f %12.5f %12.5f"%(exp_type, curspin_id, frq, offset, 
> offsets[ei][si][mi][oi], ei, mi, oi, si, di, cur_spin.chemical_shift, 
> chemical_shifts[ei][si][mi], spin_lock_fields[di], 
> tilt_angles[ei][si][mi][oi][di]))
> +                dic_key = return_param_key_from_data(exp_type=exp_type, 
> frq=frq, offset=offset, point=spin_lock_fields[di])
> +                theta_spin_dic["%s"%(dic_key)] = 
> tilt_angles[ei][si][mi][oi][di]
> +
> +    print("\nThe theta data now resides in")
> +    for curspin, mol_name, res_num, res_name, spin_id in 
> spin_loop(full_info=True, return_id=True, skip_desel=True):
> +        spin_index = find_index(selection=spin_id, global_index=False)
> +        print("%s cdp.mol[%i].res[%i].spin[%i].theta"%(spin_id, 
> spin_index[0], spin_index[1], spin_index[2]))
>
>
>  def count_exp():
>
>
> _______________________________________________
> relax (http://www.nmr-relax.com)
>
> This is the relax-commits mailing list
> relax-comm...@gna.org
>
> To unsubscribe from this list, get a password
> reminder, or change your subscription options,
> visit the list information page at
> https://mail.gna.org/listinfo/relax-commits

_______________________________________________
relax (http://www.nmr-relax.com)

This is the relax-devel mailing list
relax-devel@gna.org

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-devel

Reply via email to