ess.reflectometry.tools.linlogspace#

ess.reflectometry.tools.linlogspace(dim, edges, scale, num, unit=None)[source]#

Generate a 1d array of bin edges with a mixture of linear and/or logarithmic spacings.

Examples:

  • Create linearly spaced edges (equivalent to sc.linspace):

    linlogspace(dim=’x’, edges=[0.008, 0.08], scale=’linear’, num=50, unit=’m’)

  • Create logarithmically spaced edges (equivalent to sc.geomspace):

    linlogspace(dim=’x’, edges=[0.008, 0.08], scale=’log’, num=50, unit=’m’)

  • Create edges with a linear and a logarithmic part:

    linlogspace(dim=’x’, edges=[1, 3, 8], scale=[‘linear’, ‘log’], num=[16, 20])

Parameters:
  • dim (str) – The dimension of the output Variable.

  • edges (list | ndarray) – The edges for the different parts of the mesh.

  • scale (list | str) – A string or list of strings specifying the scaling for the different parts of the mesh. Possible values for the scaling are “linear” and “log”. If a list is supplied, the length of the list must be one less than the length of the edges parameter.

  • num (list | int) – An integer or a list of integers specifying the number of points to use in each part of the mesh. If a list is supplied, the length of the list must be one less than the length of the edges parameter.

  • unit (Optional[str], default: None) – The unit of the output Variable.

Returns:

Variable – Lin-log spaced Q-bin edges.