This release collects a number of API-breaking changes, creating a
sustainable platform for futher development. It doesn't add a
drastic number of new features compared with recent minor releases.
Still, we would draw particular attention to the work on isotope data,
which includes an expanded "Sears1992" reference data set. This should
allow proper comparison incoherent and coherent DOS weightings for
systems including isotopic substitutions, and support work on
incoherent structure factor calculations in the new "abinslib" library.
During the v1 era Euphonic has done a decent job of "semantic
versioning", and we intend to continue this way. It is recommended
that once downstream code is adapted to work with Euphonic 2.0,
Euphonic is pinned to the range 2.x,<3 (by your favourite mechanism
and syntax).
-
CLI changes
- The
--instrument-broadeningparameter ofeuphonic-dosis
deprecated and hidden. The old--energy-broadeningparameter
is now functionally the same; i.e. it can no longer set the
adaptive broadening width and--adaptive-scalemust be used for that purpose.
- The
-
API changes
-
Many public functions and methods now use keyword-only arguments
where previously these were permitted to be keyword or positional.- This will break code that depends on these arguments being in a
specific order rather than calling them by name - The most "obvious" arguments can still be accessed by position
for concise "standard" function calls; the goal is not to make
downstream code drastically more verbose. - The purpose of this is to give more flexibility to add features
or alias arguments while deprecating/changing their behaviour,
without breaking the public API between major releases.
- This will break code that depends on these arguments being in a
-
The various Spectrum classes have an
assert_regular_bins
method. It is now forbidden to use positional arguments and in the
2D casesbin_axhas a default value of "y". This makes the API
safer and more formally correct. -
Unused argument
use_brilleis removed from
euphonic.cli.brille_convergence.check_brille_settings. -
get_args()function removed fromeuphonic.cli.utils; this
was previously simplified to a one-liner so brings no DRY benefit. -
Some public functions in
Crystal(reciprocal_lattice,
cell_volume) are now@cached_propertyand don't need().
The cache will be cleared on settingcell_vectorsso direct changes
to the_cell_vectorsattribute may cause desynchronisation. -
euphonic.cli.utilshas been broken up into submodules. All the
appropriate functions are re-exported to__all__so this
should not break API in practice, but e.g. Quantity can no longer
be imported fromeuphonic.cli.utils. -
The
euphonic.datapackage has been redistributed to keep data
files underneath their relevant module/package. Isotopic data is
now undereuphonic.isotopes.dataand unit registry
configuration is undereuphonic.ureg.data. -
The "adaptive fit" parameter is removed from spectrum broaden()
methods and euphonic-dos; "cubic" parametrisation is removed and
superior "cheby-log" fit always used. -
validate._check_constructor_inputsis reworked to use a sequence
ofvalidate.InputCheckNamedTupleclasses as arguments. -
The
.copy()method has been removed from Spectrum classes; use
copy.copy()orcopy.deepcopy()from the standard library instead.
Note thatcopy.deepcopy()is closer to the legacy behaviour and carries
much less risk of unintended side-effects. -
euphonic.util.get_reference_datais deprecated and will be
removed in Euphonic 2.0. Please useIsotopeData.get_propertyinstead.
-
-
Features
-
Spectrum classes now implement
__eq__and can be compared with
==. -
Spectrum1DCollection and Spectrum2DCollection can be indexed with
slices where the stop value exceeds the collection
length. (e.g. if a collection of 5 spectra is indexed with [3:10]
it will return a collection with the spectra at indices 3 and 4.)
This is consistent with the behaviour of Python lists and numpy
arrays.These slices can also be 0-size.
Previously this would raise an IndexError. Technically it is a
breaking change as somebody's code could depend on this
IndexError. -
A new API has been created for isotope data. The IsotopeData
protocol promises a method .get_property(Structure, key) which
will return per-atom values; typically these are neutron cross-sections.Currently this is backward-compatible and datasets may still be
specified as a string or provided as a dict; these methods are likely to be
deprecated as the system matures.A new implementation of the Sears1992 dataset has been
created. This now supports more data columns (i.e. it can be used
for both incoherent and coherent scattering lengths and cross
sections) and has a full set of isotopes (as per 1992 data, anyway).
The correct isotope or mixture is selected automatically using
element symbols and mass data from Crystal.
-
-
Other changes
-
Fixed several typing issues with Spectrum collections.
-
Error messages have been overhauled and now follow a consistent format::
summary
[reason]
fix
-
-
Maintenance
- Extend use of Python 3.10
match\ es overifwhere relevant.
- Extend use of Python 3.10