savu.data.stats.statistics module

class Statistics[source]
calc_rmsd(array1, array2)[source]
static calc_rss(array1, array2)[source]
calc_slice_stats(my_slice, base_slice=None, pad=True)[source]

Calculates and returns slice stats for the current slice.

Parameters
  • my_slice – The slice whose stats are being calculated.

  • base_slice – Provide a base slice to calculate residuals from, to calculate RMSD.

  • pad – Specify whether slice is padded or not (usually can leave as True even if slice is not padded).

calc_stats_residuals(stats_before, stats_after)[source]
calc_volume_stats(slice_stats)[source]

Calculates and returns volume-wide stats from slice-wide stats.

Parameters

slice_stats – The slice-wide stats that the volume-wide stats are calculated from.

static calc_zeros(my_slice)[source]
get_stats(p_num=None, stat=None, instance=- 1)[source]

Returns stats associated with a certain plugin, given the plugin number (its place in the process list).

Parameters
  • p_num – Plugin number of the plugin whose associated stats are being fetched. If p_num <= 0, it is relative to the plugin number of the current plugin being run. E.g current plugin number = 5, p_num = -2 –> will return stats of the third plugin. By default will gather stats for the current plugin.

  • stat – Specify the stat parameter you want to fetch, i.e ‘max’, ‘mean’, ‘median_std_dev’. If left blank will return the whole dictionary of stats: {‘max’: , ‘min’: , ‘mean’: , ‘mean_std_dev’: , ‘median_std_dev’: , ‘NRMSD’: }

  • instance – In cases where there are multiple set of stats associated with a plugin due to iterative loops or multi-parameters, specify which set you want to retrieve, i.e 3 to retrieve the stats associated with the third run of a plugin. Pass ‘all’ to get a list of all sets. By default will retrieve the most recent set.

get_stats_from_dataset(dataset, stat=None, instance=- 1)[source]

Returns stats associated with a dataset.

Parameters
  • dataset – The dataset whose associated stats are being fetched.

  • stat – Specify the stat parameter you want to fetch, i.e ‘max’, ‘mean’, ‘median_std_dev’. If left blank will return the whole dictionary of stats: {‘max’: , ‘min’: , ‘mean’: , ‘mean_std_dev’: , ‘median_std_dev’: , ‘NRMSD’: }

  • instance – In cases where there are multiple set of stats associated with a dataset due to iterative loops or multi-parameters, specify which set you want to retrieve, i.e 3 to retrieve the stats associated with the third run of a plugin. Pass ‘all’ to get a list of all sets. By default will retrieve the most recent set.

get_stats_from_name(plugin_name, n=None, stat=None, instance=- 1)[source]

Returns stats associated with a certain plugin.

Parameters
  • plugin_name – name of the plugin whose associated stats are being fetched.

  • n – In a case where there are multiple instances of plugin_name in the process list, specify the nth instance. Not specifying will select the first (or only) instance.

  • stat – Specify the stat parameter you want to fetch, i.e ‘max’, ‘mean’, ‘median_std_dev’. If left blank will return the whole dictionary of stats: {‘max’: , ‘min’: , ‘mean’: , ‘mean_std_dev’: , ‘median_std_dev’: , ‘NRMSD’: }

  • instance – In cases where there are multiple set of stats associated with a plugin due to iterative loops or multi-parameters, specify which set you want to retrieve, i.e 3 to retrieve the stats associated with the third run of a plugin. Pass ‘all’ to get a list of all sets. By default will retrieve the most recent set.

static rmsd_from_rss(rss, n)[source]
set_slice_stats(my_slice, base_slice=None, pad=True)[source]

Sets slice stats for the current slice.

Parameters
  • my_slice – The slice whose stats are being set.

  • base_slice – Provide a base slice to calculate residuals from, to calculate RMSD.

  • pad – Specify whether slice is padded or not (usually can leave as True even if slice is not padded).

set_stats_key(stats_key)[source]

Changes which stats are to be calculated for the current plugin.

Parameters

stats_key – List of stats to be calculated.

set_stats_residuals(residuals)[source]
set_time(seconds)[source]

Sets time taken for plugin to complete.

set_volume_stats()[source]

Calculates volume-wide statistics from slice stats, and updates class-wide arrays with these values. Links volume stats with the output dataset and writes slice stats to file.

setup(plugin_self, pattern=None)[source]
start_time()[source]

Called at the start of a plugin.

stop_time()[source]

Called at the ebd of a plugin.

write_slice_stats_to_file(slice_stats=None, p_num=None, comm=<Mock name='mock.MPI.COMM_WORLD' id='140070287344848'>)[source]

Writes slice statistics to a h5 file. Placed in the stats folder in the output directory. Currently unused.