paramcomparison package

Module contents

class paramcomparison.ParamComparison(grid, reader)[source]

A class to initiate the generation of pages

Parameters:
  • grid (dict: str -> (val0, val1, ...)) – A dictionary whose keys are strings of variable names and values are sequences of values to be tried for the corresponding variable.
  • reader (readers.Reader (or its subclass) object) – The Reader class to load and process data.
Raises TypeError:
 

When reader is not an instance of readers.Reader.

generate_pages(outdir, writer, row_field, col_field)[source]

Generate a set of pages

Parameters:
  • outdir (str) – The directory to write files to.
  • writer (writers.Writer (or its subclass) object) – The writer to be used.
  • row_field (str) – The field to be used in rows.
  • col_field (str) – The field to be used in columns.
Returns:

None

Raises TypeError:
 

When writer is not an instance of writers.Writer.

Submodules

paramcomparison.readers module

class paramcomparison.readers.Reader[source]

Bases: object

The base class for all readers, which define how to read and process data.

read(params)[source]
Parameters:params (dict) – A dict which contains the values of parameters.
Returns:The entry corresponding to the parameters.
Return type:str
class paramcomparison.readers.UserFunctionReader(func, data)[source]

Bases: paramcomparison.readers.Reader

A class which relays the reading to a user function.

read(params)[source]

This function calls the user function. When calling the function, the first parameter is params, and the second parameter of the data variable passed in in __init__().

Returns:What func returns.

See also

Reader.read().

paramcomparison.writers module

class paramcomparison.writers.RstWriter(indent_size=4)[source]

Bases: paramcomparison.writers.Writer

A class to write RST output.

get_file_name(name)[source]

See Writer.get_file_name().

write_separator()[source]

See Writer.write_separator().

write_table(names, params, row_idx, row_values, col_idx, col_values, values)[source]

See Writer.write_table().

write_title(comparison_param)[source]

See Writer.write_title().

class paramcomparison.writers.Writer[source]

Bases: object

The base class for all writers, which define how to write output in specific formats.

get_file_name(name)[source]
Parameters:name (str) – Comparison parameter name.
Returns:The file name given the comparison parameter name
Return type:str
write_separator()[source]
Returns:The separator between two sets of tables.
Return type:str
write_table(names, params, row_idx, row_values, col_idx, col_values, values)[source]
Parameters:
  • names (sequence of strings) – A sequence of names of fields.
  • params (sequence of strings) – A sequence of parameters corresponding to the variable name in the same position of names.
  • row_idx (int) – The index of the row field.
  • row_values (sequence of strings) – A sequence of all possible values of the row fields.
  • col_idx (int) – The index of the column field.
  • col_values (sequence of strings) – A sequence of all possible values of the column fields.
  • values (dict: (str, str) -> str) – A dictionary whose key is an element of the Cartesion product of row_values and col_values, and value is the corresponding result in the table entry.
Returns:

The table string

Return type:

str

write_title(comparison_param)[source]
Parameters:comparison_param (str) – Comparison parameter name.
Returns:The file title given the comparison parameter name
Return type:str