Mlreflect

Latest version: v0.21.1

Safety actively analyzes 714919 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 2 of 4

0.17.2

Added

- Added SLD profile plotting to `FitResults` class.

Fixed

- Fixed error in the `FitResult` class where the original curve was not plotted in the same range as the predicted
curve.

0.17.1

Added

- The `xrrloader` package is now included in the package code to avoid dependency problems.
- Added optional LMS fit refinement of the neural network prediction based on the log mean squared error of the
measured curve and predicted curve. To use this, the keyword argument `polish=True` has to be passed to the fit
methods of the `CurveFitter` and `SpecFitter` class.
- The `SpecFitter` class now provides its output as a `FitResult` object, which can be used to plot the prediction
or access different parts of the result more easily. The results plot now also shows the SLD profile of the
prediction.
- Added two example files as package resources, which are now detailed in `MANIFEST.in`:
* `resources/examples/example.spec` is an example file that can be used to test `SpecFitter`.
* `resources/examples/example.dat` is an ascii file that contains reflectivity data that can be used to test
`CurveFitter`.
- Complex layer parameters are now fully supported (in particular for complex SLDs).
- Added more tests.

Changed

- The DefaultTrainedModel now has only 3 prediction parameters `Film_thickness`, `Film_roughness` and `Film_sld`,
i.e. the thickness of the oxide layer is no longer predicted.
- The default model is now trained with absorption of the Si/SiOx substrate included.
- The number of weights of the DefaultTrainedModel has been reduced to save memory and prediction time.
- `CurveFitter.fit_curve()` can now also fit 2D arrays of data (instead of only single curves)
- Removed warning that was printed via print if the `refl1d` package is not available. Now it is `warnings.warn()`
and shows up only when the `ReflectivityGenerator` object is initialized.

Fixed

- Fixed order of arguments of `SpecFitter.show_scans()`.
- Fixed wrong in-place behavior of `utils.label_helpers.convert_to_dataframe()`.

0.16.0

Added

- Added an exception to the `ReflectivityGenerator.simulate_reflectivity()` method that allows a fall-back to the
built-in reflectivity simulation if for some reason the `refl1d` package cannot be loaded (for example if the C
code compilation failed).
- Added various docstrings for the `curve_fitter` module.
- Added `fit_range()` method to the `SpecFitter` class.
- Added more requirements to `requirements.txt` and added specific version numbers.

Changed

- Made keyword arguments for `SpecFitter` class parameter methods explicit.
- Shift predicted `predicted_q_values` output from `SpecFitter` class by `dq` argument.

Fixed

- Fixed test imports

0.15.2

Added

- Added more docstrings for new classes.

Changed

- Moved all high-level imports from the `mlreflect` package to its respective sub-packages for a better structure.

Fixed

- Fixed dependency issues during where requirements are already called before they are installed
- Added `packaging` module to the requirements

0.15.1

Added

- Added `UniformNoiseGenerator` class
- Added `Trainer` and `TrainedModel` classes to simplify on-the-fly training
- Added a `default_trained_model.h5` package resource that contains a trained keras model to fit XRR of a single
layer on a Si/SiOx substrate in air/vacuum.
- Added `DefaultTrainedModel` subclass that automatically loads the default model.
- Added `CurveFitter` and `SpecFitter` classes for easier on-the-fly fitting.

Changed

- Update example notebook

Fixed

- Fixed small bug in `mlreflect.noise.apply_scaling_factor()`. Now it returns a copy of the data.

0.15.0

Added

- Added the `Parameter` class and its subclasses to make the definition of `Layer` objects easier.
- `Parameter` objects can also be sampled to create random labels for training data generation.
- Added a `Layer` subclass `ConstantLayer` which can only contain fixed parameters (no ranges)
- Added two `ConstantLayer` subclasses `Substrate` and `AmbientLayer` which are now used to make `MultilayerStructure`
objects.
- `Substrate` objects don't have a thickness.
- `AmbientLayer` objects only have an SLD.
- A `MultilayerStructure` object can now be exported to and read from a dictionary with the `to_dict()` and
`from_dict()` methods.
- Added a `copy()` method to all `Layer` and `MultilayerStructure` classes.

Changed

- `Layer` objects now initialize with `Parameter` objects instead of range tuples for each thin film parameter.
- `MultilayerStructure` objects are no longer initialized with the ambient layer SLD. Instead, the ambient layer and
substrate are defined with separate methods.
- The substrate and ambient layer are by default constant layers
- Moved the different sampling distribution for training label generation to a new module
`data_generation.distributions`
- The optional parameter `q_noise_spread` of the `ReflectivityGenerator` class to simulate noisy _q_ values was
moved from the initializer to the `simulate_reflectivity()` method.
- Removed the option to remove non-constant labels from the training labels when using the `OutputPreprocessor` class,
because it was somewhat confusing and found little use.

Page 2 of 4

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.