- SmartDict
- container for storage of overridable options
- Command
- emulator of lambda functions
- PropertiesContainer
- class for exposing properties via attributes
- color_html_to_RGB()
- convert a color in the HTML format to RGB
- color_RGB_to_html()
- convert a color in the RGB format to HTML
- color_complementary()
- generate the complementary of a color
- str_to_float()
- convenient conversion from string to float
- remove_indices_from_list()
- remove indices from a list
- random_color()
- generate a random color
- save_matrix()
- save a matrix
- unique()
- make a unique array
- is_command_on_path()
- check whether a command is on the path
- ps2pdf()
- convert from PS/EPS to PDF
- ppm2gif()
- convert from PPM to GIF with Netpbm
- rests()
- retrieve atomno, i
- readconfig_option()
- read an option from a section
- gen_molecule_name()
- generate the molecule name
- gen_group_labels()
- generate group labels A, B etc.
- import_processing()
- import and return a processing module
- memoize_deterministic()
- memoization decorator
- CACHE_MEMOIZE
- a dictionary that holds the memoize cache
- LOCK_MEMOIZE
- a lock used during memoization
Author: | Maxim Fedorovsky |
---|
A container for a convenient storage of overridable options.
The class is based on the Python builtin dictionary. It is made up of two containers:
- internal dictionary for the default values
- second dictionary, where the options are first looked up.
The former dictionary is referred to as the default dictionary and the latter one as the reference dictionary.
Initializer of the class.
Parameters: |
|
---|
Update the reference dictionary.
If it is not defined, update the default dictionary.
Parameter: | kw – dictionary to update with |
---|
Emulator of lambda functions.
The idea is taken from H.P. Langtangen, Python Scripting for Computational Science. Springer Verlag Berlin Heidelberg, 2004. p. 519.
Initializer of the class.
Parameters: |
|
---|
Emulate a fget function used by definition of a property (via attribute).
This is a static method of the class.
Parameters: |
|
---|
Emulate a fset function used by definition of a property.
This is a static method of the class.
Parameters: |
|
---|
Class for exposing properties via attributes.
Initializer of the class.
Convert a color in the HTML format to RGB.
Parameter: | colorstr – color in the HTML format e.g. ‘#FF0000’ |
---|---|
Returns: | the tuple of float RGB values |
Convert a color in the RGB format to HTML.
Parameter: | rgb – tuple of float RGB values e.g. (1., 0., 0.) |
---|---|
Returns: | the color in the HTML format |
Generate the complementary of a color.
Parameter: | colorstr – color in the HTML format e.g. ‘#FF0000’ |
---|---|
Returns: | the complementary color in the HTML format |
Convenient conversion from string to float.
If the convertion is failed, return the default value.
Parameters: |
|
---|
Remove indices from a list.
Parameters: |
|
---|
No exception is raised if invalid indices are found.
Save a matrix.
Parameters: |
|
---|
Make a unique array.
Parameter: | arr – input ndarray |
---|
Check whether a command is on the path.
The function searches in directories specified by the PATH environmental variable.
Parameter: | cmd – command name |
---|
Convert an PS/EPS file to PDF with the ps2pdf command.
Parameters: |
|
---|---|
Returns: | whether the conversion has been successful |
Convert a ppm file to gif with Netpbm.
Parameters: |
|
---|---|
Raise: | OSError, IOError |
Read an option from a section from a ConfigParser.
If the option cannot be read or on error the function returns the default.
Parameters: |
|
---|
Generate the molecule name from the full path of a file.
Parameter: | maxchar – maximal number of characters in the molecule name |
---|
Generate group labels A, B etc.
Parameter: | ngroups – number of groups |
---|
Memoization decorator.
Parameter: | gen_key – a callable that generates a string to identify a function to be memoized |
---|