BGlib.be.analysis.fitter.Fitter¶
- class BGlib.be.analysis.fitter.Fitter(h5_main, proc_name, variables=None, **kwargs)[source]¶
Bases:
Process
Creates a new instance of the abstract Fitter class
- Parameters:
h5_main (h5py.Dataset or pyUSID.io.USIDataset object) – Main datasets whose one or dimensions will be reduced
proc_name (str or unicode) – Name of the child process
variables (str or list, optional) – List of spectroscopic dimension names that will be reduced
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) – Keyword arguments that will be passed on to pyUSID.processing.process.Process
Methods
Creates placeholders for the results, applies the
_unit_computation()
to chunks of the datasetComputes the Fit
Computes the Guess
Performs necessary book-keeping before do_fit can be called
Performs necessary book-keeping before do_guess can be called
Tests the process on a subset (for example a pixel) of the whole data.
Extracts the necessary parameters from the provided h5 group to resume computation
Attributes
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:
- do_fit(*args, override=False, **kwargs)[source]¶
Computes the Fit
- Parameters:
- Returns:
HDF5 dataset with the Fit computed
- Return type:
USIDataset
- do_guess(*args, override=False, **kwargs)[source]¶
Computes the Guess
- Parameters:
- 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(h5_partial_fit=None, h5_guess=None)[source]¶
Performs necessary book-keeping before do_fit can be called
- Parameters:
h5_partial_fit (h5py.Dataset or pyUSID.io.USIDataset, optional) – HDF5 dataset containing partial Fit. Not implemented
h5_guess (h5py.Dataset or pyUSID.io.USIDataset, optional) – HDF5 dataset containing completed Guess. Not implemented
- set_up_guess(h5_partial_guess=None)[source]¶
Performs necessary book-keeping before do_guess can be called
- Parameters:
h5_partial_guess (h5py.Dataset or pyUSID.io.USIDataset, optional) – HDF5 dataset containing partial Guess. Not implemented
- 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