Get session
Jump to navigation
Jump to search
Returns a dictionary representation the currently loaded PyMOL session.The session file (.pse) is a compressed version of its output.
By using this API, user scripts can access many interesting properties which are otherwise inaccessible. Examples include Pymol2glmol and get_raw_distances scripts.
WARNING: This API is undocumented API, intended for internal use. Use it only when it is necessary.
Usage
# get the session as a dictionary
print cmd.get_session()
Return value
The returned dictionary has following key-value pairs.
- main: An array encoding window size. For example, [640, 480]
- color_ext:
- settings: An array of PyMOL's global settings. They are dumped by SettingAsPyList in layer1/Setting.c. Further details will not be discussed because scripts can access these values from cmd.get API.
- colors: If you have defined color names by Set Color, they are described here. Default color names (red, blue, etc...) will not appear. This dict can also be obtained by cmd.get_color_indices(). To get RGB definition of a color, get its pallet ID by cmd.get_color_index and convert it to RGB tuple by cmd.get_color_tuple.
- view: Same as cmd.get_view()
- version: Version number of PyMOL
- view_dict:
- names: This is the most complex but interesting part. Produced by ExecutiveGetNamedEntries, this array describes internal C-objects of the current session. Each element is an array of five elements.
(documentation in progress... Please feel free to expand)