Difference between revisions of "Cdp"

From relax wiki
Jump to navigation Jump to search
(More Python 3 fixes.)
 
(14 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== cdp - The current data protocol ==
+
In relax data for different analyses are stored in different data pipes.  The current data pipe is abbreviated as '''cdp''' and this Python data object is available within scripts and anywhere in the relax source code.
 +
 
 +
== cdp - The current data pipe ==
 
cdp is a [http://docs.python.org/2/tutorial/classes.html python class object].<br>
 
cdp is a [http://docs.python.org/2/tutorial/classes.html python class object].<br>
  
 
Knowing this, we can access information from the class.
 
Knowing this, we can access information from the class.
  
=== return the list of attributes ===
+
=== Return the list of attributes ===
 
<source lang="python">
 
<source lang="python">
 +
print(type(cdp))
 +
<class 'data_store.pipe_container.PipeContainer'>
 +
 
dir(cdp)
 
dir(cdp)
 
['__class__', '__clone__', '__deepcopy__', '__delattr__', '__dict__', '__doc__', '__format__',
 
['__class__', '__clone__', '__deepcopy__', '__delattr__', '__dict__', '__doc__', '__format__',
Line 25: Line 30:
 
<source lang="python">
 
<source lang="python">
 
cdp.cpmg_frqs
 
cdp.cpmg_frqs
{'6_6': 120.0, '3_30': 600.0, '16_14': 280.0, '15_14': 280.0, '13_38': 760.0, '1_0': None, '0_2': 40.0, '7_2': 40.0, '2_8': 160.0, '12_26': 520.0, '5_42': 840.0, '22_46': 920.0, '4_4': 80.0, '19_46': 920.0, '14_2': 40.0, '9_46': 920.0, '17_30': 600.0, '10_10': 200.0, '18_22': 440.0, '20_14': 280.0, '21_34': 680.0, '11_18': 360.0, '8_30': 600.0}
+
{'6_6': 120.0, '3_30': 600.0, '16_14': 280.0, '15_14': 280.0, '13_38': 760.0, '1_0': None, '0_2': 40.0,  
for key, value in cdp.cpmg_frqs.iteritems(): print key, value
+
'7_2': 40.0, '2_8': 160.0, '12_26': 520.0, '5_42': 840.0, '22_46': 920.0, '4_4': 80.0, '19_46': 920.0,  
 +
'14_2': 40.0, '9_46': 920.0, '17_30': 600.0, '10_10': 200.0, '18_22': 440.0, '20_14': 280.0, '21_34': 680.0,  
 +
'11_18': 360.0, '8_30': 600.0}
 +
 
 +
print(type(cdp.cpmg_frqs))
 +
<type 'dict'>
 +
 
 +
for key, value in cdp.cpmg_frqs.iteritems():
 +
    print("%s %s" % (key, value))
 
6_6 120.0
 
6_6 120.0
 
3_30 600.0
 
3_30 600.0
Line 35: Line 48:
 
...
 
...
 
</source>
 
</source>
 +
 +
=== List model type ===
 +
<source lang="python">
 +
print("%s %s" % (cdp.model_type, type(cdp.model_type)))
 +
disp <type 'str'>
 +
</source>
 +
 +
=== List spectrum ID's ===
 +
<source lang="python">
 +
print("%s %s" % (cdp.spectrum_ids, len(cdp.spectrum_ids)))
 +
['0_2', '1_0', '2_8', '3_30', '4_4', '5_42', '6_6', '7_2', '8_30', '9_46', '10_10', '11_18', '12_26',
 +
'13_38', '14_2', '15_14', '16_14', '17_30', '18_22', '19_46', '20_14', '21_34', '22_46'] 23
 +
</source>
 +
 +
=== List replicate spectrum ID's ===
 +
<source lang="python">
 +
print(cdp.replicates)
 +
[['0_2', '7_2', '14_2'], ['15_14', '16_14', '20_14'], ['3_30', '8_30', '17_30'], ['9_46', '19_46', '22_46']]
 +
</source>
 +
 +
== See also ==
 +
 +
[[Category:Development]]
 +
[[Category:list_objects]]

Latest revision as of 18:52, 6 November 2015

In relax data for different analyses are stored in different data pipes. The current data pipe is abbreviated as cdp and this Python data object is available within scripts and anywhere in the relax source code.

cdp - The current data pipe

cdp is a python class object.

Knowing this, we can access information from the class.

Return the list of attributes

print(type(cdp))
<class 'data_store.pipe_container.PipeContainer'>

dir(cdp)
['__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_ri_data', 
'cpmg_frqs', 'cpmg_frqs_list', 'dispersion_points', 'exp_type', 'from_xml', 'hybrid_pipes', 'int_method', 
'interatomic', 'is_empty', 'model_type', 'mol', 'num_time_pts', 'pipe_type', 'relax_time_list', 'relax_times', 
'replicates', 'result_files', 'sigma_I', 'sim_number', 'sim_state', 'spectrometer_frq', 'spectrometer_frq_count', 
'spectrometer_frq_list', 'spectrum_ids', 'spin_lock_nu1_list', 'to_xml', 'var_I', 'xml_create_hybrid_element']

Get list of CPMG frequencies

cdp.cpmg_frqs_list
[None, 40.0, 80.0, 120.0, 160.0, 200.0, 280.0, 360.0, 440.0, 520.0, 600.0, 680.0, 760.0, 840.0, 920.0]

Get list of CPMG frequencies and intensity names

cdp.cpmg_frqs
{'6_6': 120.0, '3_30': 600.0, '16_14': 280.0, '15_14': 280.0, '13_38': 760.0, '1_0': None, '0_2': 40.0, 
'7_2': 40.0, '2_8': 160.0, '12_26': 520.0, '5_42': 840.0, '22_46': 920.0, '4_4': 80.0, '19_46': 920.0, 
'14_2': 40.0, '9_46': 920.0, '17_30': 600.0, '10_10': 200.0, '18_22': 440.0, '20_14': 280.0, '21_34': 680.0, 
'11_18': 360.0, '8_30': 600.0}

print(type(cdp.cpmg_frqs))
<type 'dict'>

for key, value in cdp.cpmg_frqs.iteritems():
    print("%s %s" % (key, value))
6_6 120.0
3_30 600.0
16_14 280.0
15_14 280.0
13_38 760.0
1_0 None
...

List model type

print("%s %s" % (cdp.model_type, type(cdp.model_type)))
disp <type 'str'>

List spectrum ID's

print("%s %s" % (cdp.spectrum_ids, len(cdp.spectrum_ids)))
['0_2', '1_0', '2_8', '3_30', '4_4', '5_42', '6_6', '7_2', '8_30', '9_46', '10_10', '11_18', '12_26', 
'13_38', '14_2', '15_14', '16_14', '17_30', '18_22', '19_46', '20_14', '21_34', '22_46'] 23

List replicate spectrum ID's

print(cdp.replicates)
[['0_2', '7_2', '14_2'], ['15_14', '16_14', '20_14'], ['3_30', '8_30', '17_30'], ['9_46', '19_46', '22_46']]

See also