MCPcopy Create free account
hub / github.com/NSLS2/PyXRF / single_pixel_fitting_controller

Function single_pixel_fitting_controller

pyxrf/model/fit_spectrum.py:1775–1963  ·  view source on GitHub ↗

Parameters ---------- input_data: array 3D array of spectrum parameter: dict parameter for fitting incident_energy: float, optional incident beam energy in KeV method: str, optional fitting method, default as nnls pixel_bin: int, optional

(
    input_data,
    parameter,
    incident_energy=None,
    method="nnls",
    pixel_bin=0,
    raise_bg=0,
    comp_elastic_combine=False,
    linear_bg=False,
    use_snip=True,
    bin_energy=1,
    dask_client=None,
)

Source from the content-addressed store, hash-verified

1773
1774
1775def single_pixel_fitting_controller(
1776 input_data,
1777 parameter,
1778 incident_energy=None,
1779 method="nnls",
1780 pixel_bin=0,
1781 raise_bg=0,
1782 comp_elastic_combine=False,
1783 linear_bg=False,
1784 use_snip=True,
1785 bin_energy=1,
1786 dask_client=None,
1787):
1788 """
1789 Parameters
1790 ----------
1791 input_data: array
1792 3D array of spectrum
1793 parameter: dict
1794 parameter for fitting
1795 incident_energy: float, optional
1796 incident beam energy in KeV
1797 method: str, optional
1798 fitting method, default as nnls
1799 pixel_bin: int, optional
1800 bin pixel as 2by2, or 3by3
1801 raise_bg: int, optional
1802 add a constant value to each spectrum, better for fitting
1803 comp_elastic_combine: bool, optional
1804 combine elastic and compton as one component for fitting
1805 linear_bg: bool, optional
1806 use linear background instead of snip
1807 use_snip: bool, optional
1808 use snip method to remove background
1809 bin_energy: int, optional
1810 bin spectrum with given value
1811 dask_client: dask.distributed.Client
1812 Dask client object. If None, then Dask client is created automatically.
1813 If a batch of files is processed, then creating Dask client and
1814 passing the reference to it to the processing functions will save
1815 execution time: `client = Client(processes=True, silence_logs=logging.ERROR)`
1816
1817 Returns
1818 -------
1819 result_map : dict
1820 of elemental map for given elements
1821 calculation_info : dict
1822 dict of fitting information
1823 """
1824 param = copy.deepcopy(parameter)
1825 if incident_energy is not None:
1826 param["coherent_sct_energy"]["value"] = incident_energy
1827
1828 n_bin_low, n_bin_high = get_energy_bin_range(
1829 num_energy_bins=input_data.shape[2],
1830 low_e=param["non_fitting_values"]["energy_bound_low"]["value"],
1831 high_e=param["non_fitting_values"]["energy_bound_high"]["value"],
1832 e_offset=param["e_offset"]["value"],

Callers 2

fit_pixel_data_and_saveFunction · 0.85
fit_single_pixelMethod · 0.85

Calls 5

get_energy_bin_rangeFunction · 0.85
_log_unsupported_optionFunction · 0.85
fit_xrf_mapFunction · 0.85
TerminalProgressBarClass · 0.85
calculate_areaFunction · 0.85

Tested by

no test coverage detected