resins.models.pychop module
The [PyChop] model, a 1D model for direct-geometry 2D instruments.
[PyChop], originating from [Mantid] as a single model, is here organised as a collection
of models. These can be split into two types: the PyChopModelFermi model, used for all
instruments with a Fermi chopper (which is the sole determinant of the
chopper contribution to the resolution), and models such as PyChopModelLET and
PyChopModelCNCS, which are models of instruments without a Fermi chopper, in which the
first and last choppers determine the chopper contribution to the
resolution.
All classes within are exposed for reference only and should not be instantiated directly. For
obtaining the resolution function of an instrument, please use the
resins.instrument.Instrument.get_resolution_function method.
- class resins.models.pychop.Detector
Bases:
TypedDictData for the detector.
- Attributes:
- type
Detector type: 1==Li Davidson scintillator, 2==Helium tube binned together, 3==Helium tube.
- phi
Detector scattering angle in degrees.
- depth
Detector depth (diameter for tube) in meters (m).
Methods
clear()copy()fromkeys(iterable[, value])Create a new dictionary with keys from iterable and values set to value.
get(key[, default])Return the value for key if key is in the dictionary, else default.
items()keys()pop(key[, default])If the key is not found, return the default if given; otherwise, raise a KeyError.
popitem(/)Remove and return a (key, value) pair as a 2-tuple.
setdefault(key[, default])Insert key with a value of default if key is not in the dictionary.
update([E, ]**F)If E is present and has a .keys() method, then does: for k in E.keys(): D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
values()
- class resins.models.pychop.DiskChopper
Bases:
TypedDictData for a disk chopper.
- Attributes:
- distance
Distance from moderator to this disk chopper in meters (m).
- nslot
Number of slots in the chopper.
- slot_width
Width of all slots (assumed to be equal) in millimeters (mm).
- slot_ang_pos
Angular position of each slot in the chopper, in degrees. Must be monotonically increasing. If None, equal spacing is assumed.
- guide_width
Width of the guide after the chopper in millimeters (mm).
- radius
Disk radius in millimeters (mm)?
- num_disk
Number of disks making up this disk chopper.
- is_phase_independent
Whether this disk is supposed to be phased independently.
- default_phase
Default phase for this disk chopper. If an
intis provided, it is assumed to be time in microseconds (us), and if astris provided, it is assumed to be a slot index for the desired rep to go through.
Methods
clear()copy()fromkeys(iterable[, value])Create a new dictionary with keys from iterable and values set to value.
get(key[, default])Return the value for key if key is in the dictionary, else default.
items()keys()pop(key[, default])If the key is not found, return the default if given; otherwise, raise a KeyError.
popitem(/)Remove and return a (key, value) pair as a 2-tuple.
setdefault(key[, default])Insert key with a value of default if key is not in the dictionary.
update([E, ]**F)If E is present and has a .keys() method, then does: for k in E.keys(): D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
values()
- class resins.models.pychop.FermiChopper
Bases:
TypedDictData for a Fermi chopper.
- Attributes:
- distance
Distance from moderator to this Fermi chopper in meters (m).
- aperture_distance
Distance from aperture (moderator face) to this Fermi chopper in meters (m).
Methods
clear()copy()fromkeys(iterable[, value])Create a new dictionary with keys from iterable and values set to value.
get(key[, default])Return the value for key if key is in the dictionary, else default.
items()keys()pop(key[, default])If the key is not found, return the default if given; otherwise, raise a KeyError.
popitem(/)Remove and return a (key, value) pair as a 2-tuple.
setdefault(key[, default])Insert key with a value of default if key is not in the dictionary.
update([E, ]**F)If E is present and has a .keys() method, then does: for k in E.keys(): D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
values()
- class resins.models.pychop.Moderator
Bases:
TypedDictData for the moderator.
- Attributes:
- type
Moderator time profile type: 0==chi squared, 1==Ikeda-Carpenter, 2==modified chi squared, 3==polynomial.
- parameters
Time profile parameters.
- scaling_function
The name of the scaling function to use. If None, no scaling will be applied.
- scaling_parameters
The parameters to use for the
scaling_function. Does not have to be provided ifscaling_functionis None.- measured_wavelength
The wavelength at which the moderator contribution to the resolution was measured experimentally. If None, interpolation will not be used and instead the moderator contribution to the resolution will be computed analytically.
- measured_width
The experimentally measured moderator contribution to the resolution (width of the Gaussian) at the
measured_wavelength. Does not have to be provided ifmeasured_wavelengthis None.
Methods
clear()copy()fromkeys(iterable[, value])Create a new dictionary with keys from iterable and values set to value.
get(key[, default])Return the value for key if key is in the dictionary, else default.
items()keys()pop(key[, default])If the key is not found, return the default if given; otherwise, raise a KeyError.
popitem(/)Remove and return a (key, value) pair as a 2-tuple.
setdefault(key[, default])Insert key with a value of default if key is not in the dictionary.
update([E, ]**F)If E is present and has a .keys() method, then does: for k in E.keys(): D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
values()
- exception resins.models.pychop.NoTransmissionError
Bases:
ExceptionA custom Exception used in
PyChopModelFermito signal that no transmission can occur.See
PyChopModelFermi._get_chopper_width_squared.
- class resins.models.pychop.PyChopModel(model_data: ModelData, **_)
Bases:
GaussianKernel1DMixin,SimpleBroaden1DMixin,InstrumentModel,ABCAbstract base class for all PyChop models.
This class provides the concrete implementation for most of PyChop algorithm, only the chopper contribution to the resolution is missing. The following methods must be implemented:
__init__which must take themodel_dataande_initparameters as well as some form of chopper frequency parameters. It should fit a polynomial to the data obtained from the_precompute_resolutionmethod. It must also use the provided_validate_e_initmethod.polynomial- this property should be implemented in such a way that it exposes the polynomial computed in__init__._get_chopper_width_squaredwhich calculates the chopper contribution.
- Parameters:
- model_data
The data associated with the model for a given version of a given instrument.
- Attributes:
- input
The names of the columns in the
omega_qarray expected by all computation methods, i.e. the names of the independent variables ([Q, w]) that the model models.data_classBase class for PyChop model data.
citationThe citation for this model.
polynomialThe polynomial fitted to the resolutions.
Methods
__call__(points, data, *meshes)Broadens the
dataon themeshes.broaden(points, data, mesh)Broadens the
dataon the fullmeshusing the straightforward scheme.get_characteristics(points)Computes the broadening width at each value of energy transfer given by
points.get_kernel(points, mesh)Computes the Gaussian kernel centered on zero on the provided
meshat each (energy transfer or momentum scalar) point inpoints.get_peak(points, mesh)Computes the Gaussian broadening peak on the provided
meshat each (energy transfer or momentum scalar) point inpoints.- data_class
alias of
PyChopModelData
- get_characteristics(points: Float[np.ndarray, 'energy_transfer dimension=1']) dict[str, Float[np.ndarray, 'sigma']]
Computes the broadening width at each value of energy transfer given by
points.The model approximates the broadening using the Gaussian distribution, so the returned widths are in the form of the standard deviation (sigma).
- Parameters:
- points
The energy transfer in meV at which to compute the width in sigma of the kernel. This must be a
samplex 1 2D array wheresampleis the number of energy transfers.
- Returns:
characteristicsThe characteristics of the broadening function, i.e. the Gaussian width as sigma in meV.
- abstract property polynomial: Polynomial
The polynomial fitted to the resolutions.
- Returns:
polynomialThe polynomial modelling the resolution of an instrument at a particular value of incident energy and chopper frequency.
- class resins.models.pychop.PyChopModelCNCS(model_data: PyChopModelDataNonFermi, e_init: float | None = None, resolution_disk_frequency: int | None = None, fermi_frequency: int | None = None, fitting_order: int = 4, **_)
Bases:
PyChopModelNonFermiA PyChop model for the CNCS instrument.
This model is identical to all other PyChop models for instruments without a Fermi chopper, but the setting “chopper frequencies” have unique names compared to the other models.
- Parameters:
- model_data
The data for the PyChopModel of the CNCS instrument.
- e_init
The incident energy used in the INS experiment. If not provided, the default value for the particular version of the CNCS instrument will be used (see
PyChopModelDataNonFermi.defaults). Please note that thee_initvalue must be within the range allowed for the instrument (seePyChopModelDataNonFermi.restrictions).- resolution_disk_frequency
The frequency of the resolution disk chopper (chopper 4). If not provided, the default value for the particular version of the CNCS instrument will be used (see
PyChopModelDataNonFermi.defaults). Please note that theresolution_disk_frequencyvalue must be within the range allowed for the instrument (seePyChopModelDataNonFermi.restrictions).- fermi_frequency
The frequency of the Fermi chopper (chopper 1). If not provided, the default value for the particular version of the CNCS instrument will be used (see
PyChopModelDataNonFermi.defaults). Please note that thefermi_frequencyvalue must be within the range allowed for the instrument (seePyChopModelDataNonFermi.restrictions).- fitting_order
The order of the polynomial used for fitting against the resolution.
- Attributes:
- input
The names of the columns in the
omega_qarray expected by all computation methods, i.e. the names of the independent variables ([Q, w]) that the model models.data_classData for the PyChop models that do not have a Fermi chopper :
citationThe citation for this model.
polynomialThe polynomial fitted to the resolutions.
Methods
__call__(points, data, *meshes)Broadens the
dataon themeshes.broaden(points, data, mesh)Broadens the
dataon the fullmeshusing the straightforward scheme.data_classget_characteristics(points)Computes the broadening width at each value of energy transfer given by
points.get_kernel(points, mesh)Computes the Gaussian kernel centered on zero on the provided
meshat each (energy transfer or momentum scalar) point inpoints.get_long_frequency(frequencies, model_data)Calculates the frequency of each chopper making up this instrument.
get_peak(points, mesh)Computes the Gaussian broadening peak on the provided
meshat each (energy transfer or momentum scalar) point inpoints.- Raises:
InvalidInputErrorIf any of
e_init,resolution_disk_frequency, orfermi_frequencyis not allowed.
- property polynomial
The polynomial fitted to the resolutions.
- Returns:
polynomialThe polynomial modelling the resolution of an instrument at a particular value of incident energy and chopper frequency.
- class resins.models.pychop.PyChopModelData(d_chopper_sample: float, d_sample_detector: float, aperture_width: float, theta: float, frequency_matrix: list[list[float]], choppers: dict[str, FermiChopper | DiskChopper], moderator: Moderator, detector: None | Detector, sample: None | Sample, tjit: float, *, function: str, citation: list[str], defaults: dict[str, int | float], restrictions: dict[str, list[int | float], set[int | float]])
Bases:
ModelDataBase class for PyChop model data.
Corresponds to the abstract base class
PyChopModeland so should not be used directly. Concrete implementations of the PyChop model should have their own model data subclasses of this class.- Attributes:
- function
The name of the function, i.e. the alias for
PantherAbINSModel.- citation
The citation for the model. Please use this to look up more details and cite the model.
- restrictions
All constraints that the model places on the settings. If the value is a
list, this signifies therangestyle (start, stop, step) tuple, and if it is aset, it is a set of explicitly allowed values.- defaults
The default values for the settings, used when a value is not provided when creating the model.
- d_chopper_sample
Distance from the final chopper to sample in meters (m).
- d_sample_detector
Distance from sample to detector in meters (m).
- aperture_width
Width of aperture at moderator face in meters (m)
- theta
The angle that the beamline makes with the moderator face in degrees.
- frequency_matrix
A matrix mapping the relationship between the user-provided parameter
chopper_frequencyor its equivalent (depending on model) to the frequency of each chopper in the instrument.- choppers
Data for each chopper in the instrument. See
FermiChopperandDiskChopperfor more info.- moderator
Data for the moderator. See
Moderatorfor more info.- detector
Data for the detector. See
Detectorfor more info.- sample
Data for the sample. See
Samplefor more info.- tjit
The jitter time in microseconds (us).
- class resins.models.pychop.PyChopModelDataFermi(d_chopper_sample: float, d_sample_detector: float, aperture_width: float, theta: float, frequency_matrix: list[list[float]], choppers: dict[str, FermiChopper | DiskChopper], moderator: Moderator, detector: None | Detector, sample: None | Sample, tjit: float, pslit: float, radius: float, rho: float, *, function: str, citation: list[str], defaults: dict[str, int | float], restrictions: dict[str, list[int | float], set[int | float]])
Bases:
PyChopModelDataData for the
PyChopModelFermimodel.- Attributes:
- function
The name of the function, i.e. the alias for
PantherAbINSModel.- citation
The citation for the model. Please use this to look up more details and cite the model.
- restrictions
All constraints that the model places on the settings. If the value is a
list, this signifies therangestyle (start, stop, step) tuple, and if it is aset, it is a set of explicitly allowed values.- defaults
The default values for the settings, used when a value is not provided when creating the model.
- d_chopper_sample
- d_sample_detector
- aperture_width
Width of aperture at moderator face in meters (m)
- theta
The angle that the beamline makes with the moderator face in degrees.
- frequency_matrix
A matrix mapping the relationship between the user-provided parameter
chopper_frequencyto the frequency of each chopper in the instrument.- choppers
Data for each chopper in the instrument. See
FermiChopperandDiskChopperfor more info.- moderator
- detector
- sample
- tjit
The jitter time in microseconds (us).
- pslit
Width of the neutron-transparent slit in meters (m).
- radius
Radius of the chopper package in meters (m).
- rho
Curvature of the chopper package in meters (m).
- class resins.models.pychop.PyChopModelDataNonFermi(d_chopper_sample: float, d_sample_detector: float, aperture_width: float, theta: float, frequency_matrix: list[list[float]], choppers: dict[str, FermiChopper | DiskChopper], moderator: Moderator, detector: None | Detector, sample: None | Sample, tjit: float, constant_frequencies: list[int], source_frequency: float, n_frame: int, *, function: str, citation: list[str], defaults: dict[str, int | float], restrictions: dict[str, list[int | float], set[int | float]])
Bases:
PyChopModelDataData for the PyChop models that do not have a Fermi chopper :
- Attributes:
- function
The name of the function, i.e. the alias for
PantherAbINSModel.- citation
The citation for the model. Please use this to look up more details and cite the model.
- restrictions
All constraints that the model places on the settings. If the value is a
list, this signifies therangestyle (start, stop, step) tuple, and if it is aset, it is a set of explicitly allowed values.- defaults
The default values for the settings, used when a value is not provided when creating the model.
- d_chopper_sample
- d_sample_detector
- aperture_width
Width of aperture at moderator face in meters (m)
- theta
The angle that the beamline makes with the moderator face in degrees.
- frequency_matrix
A matrix mapping the relationship between all user-provided chopper frequency parameters (i.e. the choppers with user control) to the frequency of each chopper in the instrument.
- choppers
Data for each chopper in the instrument. See
DiskChopperfor more info.- moderator
- detector
- sample
- tjit
The jitter time in microseconds (us).
- constant_frequencies
The frequency of each chopper in Hz, with those run at a constant frequency having non-zero values.
- source_frequency
The frequency of the neutron source in Hz.
- n_frame
Number of frames to calculate time-distance diagram for.
- class resins.models.pychop.PyChopModelFermi(model_data: PyChopModelDataFermi, e_init: float | None = None, chopper_frequency: int | None = None, fitting_order: int = 4, **_)
Bases:
PyChopModelPyChop model of 2D direct-geometry INS instruments that use a Fermi chopper.
Models the resolution as a function of energy transfer (frequencies) only, with the output model being a Gaussian. This is done by computing the contribution of each part of the instrument to the resolution function. However, this model calculates the resolution on a coarse grid, and then fits a polynomial to the results - the resolution at the user-provided
frequenciesis obtained by evaluating the polynomial.- Parameters:
- model_data
The data associated with the model for a given version of a given instrument.
- e_init
The initial energy in meV used in the INS experiment. If not provided, the default value for the particular version of an instrument will be used (see
PyChopModelDataFermi.defaults). Please note that thee_initvalue must be within the range allowed for the instrument (seePyChopModelDataFermi.restrictions).- chopper_frequency
The frequency of the Fermi chopper in Hz used in the INS experiment. If not provided, the default value for the particular version of an instrument will be used (see
PyChopModelDataFermi.defaults). Please note that thechopper_frequencyvalue must be within the range allowed for the instrument (seePyChopModelDataFermi.restrictions).- fitting_order
The order of the polynomial to use when fitting to the coarse grid.
- Attributes:
- input
The names of the columns in the
omega_qarray expected by all computation methods, i.e. the names of the independent variables ([Q, w]) that the model models.data_classData for the
PyChopModelFermimodel.citationThe citation for this model.
polynomialThe polynomial fitted to the resolutions.
Methods
__call__(points, data, *meshes)Broadens the
dataon themeshes.broaden(points, data, mesh)Broadens the
dataon the fullmeshusing the straightforward scheme.get_characteristics(points)Computes the broadening width at each value of energy transfer given by
points.get_kernel(points, mesh)Computes the Gaussian kernel centered on zero on the provided
meshat each (energy transfer or momentum scalar) point inpoints.get_peak(points, mesh)Computes the Gaussian broadening peak on the provided
meshat each (energy transfer or momentum scalar) point inpoints.- Raises:
InvalidInputErrorIf either the
e_initor thechopper_frequencyis not allowed.NoTransmissionErrorIf the combination of
e_initandchopper_frequencywould result in the Fermi chopper blocking the neutron beam, resulting in no signal.
- data_class
alias of
PyChopModelDataFermi
- property polynomial: Polynomial
The polynomial fitted to the resolutions.
- Returns:
polynomialThe polynomial modelling the resolution of an instrument at a particular value of incident energy and chopper frequency.
- class resins.models.pychop.PyChopModelLET(model_data: PyChopModelDataNonFermi, e_init: float | None = None, resolution_frequency: int | None = None, pulse_remover_frequency: int | None = None, fitting_order: int = 4, **_)
Bases:
PyChopModelNonFermiA PyChop model for the LET instrument.
This model is identical to all other PyChop models for instruments without a Fermi chopper, but the setting “chopper frequencies” have unique names compared to the other models.
The LET instrument, specifically, has a set-up with multiple choppers of variable frequency, but where some of the choppers are set to a pre-determined fraction of the frequency of another chopper. Further, this relationship changes depending on the
chopper_packageconfiguration. ThePyChopModelDataNonFermi.frequency_matrixattribute describes this relationship, and theget_long_frequencymethod can be used to compute the frequencies of all choppers.- Parameters:
- model_data
The data for the PyChopModel of the LET instrument.
- e_init
The incident energy used in the INS experiment. If not provided, the default value for the particular version of the LET instrument will be used (see
PyChopModelDataNonFermi.defaults). Please note that thee_initvalue must be within the range allowed for the instrument (seePyChopModelDataNonFermi.restrictions).- resolution_frequency
The frequency of the resolution chopper (i.e. the second resolution disk chopper, or chopper 5). If not provided, the default value for the particular version of the LET instrument will be used (see
PyChopModelDataNonFermi.defaults). Please note that theresolution_frequencyvalue must be within the range allowed for the instrument (seePyChopModelDataNonFermi.restrictions).- pulse_remover_frequency
The frequency of the pulse remover disk chopper (chopper 3). If not provided, the default value for the particular version of the LET instrument will be used (see
PyChopModelDataNonFermi.defaults). Please note that thepulse_remover_frequencyvalue must be within the range allowed for the instrument (seePyChopModelDataNonFermi.restrictions).- fitting_order
The order of the polynomial used for fitting against the resolution.
- Attributes:
- input
The names of the columns in the
omega_qarray expected by all computation methods, i.e. the names of the independent variables ([Q, w]) that the model models.data_classData for the PyChop models that do not have a Fermi chopper :
citationThe citation for this model.
polynomialThe polynomial fitted to the resolutions.
Methods
__call__(points, data, *meshes)Broadens the
dataon themeshes.broaden(points, data, mesh)Broadens the
dataon the fullmeshusing the straightforward scheme.data_classget_characteristics(points)Computes the broadening width at each value of energy transfer given by
points.get_kernel(points, mesh)Computes the Gaussian kernel centered on zero on the provided
meshat each (energy transfer or momentum scalar) point inpoints.get_long_frequency(frequencies, model_data)Calculates the frequency of each chopper making up this instrument.
get_peak(points, mesh)Computes the Gaussian broadening peak on the provided
meshat each (energy transfer or momentum scalar) point inpoints.- Raises:
InvalidInputErrorIf any of
e_init,resolution_frequency, orpulse_remover_frequencyis not allowed.
- property polynomial
The polynomial fitted to the resolutions.
- Returns:
polynomialThe polynomial modelling the resolution of an instrument at a particular value of incident energy and chopper frequency.
- class resins.models.pychop.PyChopModelNonFermi(model_data: ModelData, **_)
Bases:
PyChopModel,ABCAbstract base class for PyChop models for instruments that do not have a Fermi chopper.
This class contains methods for calculating the chopper contribution to the resolution function for all instruments that do not have a Fermi chopper, but it does not implement the abstract methods of its superclasses. Therefore, any of its subclasses must implement the
__init__method as well as thepolynomialattribute.For most subclasses, the actual content of the
__init__method should be nearly identical to that of the already existing subclasses; the only variable thing should be its signature. Different instruments have different sets of choppers, and so different sets of chopper frequencies have to be provided as a user input (mirroring the choice of the chopper frequencies on the physical INS instrument). Each subclass should have a separate argument for each of the user-tunable chopper frequencies, but then bundle them together to pass in to the_validate_chopper_frequencymethod which has an implementation in this class.- Attributes:
citationThe citation for this model.
polynomialThe polynomial fitted to the resolutions.
Methods
__call__(points, data, *meshes)Broadens the
dataon themeshes.broaden(points, data, mesh)Broadens the
dataon the fullmeshusing the straightforward scheme.get_characteristics(points)Computes the broadening width at each value of energy transfer given by
points.get_kernel(points, mesh)Computes the Gaussian kernel centered on zero on the provided
meshat each (energy transfer or momentum scalar) point inpoints.get_long_frequency(frequencies, model_data)Calculates the frequency of each chopper making up this instrument.
get_peak(points, mesh)Computes the Gaussian broadening peak on the provided
meshat each (energy transfer or momentum scalar) point inpoints.- data_class
alias of
PyChopModelDataNonFermi
- static get_long_frequency(frequencies: list[int], model_data: PyChopModelDataNonFermi) Float[np.ndarray, 'chopper_frequencies']
Calculates the frequency of each chopper making up this instrument.
Different instruments are set up differently; usually, at least one of the choppers is controllable by the user, and others are run at constant frequencies. However, in some instruments, some of the choppers are run at a particular fraction of another chopper’s frequency (see
PyChopModelDataNonFermi.frequency_matrix). This function takes everything into account and computes the frequency of each chopper.- Parameters:
- frequencies
The frequency of each user-controllable chopper (in Hz), in the same order as in the
__init__.- model_data
The data for a particular INS instrument.
- Returns:
all_frequenciesThe frequency of each chopper, in the order of increasing distance from the moderator.
- class resins.models.pychop.Sample
Bases:
TypedDictData for the sample.
- Attributes:
- type
Sample type: 0==flat plate, 1==ellipse, 2==annulus, 3==sphere, 4==solid cylinder.
- thickness
Sample thickness in meters (m).
- width
Sample width in meters (m).
- height
Sample height in meters (m).
- gamma
Angle of x-axis to ki in degrees.
Methods
clear()copy()fromkeys(iterable[, value])Create a new dictionary with keys from iterable and values set to value.
get(key[, default])Return the value for key if key is in the dictionary, else default.
items()keys()pop(key[, default])If the key is not found, return the default if given; otherwise, raise a KeyError.
popitem(/)Remove and return a (key, value) pair as a 2-tuple.
setdefault(key[, default])Insert key with a value of default if key is not in the dictionary.
update([E, ]**F)If E is present and has a .keys() method, then does: for k in E.keys(): D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
values()
- resins.models.pychop.soft_hat(x: float, p: list[float])
Soft hat function, from Herbert subroutine library.
Used for some versions of some instruments for rescaling t-mod at low energy to account for broader moderator term.
- Parameters:
- x
The inital energy in meV, as provided by the user.
- p
A list of parameters to use for the scaling.
- Returns:
yThe scaling factor