mlreflect.curve_fitter package
Submodules
mlreflect.curve_fitter.curve_fitter module
- class mlreflect.curve_fitter.curve_fitter.CurveFitter(trained_model: mlreflect.models.trained_model.TrainedModel)[source]
Bases:
object
Make a prediction on specular reflectivity data based on the trained model.
- Parameters
trained_model –
TrainedModel
object that contains the trained Keras model, the trained q values, the standardization values and the sample structure.
- fit_curve(corrected_curve: numpy.ndarray, q_values: numpy.ndarray, dq: float = 0, factor: float = 1, polish=False, fraction_bounds: tuple = (0.5, 0.5, 0.1), optimize_q=True, n_q_samples: int = 1000, optimize_scaling=False, n_scale_samples: int = 300, simulate_reflectivity=True) dict [source]
Return predicted reflectivity and thin film properties based footprint-corrected data.
- Parameters
corrected_curve – “Ideal” reflectivity curve that has already been treated with footprint correction and other intensity corrections and is normalized to 1.
q_values – Corresponding q values for each of the intensity values in units of 1/A.
dq – Q-shift that is applied before interpolation of the data to the trained q values. Can sometimes improve the results if the total reflection edge is not perfectly aligned.
factor – Multiplicative factor that is applied to the data after interpolation. Can sometimes improve the results if the total reflection edge is not perfectly aligned.
polish – If
True
, the predictions will be refined with a simple least log mean squares minimization viascipy.optimize.minimize
. This can often improve the “fit” of the model curve to the data at the expense of higher prediction times.fraction_bounds – The relative fitting bounds if the LMS for thickness, roughness and SLD, respectively. E.g. if the predicted thickness was 150 A, then a value of 0.5 would mean the fit bounds are
(75, 225)
.optimize_q – If
True
, the q interpolation will be resampled with small q shifts in a range of about +-0.003 1/A and the neural network prediction with the smallest MSE will be selected. Ifpolish=True
, this step will happen before the LMS fit.n_q_samples – Number of q shift samples that will be generated. More samples can lead to a better result, but will increase the prediction time.
optimize_scaling – If
True
, the interpolated input curve is randomly rescaled by a factor between 0.9 and 1.1 and the neural network prediction with the smallest MSE will be selected. Ifpolish=True
, this step will happen before the LMS fit. Ifoptimize_q=True
, this will step will happen after the q shift optimization.n_scale_samples – Number of curve scaling samples that will be generated. More samples can lead to a better result, but will increase the prediction time.
simulate_reflectivity – If
True
(default), the reflectivity according to the predicted parameter values will be simulated as well. This might slow down the prediction times.
- Returns
- A dictionary containing the fit results:
'predicted_reflectivity'
: Numpyndarray
of the predicted intensity.'predicted_parameters'
: PandasDataFrame
of the predicted thin film parameters.'best_shift'
: Q shift that lead to the prediction with the lowest MSE. IsNone
ifoptimize_q=False
.'best_scaling'
: Curve scaling factor that lead to the prediction with the lowest MSE. IsNone
ifoptimize_scaling=False
.
- Return type
dict
mlreflect.curve_fitter.file_fitter module
mlreflect.curve_fitter.fio_fitter module
- class mlreflect.curve_fitter.fio_fitter.DefaultFioFitter[source]
Bases:
mlreflect.curve_fitter.fio_fitter.FioFitter
FioFitter
that is initialized with a pre-trained model for reflectivity on single-layer systems on Si/SiOx.
- class mlreflect.curve_fitter.fio_fitter.FioFitter[source]
Bases:
mlreflect.curve_fitter.base_fitter.BaseFitter
- property file_stem
- fit(scan_number: int, trim_front: int = None, trim_back: int = None, roi: list = None, theta_offset: float = 0.0, dq: float = 0.0, factor: float = 1.0, plot=False, polish=True, fraction_bounds=(0.5, 0.5, 0.1), optimize_q=True, n_q_samples=1000, reload=True) mlreflect.curve_fitter.results.FitResult [source]
Extract scan from file and predict thin film parameters.
- Parameters
scan_number – Scan number of the scan that is to be fitted.
trim_front – How many intensity points are cropped from the beginning.
trim_back – How many intensity points are cropped from the end.
roi – Alternative region of interest in the raw detector image that will be converted to a reflectivity curve. The roi specifications must be a list of integers that specify the pixel boundaries in the format
[left, bottom, right, top]
, e.g.roi=[241, 106, 247, 109]
. This will override the default roi counter.theta_offset – Angular correction that is added before transformation to q space.
dq – Q-shift that is applied before interpolation of the data to the trained q values. Can sometimes improve the results if the total reflection edge is not perfectly aligned.
factor – Multiplicative factor that is applied to the data after interpolation. Can sometimes improve the results if the total reflection edge is not perfectly aligned.
plot – If set to
True
, the intensity prediction is shown in a plot.polish – If
True
, the predictions will be refined with a simple least log mean squares minimization viascipy.optimize.minimize
. This can often improve the “fit” of the model curve to the data at the expense of higher prediction times.fraction_bounds – The relative fitting bounds if the LMS for thickness, roughness and SLD, respectively. E.g. if the predicted thickness was 150 A, then a value of 0.5 would mean the fit bounds are
(75, 225)
.optimize_q – If
True
, the q interpolation will be resampled with small q shifts in a range of about +-0.003 1/A and the neural network prediction with the smallest MSE will be selected. Ifpolish=True
, this step will happen before the LMS fit.n_q_samples – Number of q shift samples that will be generated. More samples can lead to a better result, but will increase the prediction time.
reload – Decide whether or not to reload all scans in the directory before extracting the data for the fit (default
True
). Depending on the number of scans, this can take some time.
- Returns
- An object that contains the fit results as well as useful methods to plot and save
the results.
- Return type
FitResult
- fit_range(scan_range: range, trim_front: int = None, trim_back: int = None, roi: list = None, theta_offset: float = 0.0, dq: float = 0.0, factor: float = 1.0, plot=False, polish=True, fraction_bounds=(0.5, 0.5, 0.1), optimize_q=True, n_q_samples=1000, reload=True) mlreflect.curve_fitter.results.FitResultSeries [source]
Iterate fit method over a range of scans.
- set_footprint_params(sample_length: float, beam_width: float, beam_shape: str = 'gauss', normalize_to: str = 'max')[source]
Set the parameters necessary to apply footprint correction.
- Parameters
sample_length – Sample length along the beam direction in mm.
beam_width – Beam width along the beam direction (height). For a gaussian beam profile this is the full width at half maximum.
beam_shape –
'gauss'
(default) for a gaussian beam profile'box'
for a box profilenormalize_to –
'max'
(default): normalize data by the highest intensity value'first'
: normalize data by the first intensity value
- set_import_params(two_theta_counter='tt', default_roi_name='p100k', attenuator_counter='atten_position', division_counter: Optional[str] = None)[source]
Set the parameters necessary to correctly import the scans from the file.
- Parameters
two_theta_counter – Name of the counter that contains half the scattering angle (default:
'om'
).default_roi_name – Counter name of the default region of interest that is extracted as reflectivity (default:
'p100k'
).attenuator_counter – Counter of the applied attenuator used to correct possible kinks in the data.
division_counter – Optional counter that is used to divide the intensity counter by.
mlreflect.curve_fitter.minimizer module
- mlreflect.curve_fitter.minimizer.curve_scaling_variants(corrected_reflectivity, n_variants, scale=0.1)[source]
Create
n_variants
reflectivity curve variants with randomly distributed scaling factors.
- mlreflect.curve_fitter.minimizer.curve_variant_log_mse(curve, variant_curves)[source]
Calculate the log MSE of a curve and a
ndarray
of curves
- mlreflect.curve_fitter.minimizer.least_log_mean_squares_fit(q_values, data, predicted_labels, sample, output_preprocessor, fraction_bounds=(0.5, 0.5, 0.1))[source]
Fits the data with a model curve with
scipy.optimize.curve_fit
usingpredicted_labels
as start values.
- mlreflect.curve_fitter.minimizer.log_mse_loss(prep_labels, data, generator, output_preprocessor)[source]
MSE loss between a reflectivity curve and a model curve generated with the given normalized labels.
mlreflect.curve_fitter.results module
- class mlreflect.curve_fitter.results.FitResult(scan_number, corrected_reflectivity, q_values_input, predicted_reflectivity, q_values_prediction, predicted_parameters, best_q_shift, sample, timestamp: Optional[str] = None)[source]
Bases:
object
- FORMAT = '%.5e'
- property curve_mse
- property interpolated_corrected_reflectivity
- plot_prediction(parameters: list)[source]
Plot the corrected data and the predicted reflectivity curve and print the predictions for
parameters
.
- save_corrected_reflectivity(path: str)[source]
Save the measured and corrected reflectivity in a text file with the first column being the q values.
- save_predicted_parameters(path: str, delimiter='\t')[source]
Save all predicted parameters in a text file with the given delimiter.
- save_predicted_reflectivity(path: str)[source]
Save the predicted reflectivity in a text file with the first column being the q values.
- property sld_profile
- class mlreflect.curve_fitter.results.FitResultSeries(fit_results_list)[source]
Bases:
object
- property curve_mse
- property delta_t
- plot_predicted_parameter_range(parameters: list, x_format='time')[source]
Plot predicted parameters in parameters against scan number or time (relative to the first scan). :param parameters: List of strings of which parameters are plotted. Possible values are
'thickness'
, :param'roughness'
or'sld'
.: :param x_format: Ifx_format='time'
(default), the x axis will be formatted using the timestamps of each scan. :param Ifx_format='scan'
: :param the x axis will show the scan numbers instead. If no timestamps are available it: :param will always use'scan'
.:
- save_corrected_reflectivity(path: str)[source]
Save the measured and corrected reflectivity in a text file with the first column being the q values.
- save_predicted_parameters(path: str, delimiter='\t')[source]
Save all predicted parameters in a text file with the given delimiter.
- save_predicted_reflectivity(path: str)[source]
Save the predicted reflectivity in a text file with the first column being the q values.
- property sld_profiles
mlreflect.curve_fitter.spec_fitter module
- class mlreflect.curve_fitter.spec_fitter.DefaultSpecFitter[source]
Bases:
mlreflect.curve_fitter.spec_fitter.SpecFitter
SpecFitter
that is initialized with a pre-trained model for reflectivity on single-layer systems on Si/SiOx.
- class mlreflect.curve_fitter.spec_fitter.SpecFitter[source]
Bases:
mlreflect.curve_fitter.base_fitter.BaseFitter
Load reflectivity scans from a SPEC file and fit them using a trained neural network model.
- Before use:
A neural network model has to be set via the
set_trained_model()
method.Import parameters have to be defined via the
set_import_params()
method.Parameters for footprint correction have to be defined via
set_footprint_params()
method.The input SPEC file has to be specified via the
set_spec_file()
method.
- fit(scan_number: int, trim_front: int = None, trim_back: int = None, theta_offset: float = 0.0, dq: float = 0.0, factor: float = 1.0, plot=False, polish=True, fraction_bounds: tuple = (0.5, 0.5, 0.1), optimize_q=True, n_q_samples: int = 1000, optimize_scaling=False, n_scale_samples: int = 300, reload=True) mlreflect.curve_fitter.results.FitResult [source]
Extract scan from SPEC file and predict thin film parameters.
- Parameters
scan_number – SPEC scan number of the scan that is to be fitted.
trim_front – How many intensity points are cropped from the beginning.
trim_back – How many intensity points are cropped from the end.
theta_offset – Angular correction that is added before transformation to q space.
dq – Q-shift that is applied before interpolation of the data to the trained q values. Can sometimes improve the results if the total reflection edge is not perfectly aligned.
factor – Multiplicative factor that is applied to the data after interpolation. Can sometimes improve the results if the total reflection edge is not perfectly aligned.
plot – If set to
True
, the intensity prediction is shown in a plot.polish – If
True
, the predictions will be refined with a simple least log mean squares minimization viascipy.optimize.minimize
. This can often improve the “fit” of the model curve to the data at the expense of higher prediction times.fraction_bounds – The relative fitting bounds if the LMS for thickness, roughness and SLD, respectively. E.g. if the predicted thickness was 150 A, then a value of 0.5 would mean the fit bounds are
(75, 225)
.optimize_q – If
True
, the q interpolation will be resampled with small q shifts in a range of about +-0.003 1/A and the neural network prediction with the smallest MSE will be selected. Ifpolish=True
, this step will happen before the LMS fit.n_q_samples – Number of q shift samples that will be generated. More samples can lead to a better result, but will increase the prediction time.
optimize_scaling – If
True
, the interpolated input curve is randomly rescaled by a factor between 0.9 and 1.1 and the neural network prediction with the smallest MSE will be selected. Ifpolish=True
, this step will happen before the LMS fit. Ifoptimize_q=True
, this will step will happen after the q shift optimization.n_scale_samples – Number of curve scaling samples that will be generated. More samples can lead to a better result, but will increase the prediction time.
reload – Decide whether or not to reload all scans in the directory before extracting the data for the fit (default
True
). Depending on the number of scans, this can take some time.
- Returns
- An object that contains the fit results as well as useful methods to plot and save
the results.
- Return type
FitResult
- fit_range(scan_range: Iterable, trim_front: int = None, trim_back: int = None, theta_offset: float = 0.0, dq: float = 0.0, factor: float = 1.0, plot=False, polish=True, fraction_bounds=(0.5, 0.5, 0.1), optimize_q=True, n_q_samples=1000, reload=True) mlreflect.curve_fitter.results.FitResultSeries [source]
Iterate fit method over a range of scans.
- set_file(spec_file_path: str)[source]
Define the full path of the SPEC file from which the scans are read.
- set_footprint_params(wavelength: float, sample_length: float, beam_width: float, beam_shape: str = 'gauss', normalize_to: str = 'max')[source]
Set the parameters necessary to apply footprint correction.
- Parameters
wavelength – Photon wavelength in Angstroms.
sample_length – Sample length along the beam direction in mm.
beam_width – Beam width along the beam direction (height). For a gaussian beam profile this is the full width at half maximum.
beam_shape –
'gauss'
(default) for a gaussian beam profile'box'
for a box profilenormalize_to –
'max'
(default): normalize data by the highest intensity value'first'
: normalize data by the first intensity value
- set_import_params(angle_columns: list, intensity_column: str, attenuator_column: Optional[str] = None, division_column: Optional[str] = None)[source]
Set the parameters necessary to correctly import the scans from the SPEC file.
- Parameters
angle_columns – List of SPEC counters that are summed up to form the full scattering angle (2theta).
intensity_column – SPEC counter from which the intensity is extracted from.
attenuator_column – SPEC counter of the applied attenuator used to correct possible kinks in the data.
division_column – Optional SPEC counter that is used to divide the intensity counter by.
- show_scans(min_scan: int = None, max_scan: int = None, reload=True)[source]
Show information about all scans from
min_scan
tomax_scan
.
- property spec_file
Module contents
- class mlreflect.curve_fitter.CurveFitter(trained_model: mlreflect.models.trained_model.TrainedModel)[source]
Bases:
object
Make a prediction on specular reflectivity data based on the trained model.
- Parameters
trained_model –
TrainedModel
object that contains the trained Keras model, the trained q values, the standardization values and the sample structure.
- fit_curve(corrected_curve: numpy.ndarray, q_values: numpy.ndarray, dq: float = 0, factor: float = 1, polish=False, fraction_bounds: tuple = (0.5, 0.5, 0.1), optimize_q=True, n_q_samples: int = 1000, optimize_scaling=False, n_scale_samples: int = 300, simulate_reflectivity=True) dict [source]
Return predicted reflectivity and thin film properties based footprint-corrected data.
- Parameters
corrected_curve – “Ideal” reflectivity curve that has already been treated with footprint correction and other intensity corrections and is normalized to 1.
q_values – Corresponding q values for each of the intensity values in units of 1/A.
dq – Q-shift that is applied before interpolation of the data to the trained q values. Can sometimes improve the results if the total reflection edge is not perfectly aligned.
factor – Multiplicative factor that is applied to the data after interpolation. Can sometimes improve the results if the total reflection edge is not perfectly aligned.
polish – If
True
, the predictions will be refined with a simple least log mean squares minimization viascipy.optimize.minimize
. This can often improve the “fit” of the model curve to the data at the expense of higher prediction times.fraction_bounds – The relative fitting bounds if the LMS for thickness, roughness and SLD, respectively. E.g. if the predicted thickness was 150 A, then a value of 0.5 would mean the fit bounds are
(75, 225)
.optimize_q – If
True
, the q interpolation will be resampled with small q shifts in a range of about +-0.003 1/A and the neural network prediction with the smallest MSE will be selected. Ifpolish=True
, this step will happen before the LMS fit.n_q_samples – Number of q shift samples that will be generated. More samples can lead to a better result, but will increase the prediction time.
optimize_scaling – If
True
, the interpolated input curve is randomly rescaled by a factor between 0.9 and 1.1 and the neural network prediction with the smallest MSE will be selected. Ifpolish=True
, this step will happen before the LMS fit. Ifoptimize_q=True
, this will step will happen after the q shift optimization.n_scale_samples – Number of curve scaling samples that will be generated. More samples can lead to a better result, but will increase the prediction time.
simulate_reflectivity – If
True
(default), the reflectivity according to the predicted parameter values will be simulated as well. This might slow down the prediction times.
- Returns
- A dictionary containing the fit results:
'predicted_reflectivity'
: Numpyndarray
of the predicted intensity.'predicted_parameters'
: PandasDataFrame
of the predicted thin film parameters.'best_shift'
: Q shift that lead to the prediction with the lowest MSE. IsNone
ifoptimize_q=False
.'best_scaling'
: Curve scaling factor that lead to the prediction with the lowest MSE. IsNone
ifoptimize_scaling=False
.
- Return type
dict
- class mlreflect.curve_fitter.DefaultFioFitter[source]
Bases:
mlreflect.curve_fitter.fio_fitter.FioFitter
FioFitter
that is initialized with a pre-trained model for reflectivity on single-layer systems on Si/SiOx.
- class mlreflect.curve_fitter.DefaultSpecFitter[source]
Bases:
mlreflect.curve_fitter.spec_fitter.SpecFitter
SpecFitter
that is initialized with a pre-trained model for reflectivity on single-layer systems on Si/SiOx.
- class mlreflect.curve_fitter.FioFitter[source]
Bases:
mlreflect.curve_fitter.base_fitter.BaseFitter
- property file_stem
- fit(scan_number: int, trim_front: int = None, trim_back: int = None, roi: list = None, theta_offset: float = 0.0, dq: float = 0.0, factor: float = 1.0, plot=False, polish=True, fraction_bounds=(0.5, 0.5, 0.1), optimize_q=True, n_q_samples=1000, reload=True) mlreflect.curve_fitter.results.FitResult [source]
Extract scan from file and predict thin film parameters.
- Parameters
scan_number – Scan number of the scan that is to be fitted.
trim_front – How many intensity points are cropped from the beginning.
trim_back – How many intensity points are cropped from the end.
roi – Alternative region of interest in the raw detector image that will be converted to a reflectivity curve. The roi specifications must be a list of integers that specify the pixel boundaries in the format
[left, bottom, right, top]
, e.g.roi=[241, 106, 247, 109]
. This will override the default roi counter.theta_offset – Angular correction that is added before transformation to q space.
dq – Q-shift that is applied before interpolation of the data to the trained q values. Can sometimes improve the results if the total reflection edge is not perfectly aligned.
factor – Multiplicative factor that is applied to the data after interpolation. Can sometimes improve the results if the total reflection edge is not perfectly aligned.
plot – If set to
True
, the intensity prediction is shown in a plot.polish – If
True
, the predictions will be refined with a simple least log mean squares minimization viascipy.optimize.minimize
. This can often improve the “fit” of the model curve to the data at the expense of higher prediction times.fraction_bounds – The relative fitting bounds if the LMS for thickness, roughness and SLD, respectively. E.g. if the predicted thickness was 150 A, then a value of 0.5 would mean the fit bounds are
(75, 225)
.optimize_q – If
True
, the q interpolation will be resampled with small q shifts in a range of about +-0.003 1/A and the neural network prediction with the smallest MSE will be selected. Ifpolish=True
, this step will happen before the LMS fit.n_q_samples – Number of q shift samples that will be generated. More samples can lead to a better result, but will increase the prediction time.
reload – Decide whether or not to reload all scans in the directory before extracting the data for the fit (default
True
). Depending on the number of scans, this can take some time.
- Returns
- An object that contains the fit results as well as useful methods to plot and save
the results.
- Return type
FitResult
- fit_range(scan_range: range, trim_front: int = None, trim_back: int = None, roi: list = None, theta_offset: float = 0.0, dq: float = 0.0, factor: float = 1.0, plot=False, polish=True, fraction_bounds=(0.5, 0.5, 0.1), optimize_q=True, n_q_samples=1000, reload=True) mlreflect.curve_fitter.results.FitResultSeries [source]
Iterate fit method over a range of scans.
- set_footprint_params(sample_length: float, beam_width: float, beam_shape: str = 'gauss', normalize_to: str = 'max')[source]
Set the parameters necessary to apply footprint correction.
- Parameters
sample_length – Sample length along the beam direction in mm.
beam_width – Beam width along the beam direction (height). For a gaussian beam profile this is the full width at half maximum.
beam_shape –
'gauss'
(default) for a gaussian beam profile'box'
for a box profilenormalize_to –
'max'
(default): normalize data by the highest intensity value'first'
: normalize data by the first intensity value
- set_import_params(two_theta_counter='tt', default_roi_name='p100k', attenuator_counter='atten_position', division_counter: Optional[str] = None)[source]
Set the parameters necessary to correctly import the scans from the file.
- Parameters
two_theta_counter – Name of the counter that contains half the scattering angle (default:
'om'
).default_roi_name – Counter name of the default region of interest that is extracted as reflectivity (default:
'p100k'
).attenuator_counter – Counter of the applied attenuator used to correct possible kinks in the data.
division_counter – Optional counter that is used to divide the intensity counter by.
- class mlreflect.curve_fitter.SpecFitter[source]
Bases:
mlreflect.curve_fitter.base_fitter.BaseFitter
Load reflectivity scans from a SPEC file and fit them using a trained neural network model.
- Before use:
A neural network model has to be set via the
set_trained_model()
method.Import parameters have to be defined via the
set_import_params()
method.Parameters for footprint correction have to be defined via
set_footprint_params()
method.The input SPEC file has to be specified via the
set_spec_file()
method.
- fit(scan_number: int, trim_front: int = None, trim_back: int = None, theta_offset: float = 0.0, dq: float = 0.0, factor: float = 1.0, plot=False, polish=True, fraction_bounds: tuple = (0.5, 0.5, 0.1), optimize_q=True, n_q_samples: int = 1000, optimize_scaling=False, n_scale_samples: int = 300, reload=True) mlreflect.curve_fitter.results.FitResult [source]
Extract scan from SPEC file and predict thin film parameters.
- Parameters
scan_number – SPEC scan number of the scan that is to be fitted.
trim_front – How many intensity points are cropped from the beginning.
trim_back – How many intensity points are cropped from the end.
theta_offset – Angular correction that is added before transformation to q space.
dq – Q-shift that is applied before interpolation of the data to the trained q values. Can sometimes improve the results if the total reflection edge is not perfectly aligned.
factor – Multiplicative factor that is applied to the data after interpolation. Can sometimes improve the results if the total reflection edge is not perfectly aligned.
plot – If set to
True
, the intensity prediction is shown in a plot.polish – If
True
, the predictions will be refined with a simple least log mean squares minimization viascipy.optimize.minimize
. This can often improve the “fit” of the model curve to the data at the expense of higher prediction times.fraction_bounds – The relative fitting bounds if the LMS for thickness, roughness and SLD, respectively. E.g. if the predicted thickness was 150 A, then a value of 0.5 would mean the fit bounds are
(75, 225)
.optimize_q – If
True
, the q interpolation will be resampled with small q shifts in a range of about +-0.003 1/A and the neural network prediction with the smallest MSE will be selected. Ifpolish=True
, this step will happen before the LMS fit.n_q_samples – Number of q shift samples that will be generated. More samples can lead to a better result, but will increase the prediction time.
optimize_scaling – If
True
, the interpolated input curve is randomly rescaled by a factor between 0.9 and 1.1 and the neural network prediction with the smallest MSE will be selected. Ifpolish=True
, this step will happen before the LMS fit. Ifoptimize_q=True
, this will step will happen after the q shift optimization.n_scale_samples – Number of curve scaling samples that will be generated. More samples can lead to a better result, but will increase the prediction time.
reload – Decide whether or not to reload all scans in the directory before extracting the data for the fit (default
True
). Depending on the number of scans, this can take some time.
- Returns
- An object that contains the fit results as well as useful methods to plot and save
the results.
- Return type
FitResult
- fit_range(scan_range: Iterable, trim_front: int = None, trim_back: int = None, theta_offset: float = 0.0, dq: float = 0.0, factor: float = 1.0, plot=False, polish=True, fraction_bounds=(0.5, 0.5, 0.1), optimize_q=True, n_q_samples=1000, reload=True) mlreflect.curve_fitter.results.FitResultSeries [source]
Iterate fit method over a range of scans.
- set_file(spec_file_path: str)[source]
Define the full path of the SPEC file from which the scans are read.
- set_footprint_params(wavelength: float, sample_length: float, beam_width: float, beam_shape: str = 'gauss', normalize_to: str = 'max')[source]
Set the parameters necessary to apply footprint correction.
- Parameters
wavelength – Photon wavelength in Angstroms.
sample_length – Sample length along the beam direction in mm.
beam_width – Beam width along the beam direction (height). For a gaussian beam profile this is the full width at half maximum.
beam_shape –
'gauss'
(default) for a gaussian beam profile'box'
for a box profilenormalize_to –
'max'
(default): normalize data by the highest intensity value'first'
: normalize data by the first intensity value
- set_import_params(angle_columns: list, intensity_column: str, attenuator_column: Optional[str] = None, division_column: Optional[str] = None)[source]
Set the parameters necessary to correctly import the scans from the SPEC file.
- Parameters
angle_columns – List of SPEC counters that are summed up to form the full scattering angle (2theta).
intensity_column – SPEC counter from which the intensity is extracted from.
attenuator_column – SPEC counter of the applied attenuator used to correct possible kinks in the data.
division_column – Optional SPEC counter that is used to divide the intensity counter by.
- show_scans(min_scan: int = None, max_scan: int = None, reload=True)[source]
Show information about all scans from
min_scan
tomax_scan
.
- property spec_file