From 67a8bd066ebea8ae86284e4ce6d01f7757ffcf14 Mon Sep 17 00:00:00 2001 From: "Adam J. Jackson" Date: Wed, 6 Sep 2023 09:52:20 +0100 Subject: [PATCH] Downcase FWHM, STD to fwhm, std: non-breaking change The implementation is case-insensitive, this just makes the code more consistent to read. Existing scripts and tests should be unaffected --- doc/source/spectra.rst | 2 +- euphonic/broadening.py | 2 +- euphonic/spectra.py | 24 ++++++++++++------------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/doc/source/spectra.rst b/doc/source/spectra.rst index c5faf53ec..aa7c5cee5 100644 --- a/doc/source/spectra.rst +++ b/doc/source/spectra.rst @@ -86,7 +86,7 @@ apply this resolution function to a Spectrum1D we package the polynomial into a def tosca_resolution(energy): poly_in_wavenumber = Polynomial([2.5, 0.005, 1e-7]) return poly_in_wavenumber(energy.to('1/cm').magnitude) * ureg('1/cm') - dos_tosca = dos.broaden(tosca_resolution, shape='gauss', width_convention='STD') + dos_tosca = dos.broaden(tosca_resolution, shape='gauss', width_convention='std') Plotting -------- diff --git a/euphonic/broadening.py b/euphonic/broadening.py index d408e0912..8e0f6339d 100644 --- a/euphonic/broadening.py +++ b/euphonic/broadening.py @@ -24,7 +24,7 @@ def variable_width_broadening( width_function: Callable[[Quantity], Quantity], weights: Union[np.ndarray, Quantity], width_lower_limit: Quantity = None, - width_convention: Literal['FWHM', 'STD'] = 'FWHM', + width_convention: Literal['fwhm', 'std'] = 'fwhm', adaptive_error: float = 1e-2, shape: KernelShape = 'gauss', fit: ErrorFit = 'cheby-log' diff --git a/euphonic/spectra.py b/euphonic/spectra.py index 365babdfc..3626cd29d 100644 --- a/euphonic/spectra.py +++ b/euphonic/spectra.py @@ -577,7 +577,7 @@ def broaden(self: T, x_width: CallableQuantity, shape: KernelShape = 'gauss', method: Optional[Literal['convolve']] = None, width_lower_limit: Optional[Quantity] = None, - width_convention: Literal['FWHM', 'STD'] = 'FWHM', + width_convention: Literal['fwhm', 'std'] = 'fwhm', width_interpolation_error: float = 0.01, width_fit: ErrorFit = 'cheby-log' ) -> T: # noqa: F811 @@ -587,7 +587,7 @@ def broaden(self: T, x_width, shape='gauss', method=None, width_lower_limit=None, - width_convention='FWHM', + width_convention='fwhm', width_interpolation_error=0.01, width_fit='cheby-log' ) -> T: # noqa: F811 @@ -613,8 +613,8 @@ def broaden(self: T, x_width, Set a lower bound to width obtained calling x_width function. By default, this is equal to bin width. To disable, set to -Inf. width_convention - By default ('FWHM'), x_width is interpreted as full-width - half-maximum. Set to 'STD' to instead define standard deviation. + By default ('fwhm'), x_width is interpreted as full-width + half-maximum. Set to 'std' to instead define standard deviation. width_interpolation_error When x_width is a callable function, variable-width broadening is implemented by an approximate kernel-interpolation scheme. This @@ -1046,7 +1046,7 @@ def broaden(self: T, x_width: CallableQuantity, shape: KernelShape = 'gauss', method: Optional[Literal['convolve']] = None, width_lower_limit: Optional[Quantity] = None, - width_convention: Literal['FWHM', 'STD'] = 'FWHM', + width_convention: Literal['fwhm', 'std'] = 'fwhm', width_interpolation_error: float = 0.01, width_fit: ErrorFit = 'cheby-log' ) -> T: # noqa: F811 @@ -1057,7 +1057,7 @@ def broaden(self: T, shape='gauss', method=None, width_lower_limit=None, - width_convention='FWHM', + width_convention='fwhm', width_interpolation_error=0.01, width_fit='cheby-log' ) -> T: # noqa: F811 @@ -1084,8 +1084,8 @@ def broaden(self: T, Set a lower bound to width obtained calling x_width function. By default, this is equal to bin width. To disable, set to -Inf. width_convention - By default ('FWHM'), x_width is interpreted as full-width - half-maximum. Set to 'STD' to instead define standard deviation. + By default ('fwhm'), x_width is interpreted as full-width + half-maximum. Set to 'std' to instead define standard deviation. width_interpolation_error When x_width is a callable function, variable-width broadening is implemented by an approximate kernel-interpolation scheme. This @@ -1355,7 +1355,7 @@ def broaden(self: T, method: Optional[Literal['convolve']] = None, x_width_lower_limit: Quantity = None, y_width_lower_limit: Quantity = None, - width_convention: Literal['FWHM', 'STD'] = 'FWHM', + width_convention: Literal['fwhm', 'std'] = 'fwhm', width_interpolation_error: float = 0.01, width_fit: ErrorFit = 'cheby-log' ) -> T: @@ -1391,8 +1391,8 @@ def broaden(self: T, Set a lower bound to width obtained calling y_width function. By default, this is equal to y bin width. To disable, set to -Inf. width_convention - By default ('FWHM'), widths are interpreted as full-width - half-maximum. Set to 'STD' to instead define standard deviation. + By default ('fwhm'), widths are interpreted as full-width + half-maximum. Set to 'std' to instead define standard deviation. width_interpolation_error When x_width is a callable function, variable-width broadening is implemented by an approximate kernel-interpolation scheme. This @@ -1463,7 +1463,7 @@ def _broaden_spectrum2d_with_function( width_function: Callable[[Quantity], Quantity], axis: Literal['x', 'y'] = 'y', width_lower_limit: Quantity = None, - width_convention: Literal['FWHM', 'STD'] = 'FWHM', + width_convention: Literal['fwhm', 'std'] = 'fwhm', width_interpolation_error: float = 1e-2, shape: KernelShape = 'gauss', width_fit: ErrorFit = 'cheby-log'