BGlib.be.analysis.be_sho_fitter.BESHOfitter

class BGlib.be.analysis.be_sho_fitter.BESHOfitter(h5_main, **kwargs)[source]

Bases: Fitter

Creates an instance of the BESHOFitter class

Parameters:
  • h5_main (pyUSID.io.USIDataset) – Main dataset containing band excitation measurement

  • h5_target_group (h5py.Group, optional. Default = None) – Location where to look for existing results and to place newly computed results. Use this kwarg if the results need to be written to a different HDF5 file. By default, this value is set to the parent group containing h5_main

  • kwargs (dict, optional) – Keyword arguments such as “verbose” and “cores” that will be passed onto Process

Methods

compute

Creates placeholders for the results, applies the _unit_computation() to chunks of the dataset

do_fit

Computes the Fit

do_guess

Computes the Guess

set_up_fit

Need this because during the set up, we won't know which strategy is being used.

set_up_guess

Need this because during the set up, we won't know which strategy is being used.

test

Tests the process on a subset (for example a pixel) of the whole data.

use_partial_computation

Extracts the necessary parameters from the provided h5 group to resume computation

Attributes

parms_dict

The name of the HDF5 dataset that should be present to signify which positions have already been computed This is NOT a fully private variable so that multiple processes can be run within a single group - Eg Fitter In the case of Fitter - this name can be changed from 'completed_guesses' to 'completed_fits' check_for_duplicates will be called by the Child class where they have the opportunity to change this variable before checking for duplicates

compute(override=False, *args, **kwargs)

Creates placeholders for the results, applies the _unit_computation() to chunks of the dataset

Parameters:
  • override (bool, optional. default = False) – By default, compute will simply return duplicate results to avoid recomputing or resume computation on a group with partial results. Set to True to force fresh computation.

  • args (list) – arguments to the mapped function in the correct order

  • kwargs (dict) – keyword arguments to the mapped function

Returns:

h5_results_grp – Group containing all the results

Return type:

h5py.Group

do_fit(*args, override=False, **kwargs)

Computes the Fit

Parameters:
  • args (list, optional) – List of arguments

  • override (bool, optional) – If True, computes a fresh guess even if existing Fit was found Else, returns existing Fit dataset. Default = False

  • kwargs (dict, optional) – Keyword arguments

Returns:

HDF5 dataset with the Fit computed

Return type:

USIDataset

do_guess(*args, override=False, **kwargs)

Computes the Guess

Parameters:
  • args (list, optional) – List of arguments

  • override (bool, optional) – If True, computes a fresh guess even if existing Guess was found Else, returns existing Guess dataset. Default = False

  • kwargs (dict, optional) – Keyword arguments

Returns:

HDF5 dataset with the Guesses computed

Return type:

USIDataset

parms_dict

The name of the HDF5 dataset that should be present to signify which positions have already been computed This is NOT a fully private variable so that multiple processes can be run within a single group - Eg Fitter In the case of Fitter - this name can be changed from ‘completed_guesses’ to ‘completed_fits’ check_for_duplicates will be called by the Child class where they have the opportunity to change this variable before checking for duplicates

set_up_fit(fit_func=SHOFitFunc.least_squares, *func_args, h5_partial_fit=None, h5_guess=None, **func_kwargs)[source]

Need this because during the set up, we won’t know which strategy is being used. Should Guess be its own Process class in that case? If so, it would end up having its own group etc.

set_up_guess(guess_func=SHOGuessFunc.complex_gaussian, h5_partial_guess=None, *func_args, **func_kwargs)[source]

Need this because during the set up, we won’t know which strategy is being used. Should Guess be its own Process class in that case? If so, it would end up having its own group etc.

Parameters:
  • guess_func (SHOGuessFunc, optional) – Which guess method to use. Default is complex gaussian

  • h5_partial_guess (h5py.Dataset, optional) – Partial guess results dataset to continue computing on

test(**kwargs)

Tests the process on a subset (for example a pixel) of the whole data. The class can be re-instantiated with improved parameters and tested repeatedly until the user is content, at which point the user can call compute() on the whole dataset.

Notes

This is not a function that is expected to be called in MPI

Parameters:
  • dict (kwargs -) – keyword arguments to test the process

  • optional – keyword arguments to test the process

use_partial_computation(h5_partial_group=None)

Extracts the necessary parameters from the provided h5 group to resume computation

Parameters:

h5_partial_group (h5py.Group) – Group containing partially computed results