# Scale 1D curve to reference (compute-only) ## Summary Compute scale factor between two 1D curves using robust least squares. ## Metadata - **Module ID:** FindScaleFactor1D - **Module path:** /home/runner/work/MoDaCor/MoDaCor/src/modacor/modules/base_modules/find_scale_factor1d.py - **Module version:** 20251212.2 - **Keywords:** scale, calibration, 1D ## Required data keys - signal ## Modifies - **scale_factor**: signal, uncertainties, units - **scale_background**: signal, uncertainties, units ## Required arguments - _None_ ## Default configuration ```json { "background_output_key": "scale_background", "fit_background": false, "fit_max_val": null, "fit_min_val": null, "fit_val_units": null, "independent_axis_key": "Q", "interpolation_kind": "linear", "require_overlap": true, "robust_fscale": 1.0, "robust_loss": "huber", "scale_output_key": "scale_factor", "signal_key": "signal", "use_basedata_weights": true } ``` ## Argument specification | Argument | Type | Required | Default | Description | |---|---|---|---|---| | `background_output_key` | str | No | scale_background | BaseData key to store the fitted background output. | | `fit_background` | bool | No | False | Whether to fit a constant background offset. | | `fit_max_val` | float or int or NoneType | No | - | Maximum x-value for the fit (in fit_val_units). | | `fit_min_val` | float or int or NoneType | No | - | Minimum x-value for the fit (in fit_val_units). | | `fit_val_units` | str or NoneType | No | - | Units for fit_min_val/fit_max_val if provided. | | `independent_axis_key` | str | No | Q | BaseData key for the independent axis. | | `interpolation_kind` | str | No | linear | Interpolation kind passed to scipy/numpy interpolation. | | `require_overlap` | bool | No | True | Require overlapping x-range between reference and work data. | | `robust_fscale` | float or int | No | 1.0 | Robust loss scale parameter. | | `robust_loss` | str | No | huber | Robust loss function name for the fit. | | `scale_output_key` | str | No | scale_factor | BaseData key to store the scale factor output. | | `signal_key` | str | No | signal | BaseData key for the dependent variable signal. | | `use_basedata_weights` | bool | No | True | Use BaseData weights when fitting. |