BaseSummary

class BaseSummary(sum_op)[source]

Abstract base class for summary contents. Should not be instantiated.

Parameters:

sum_op (BaseOp) – Operation corresponding to this summary.

Methods

BaseSummary.__init__(sum_op)

BaseSummary.dump_summary(filename, summary)

BaseSummary.get_details_dict(summary_info)

Return the summary-specific information.

BaseSummary.get_individual(summary_details)

Return a dictionary of the individual file summaries.

BaseSummary.get_summary([individual_summaries])

Return a summary dictionary with the information.

BaseSummary.get_summary_details([...])

Return a dictionary with the details for individual files and the overall dataset.

BaseSummary.get_text_summary([...])

Return a complete text summary by assembling the individual pieces.

BaseSummary.get_text_summary_details([...])

Return a text summary of the information represented by this summary.

BaseSummary.merge_all_info()

Return merged information.

BaseSummary.save(save_dir[, file_formats, ...])

Save the summaries using the format indicated.

BaseSummary.save_visualizations(save_dir[, ...])

Save summary visualizations, if any, using the format indicated.

BaseSummary.update_summary(summary_dict)

Method to update summary for a given tabular input.

Attributes

BaseSummary.DISPLAY_INDENT

BaseSummary.INDIVIDUAL_SUMMARIES_PATH

BaseSummary.__init__(sum_op)[source]
static BaseSummary.dump_summary(filename, summary)[source]
abstract BaseSummary.get_details_dict(summary_info)[source]

Return the summary-specific information.

Parameters:

summary_info (object) – Summary to return info from.

Returns:

dictionary with the results.

Return type:

dict

Notes

Abstract method be implemented by each individual summary.

Notes

The expected return value is a dictionary of the form:

{“Name”: “”, “Total events”: 0, “Total files”: 0, “Files”: [], “Specifics”: {}}”

BaseSummary.get_individual(summary_details, separately=True)[source]

Return a dictionary of the individual file summaries.

Parameters:
  • summary_details (dict) – Dictionary of the individual file summaries.

  • separately (bool) – If True (the default), each individual summary has a header for separate output.

BaseSummary.get_summary(individual_summaries='separate')[source]

Return a summary dictionary with the information.

Parameters:

individual_summaries (str) – “separate”, “consolidated”, or “none”

Returns:

dict - dictionary with “Dataset” and “Individual files” keys.

Notes: The individual_summaries value is processed as follows:
  • “separate” individual summaries are to be in separate files.

  • “consolidated” means that the individual summaries are in same file as overall summary.

  • “none” means that only the overall summary is produced.

BaseSummary.get_summary_details(include_individual=True)[source]

Return a dictionary with the details for individual files and the overall dataset.

Parameters:

include_individual (bool) – If True, summaries for individual files are included.

Returns:

dict - a dictionary with ‘Dataset’ and ‘Individual files’ keys.

Notes

  • The ‘Dataset’ value is either a string or a dictionary with the overall summary.

  • The ‘Individual files’ value is dictionary whose keys are file names and values are

    their corresponding summaries.

Users are expected to provide merge_all_info and get_details_dict functions to support this.

BaseSummary.get_text_summary(individual_summaries='separate')[source]

Return a complete text summary by assembling the individual pieces.

Parameters:

individual_summaries (str) – One of the values “separate”, “consolidated”, or “none”.

Returns:

Complete text summary.

Return type:

str

Notes: The options are:
  • “none”: Just has “Dataset” key.

  • “consolidated” Has “Dataset” and “Individual files” keys with the values of each is a string.

  • “separate” Has “Dataset” and “Individual files” keys. The values of “Individual files” is a dict.

BaseSummary.get_text_summary_details(include_individual=True)[source]

Return a text summary of the information represented by this summary.

Parameters:

include_individual (bool) – If True (the default), individual summaries are in “Individual files”.

abstract BaseSummary.merge_all_info()[source]

Return merged information.

Returns:

Consolidated summary of information.

Return type:

object

Notes

Abstract method be implemented by each individual summary.

BaseSummary.save(save_dir, file_formats=['.txt'], individual_summaries='separate', task_name='')[source]

Save the summaries using the format indicated.

Parameters:
  • save_dir (str) – Name of the directory to save the summaries in.

  • file_formats (list) – List of file formats to use for saving.

  • individual_summaries (str) – Save one file or multiple files based on setting.

  • task_name (str) – If this summary corresponds to files from a task, the task_name is used in filename.

BaseSummary.save_visualizations(save_dir, file_formats=['.svg'], individual_summaries='separate', task_name='')[source]

Save summary visualizations, if any, using the format indicated.

Parameters:
  • save_dir (str) – Name of the directory to save the summaries in.

  • file_formats (list) – List of file formats to use for saving.

  • individual_summaries (str) – Save one file or multiple files based on setting.

  • task_name (str) – If this summary corresponds to files from a task, the task_name is used in filename.

abstract BaseSummary.update_summary(summary_dict)[source]

Method to update summary for a given tabular input.

Parameters:

summary_dict (dict) –

BaseSummary.DISPLAY_INDENT = '   '
BaseSummary.INDIVIDUAL_SUMMARIES_PATH = 'individual_summaries'