holoviews.util Package


util Package

Inheritance diagram of holoviews.util
class holoviews.util. Dynamic ( **params ) [source]

Bases: param.parameterized.ParameterizedFunction

Dynamically applies a callable to the Elements in any HoloViews object. Will return a DynamicMap wrapping the original map object, which will lazily evaluate when a key is requested. By default Dynamic applies a no-op, making it useful for converting HoloMaps to a DynamicMap.

Any supplied kwargs will be passed to the callable and any streams will be instantiated on the returned DynamicMap.

param Callable operation ( allow_None=False, constant=False, instantiate=False, pickle_default_value=True, precedence=None, readonly=False )
Operation or user-defined callable to apply dynamically
param Dict kwargs ( allow_None=False, constant=False, default={}, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False )
Keyword arguments passed to the function.
param Boolean link_inputs ( allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False )
If Dynamic is applied to another DynamicMap, determines whether linked streams attached to its Callable inputs are transferred to the output of the utility. For example if the Dynamic utility is applied to a DynamicMap with an RangeXY, this switch determines whether the corresponding visualization should update this stream with range changes originating from the newly generated axes.
param Boolean shared_data ( allow_None=False, bounds=(0, 1), constant=False, default=False, instantiate=False, pickle_default_value=True, precedence=None, readonly=False )
Whether the cloned DynamicMap will share the same cache.
param List streams ( allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
List of streams to attach to the returned DynamicMap
debug ( msg , *args , **kw )

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults ( )

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = functools.partial(<function Parameterized.force_new_dynamic_value>, <class 'holoviews.util.Dynamic'>)
get_param_values = functools.partial(<function Parameterized.get_param_values>, <class 'holoviews.util.Dynamic'>)
get_value_generator = functools.partial(<function Parameterized.get_value_generator>, <class 'holoviews.util.Dynamic'>)
inspect_value = functools.partial(<function Parameterized.inspect_value>, <class 'holoviews.util.Dynamic'>)
instance = functools.partial(<function ParameterizedFunction.instance>, <class 'holoviews.util.Dynamic'>)
message ( msg , *args , **kw )

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

params ( parameter_name=None )

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint ( imports=None , prefix='\n ' , unknown_value='<?>' , qualify=False , separator='' )

Same as Parameterized.pprint, except that X.classname(Y is replaced with X.classname.instance(Y

print_param_defaults ( )

Print the default values of all cls’s Parameters.

print_param_values ( )

Print the values of all this object’s Parameters.

script_repr ( imports=[] , prefix=' ' )

Same as Parameterized.script_repr, except that X.classname(Y is replaced with X.classname.instance(Y

set_default ( param_name , value )

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = functools.partial(<function Parameterized.set_dynamic_time_fn>, <class 'holoviews.util.Dynamic'>)
set_param = functools.partial(<function Parameterized.set_param>, <class 'holoviews.util.Dynamic'>)
state_pop ( )

Restore the most recently saved state.

See state_push() for more details.

state_push ( )

Save this instance’s state.

For Parameterized instances, this includes the state of dynamically generated values.

Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().

Generally, this method is used by operations that need to test something without permanently altering the objects’ state.

verbose ( msg , *args , **kw )

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning ( msg , *args , **kw )

Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.

See Python’s logging module for details of message formatting.

holoviews.util. examples ( path='holoviews-examples' , verbose=False , force=False , root='/Users/philippjfr/topographica/external/holoviews/holoviews/util/__init__.py' ) [source]

Copies the notebooks to the supplied path.

class holoviews.util. extension ( **params ) [source]

Bases: param.parameterized.ParameterizedFunction

Helper utility used to load holoviews extensions. These can be plotting extensions, element extensions or anything else that can be registered to work with HoloViews.

debug ( msg , *args , **kw )

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults ( )

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = functools.partial(<function Parameterized.force_new_dynamic_value>, <class 'holoviews.util.extension'>)
get_param_values = functools.partial(<function Parameterized.get_param_values>, <class 'holoviews.util.extension'>)
get_value_generator = functools.partial(<function Parameterized.get_value_generator>, <class 'holoviews.util.extension'>)
inspect_value = functools.partial(<function Parameterized.inspect_value>, <class 'holoviews.util.extension'>)
instance = functools.partial(<function ParameterizedFunction.instance>, <class 'holoviews.util.extension'>)
message ( msg , *args , **kw )

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

params ( parameter_name=None )

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint ( imports=None , prefix='\n ' , unknown_value='<?>' , qualify=False , separator='' )

Same as Parameterized.pprint, except that X.classname(Y is replaced with X.classname.instance(Y

print_param_defaults ( )

Print the default values of all cls’s Parameters.

print_param_values ( )

Print the values of all this object’s Parameters.

script_repr ( imports=[] , prefix=' ' )

Same as Parameterized.script_repr, except that X.classname(Y is replaced with X.classname.instance(Y

set_default ( param_name , value )

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = functools.partial(<function Parameterized.set_dynamic_time_fn>, <class 'holoviews.util.extension'>)
set_param = functools.partial(<function Parameterized.set_param>, <class 'holoviews.util.extension'>)
state_pop ( )

Restore the most recently saved state.

See state_push() for more details.

state_push ( )

Save this instance’s state.

For Parameterized instances, this includes the state of dynamically generated values.

Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().

Generally, this method is used by operations that need to test something without permanently altering the objects’ state.

verbose ( msg , *args , **kw )

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning ( msg , *args , **kw )

Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.

See Python’s logging module for details of message formatting.

class holoviews.util. opts ( **params ) [source]

Bases: param.parameterized.ParameterizedFunction

Utility function to set options either at the global level or on a specific object.

To set opts globally use:

opts(options)

Where options may be an options specification string (as accepted by the %opts magic) or an options specifications dictionary.

For instance:

opts(“Curve (color=’k’)”) # Or equivalently opts({‘Curve’: {‘style’: {‘color’:’k’}}})

To set opts on a specific object, just supply it as the second argument:

opts(options, obj)

For instance:

curve = hv.Curve([1,2,3]) opts(“Curve (color=’k’)”, curve) # Or equivalently opts({‘Curve’: {‘style’: {‘color’:’k’}}}, curve)

These two modes are equivalent to the %opts line magic and the %%opts cell magic respectively.

param Boolean strict ( allow_None=False, bounds=(0, 1), constant=False, default=False, instantiate=False, pickle_default_value=True, precedence=None, readonly=False )
Whether to be strict about the options specification. If not set to strict (default), any invalid keywords are simply skipped. If strict, invalid keywords prevent the options being applied.
debug ( msg , *args , **kw )

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults ( )

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

classmethod expand_options ( options , backend=None ) [source]

Validates and expands a dictionaries of options indexed by type[.group][.label] keys into separate style, plot and norm options.

opts.expand_options({‘Image’: dict(cmap=’viridis’, show_title=False)})

returns

{‘Image’: {‘plot’: dict(show_title=False), ‘style’: dict(cmap=’viridis’)}}
force_new_dynamic_value = functools.partial(<function Parameterized.force_new_dynamic_value>, <class 'holoviews.util.opts'>)
get_param_values = functools.partial(<function Parameterized.get_param_values>, <class 'holoviews.util.opts'>)
get_value_generator = functools.partial(<function Parameterized.get_value_generator>, <class 'holoviews.util.opts'>)
inspect_value = functools.partial(<function Parameterized.inspect_value>, <class 'holoviews.util.opts'>)
instance = functools.partial(<function ParameterizedFunction.instance>, <class 'holoviews.util.opts'>)
message ( msg , *args , **kw )

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

params ( parameter_name=None )

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint ( imports=None , prefix='\n ' , unknown_value='<?>' , qualify=False , separator='' )

Same as Parameterized.pprint, except that X.classname(Y is replaced with X.classname.instance(Y

print_param_defaults ( )

Print the default values of all cls’s Parameters.

print_param_values ( )

Print the values of all this object’s Parameters.

script_repr ( imports=[] , prefix=' ' )

Same as Parameterized.script_repr, except that X.classname(Y is replaced with X.classname.instance(Y

set_default ( param_name , value )

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = functools.partial(<function Parameterized.set_dynamic_time_fn>, <class 'holoviews.util.opts'>)
set_param = functools.partial(<function Parameterized.set_param>, <class 'holoviews.util.opts'>)
state_pop ( )

Restore the most recently saved state.

See state_push() for more details.

state_push ( )

Save this instance’s state.

For Parameterized instances, this includes the state of dynamically generated values.

Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().

Generally, this method is used by operations that need to test something without permanently altering the objects’ state.

verbose ( msg , *args , **kw )

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning ( msg , *args , **kw )

Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.

See Python’s logging module for details of message formatting.

class holoviews.util. output ( **params ) [source]

Bases: param.parameterized.ParameterizedFunction

Helper used to set HoloViews display options. Arguments are supplied as a series of keywords in any order:

backend : The backend used by HoloViews fig : The static figure format holomap : The display type for holomaps widgets : The widget mode for widgets fps : The frames per second used for animations max_frames : The max number of frames rendered (default 500) size : The percentage size of displayed output dpi : The rendered dpi of the figure charwidth : The max character width for displaying helper (default 80) filename : The filename of the saved output, if any (default None) info : The information to page about the displayed objects (default False) css : Optional css style attributes to apply to the figure image tag

param Boolean filename_warning ( allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False )
Whether to warn if the output utility is called on an object and a filename is not given (in which case the utility has no effect)
debug ( msg , *args , **kw )

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults ( )

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = functools.partial(<function Parameterized.force_new_dynamic_value>, <class 'holoviews.util.output'>)
get_param_values = functools.partial(<function Parameterized.get_param_values>, <class 'holoviews.util.output'>)
get_value_generator = functools.partial(<function Parameterized.get_value_generator>, <class 'holoviews.util.output'>)
inspect_value = functools.partial(<function Parameterized.inspect_value>, <class 'holoviews.util.output'>)
instance = functools.partial(<function ParameterizedFunction.instance>, <class 'holoviews.util.output'>)
message ( msg , *args , **kw )

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

params ( parameter_name=None )

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint ( imports=None , prefix='\n ' , unknown_value='<?>' , qualify=False , separator='' )

Same as Parameterized.pprint, except that X.classname(Y is replaced with X.classname.instance(Y

print_param_defaults ( )

Print the default values of all cls’s Parameters.

print_param_values ( )

Print the values of all this object’s Parameters.

script_repr ( imports=[] , prefix=' ' )

Same as Parameterized.script_repr, except that X.classname(Y is replaced with X.classname.instance(Y

set_default ( param_name , value )

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = functools.partial(<function Parameterized.set_dynamic_time_fn>, <class 'holoviews.util.output'>)
set_param = functools.partial(<function Parameterized.set_param>, <class 'holoviews.util.output'>)
state_pop ( )

Restore the most recently saved state.

See state_push() for more details.

state_push ( )

Save this instance’s state.

For Parameterized instances, this includes the state of dynamically generated values.

Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().

Generally, this method is used by operations that need to test something without permanently altering the objects’ state.

verbose ( msg , *args , **kw )

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning ( msg , *args , **kw )

Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.

See Python’s logging module for details of message formatting.

holoviews.util. renderer ( name ) [source]

Helper utility to access the active renderer for a given extension.


command Module

python -m holoviews.util.command Conversion_Example.ipynb OR holoviews Conversion_Example.ipynb


parser Module

Inheritance diagram of holoviews.util.parser

The magics offered by the HoloViews IPython extension are powerful and support rich, compositional specifications. To avoid the the brittle, convoluted code that results from trying to support the syntax in pure Python, this file defines suitable parsers using pyparsing that are cleaner and easier to understand.

Pyparsing is required by matplotlib and will therefore be available if HoloViews is being used in conjunction with matplotlib.

class holoviews.util.parser. CompositorSpec [source]

Bases: holoviews.util.parser.Parser

The syntax for defining a set of compositor is as follows:

[ mode op(spec) [settings] value ]+

The components are:

mode : Operation mode, either ‘data’ or ‘display’. group : Value identifier with capitalized initial letter. op : The name of the operation to apply. spec : Overlay specification of form (A * B) where A and B are

dotted path specifications.
settings : Optional list of keyword arguments to be used as
parameters to the operation (in square brackets).
collect_tokens ( parseresult , mode )

Collect the tokens from a (potentially) nested parse result.

classmethod parse ( line , ns={} ) [source]

Parse compositor specifications, returning a list Compositors

todict ( parseresult , mode='parens' , ns={} )

Helper function to return dictionary given the parse results from a pyparsing.nestedExpr object (containing keywords).

The ns is a dynamic namespace (typically the IPython Notebook namespace) used to update the class-level namespace.

class holoviews.util.parser. OptsSpec [source]

Bases: holoviews.util.parser.Parser

An OptsSpec is a string specification that describes an OptionTree. It is a list of tree path specifications (using dotted syntax) separated by keyword lists for any of the style, plotting or normalization options. These keyword lists are denoted ‘plot(..)’, ‘style(…)’ and ‘norm(…)’ respectively. These three groups may be specified even more concisely using keyword lists delimited by square brackets, parentheses and braces respectively. All these sets are optional and may be supplied in any order.

For instance, the following string:

Image (interpolation=None) plot(show_title=False) Curve style(color=’r’)

Would specify an OptionTree where Image has “interpolation=None” for style and ‘show_title=False’ for plot options. The Curve has a style set such that color=’r’.

The parser is fairly forgiving; commas between keywords are optional and additional spaces are often allowed. The only restriction is that keywords must be immediately followed by the ‘=’ sign (no space).

classmethod apply_deprecations ( path ) [source]

Convert any potentially deprecated paths and issue appropriate warnings

collect_tokens ( parseresult , mode )

Collect the tokens from a (potentially) nested parse result.

classmethod parse ( line , ns={} ) [source]

Parse an options specification, returning a dictionary with path keys and {‘plot’:<options>, ‘style’:<options>} values.

classmethod process_normalization ( parse_group ) [source]

Given a normalization parse group (i.e. the contents of the braces), validate the option list and compute the appropriate integer value for the normalization plotting option.

todict ( parseresult , mode='parens' , ns={} )

Helper function to return dictionary given the parse results from a pyparsing.nestedExpr object (containing keywords).

The ns is a dynamic namespace (typically the IPython Notebook namespace) used to update the class-level namespace.

class holoviews.util.parser. Parser [source]

Bases: object

Base class for magic line parsers, designed for forgiving parsing of keyword lists.

classmethod collect_tokens ( parseresult , mode ) [source]

Collect the tokens from a (potentially) nested parse result.

classmethod todict ( parseresult , mode='parens' , ns={} ) [source]

Helper function to return dictionary given the parse results from a pyparsing.nestedExpr object (containing keywords).

The ns is a dynamic namespace (typically the IPython Notebook namespace) used to update the class-level namespace.


settings Module

Inheritance diagram of holoviews.util.settings
class holoviews.util.settings. KeywordSettings [source]

Bases: object

Base class for options settings used to specified collections of keyword options.

classmethod extract_keywords ( line , items ) [source]

Given the keyword string, parse a dictionary of options.

classmethod get_options ( items , options , warnfn ) [source]

Given a keyword specification, validate and compute options

classmethod update_options ( options , items ) [source]

Allows updating options depending on class attributes and unvalidated options.

class holoviews.util.settings. OutputSettings [source]

Bases: holoviews.util.settings.KeywordSettings

Class for controlling display and output settings.

extract_keywords ( line , items )

Given the keyword string, parse a dictionary of options.

get_options ( items , options , warnfn )

Given a keyword specification, validate and compute options

classmethod update_options ( options , items ) [source]

Switch default options and backend if new backend is supplied in items.

holoviews.util.settings. list_formats ( format_type , backend=None ) [source]

Returns list of supported formats for a particular backend.