Open main menu

Changes

Spin loop

123 bytes added, 18:13, 19 October 2015
Changed the section ordering to be more logical - the spin loop now comes first.
# Looking at the cdp.mol[i].res[j].spin[k] data structure.
=== Looping over spin ===
The automated looping over all spin systems is provided by the <code>pipe_control.mol_res_spin.spin_loop()</code> function.
<source lang="python">
from pipe_control.mol_res_spin import spin_loop
for spin, spin_id in spin_loop(return_id=True, skip_desel=True):
print("Spin '%s', model '%s'" % (spin_id, spin.model))
</source>
 
To see available information in the spin class
<source lang="python">
dir(spin)
['__class__', '__clone__', '__deepcopy__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__',
'__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__',
'__subclasshook__', '__weakref__', '_back_compat_hook', '_back_compat_hook_mf_data', '_back_compat_hook_ri_data',
'_mol_index', '_mol_name', '_res_index', '_res_name', '_res_num', '_spin_ids', '_spin_index',
'chi2', 'chi2_sim', 'f_count', 'f_count_sim', 'g_count', 'g_count_sim', 'h_count', 'h_count_sim', 'intensities', 'intensity_err', 'is_empty',
'isotope', 'iter', 'iter_sim', 'kex', 'kex_err', 'kex_sim', 'model', 'name', 'num', 'params', 'phi_ex', 'phi_ex_err',
'phi_ex_sim', 'r2', 'r2_err', 'r2_sim', 'r2eff', 'r2eff_bc', 'r2eff_err', 'r2eff_sim', 'select', 'select_sim', 'warning', 'warning_sim']
</source>
=== Looping over cdp ===
warning_sim: [None, None, None]
</source>
 
=== Looping over spin ===
<source lang="python">
from pipe_control.mol_res_spin import spin_loop
for spin, spin_id in spin_loop(return_id=True, skip_desel=True):
print("Spin '%s', model '%s'" % (spin_id, spin.model))
</source>
 
To see available information in the spin class
<source lang="python">
dir(spin)
['__class__', '__clone__', '__deepcopy__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__',
'__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__',
'__subclasshook__', '__weakref__', '_back_compat_hook', '_back_compat_hook_mf_data', '_back_compat_hook_ri_data',
'_mol_index', '_mol_name', '_res_index', '_res_name', '_res_num', '_spin_ids', '_spin_index',
'chi2', 'chi2_sim', 'f_count', 'f_count_sim', 'g_count', 'g_count_sim', 'h_count', 'h_count_sim', 'intensities', 'intensity_err', 'is_empty',
'isotope', 'iter', 'iter_sim', 'kex', 'kex_err', 'kex_sim', 'model', 'name', 'num', 'params', 'phi_ex', 'phi_ex_err',
'phi_ex_sim', 'r2', 'r2_err', 'r2_sim', 'r2eff', 'r2eff_bc', 'r2eff_err', 'r2eff_sim', 'select', 'select_sim', 'warning', 'warning_sim']
</source>
Trusted, Bureaucrats
4,228

edits