Package schrodinger :: Package application :: Package canvas :: Module driverutils
[hide private]
[frames] | no frames]

Module driverutils

Utility functions for writing Canvas drivers in python.

Copyright Schrodinger, LLC. All rights reserved.

Functions [hide private]
 
gen_range_specification(spec, max_endpoint=None)
A generator of ints from a range specification.
 
get_range_specification(spec, max_endpoint=None)
A function to return the ints determined by the string range specification.
 
option_float_varargs_callback(option, opt_str, value, parser)
A callback to be used with the OptionParser to give an option a variable number of string arguments.
 
option_string_varargs_callback(option, opt_str, value, parser)
A callback to be used with the OptionParser to allow an option to have a variable number of arguments that will be converted to a list of floats.
 
get_driver_option_parser(opts)
A function to create an OptionParser with standard options that are used in multiple Canvas drivers.
 
open_csv(input_file, delimiter, y, independent_vars=None, field_in=None, field_out=None)
Return a ChmDelimitedPatterns object that has been opened with specification of a dependent variable.
 
open_multiy_csv(input_file, delimiter, y, independent_vars=None, field_in=None, field_out=None)
Return a ChmMultiYDelimitedPatterns object that has been opened with specification of a dependent variable.
 
get_excluded_columns(input_file, delimiter, independent_vars=None, field_in=None, field_out=None)
Given an input file and delimiter, get the columns that should be excluded from processing.
 
print_report(model_reporter, output_file=None)
Given a ChmModelReporter, print the log.
Variables [hide private]
  __package__ = 'schrodinger.application.canvas'
Function Details [hide private]

gen_range_specification(spec, max_endpoint=None)

 

A generator of ints from a range specification.

Note that if max_endpoint is None the generator will yield results to infinity.

get_range_specification(spec, max_endpoint=None)

 

A function to return the ints determined by the string range specification.

Parameters:
  • max_endpoint - If provided, will fill in explicit values through max_endpoint and set the 'to_end' return value to False.
Returns:
A tuple (values, to_end) of specific values to include and a boolean indicating whether to continue through the final endpoint.

get_driver_option_parser(opts)

 

A function to create an OptionParser with standard options that are used in multiple Canvas drivers.

Options are generally stored under mnemonic attribute names rather than the option name itself.

The mapping is as follows:

  • d is delimiter
  • fieldIn is field_in
  • fieldOut is field_out
  • in is input_file
  • lt is train_list
  • lx is independent_vars
  • out is output_file
  • seed is random_seed

Some names are stored as their option names:

  • build
  • y
Parameters:
  • opts (list of strings) - A list of names of options to add.

open_multiy_csv(input_file, delimiter, y, independent_vars=None, field_in=None, field_out=None)

 

Return a ChmMultiYDelimitedPatterns object that has been opened with specification of a dependent variable.

Parameters:
  • y (sequence of strings or integers) - A sequence of either column names or numbers (with 1-based indices).

print_report(model_reporter, output_file=None)

 

Given a ChmModelReporter, print the log. If output_file is not None, write to the file; otherwise write to stdout.