Distribution

class nexus.Distribution(points=101, id='')

Abstract class for Distribution acting on Hyperfine parameters. Do not use this class directly. A Distribution must be derived from this class in Python the following way.

# definition of the derived class
class DistributionDefinedInPython(nx.Distribution):
    def __init__(self, points, ...):
        super().__init__(points, "user defined distribution")
        ... followed by your code if needed ...

    # implementation of the actual distribution function
    def DistributionFunction(self):
        # here goes your implementation
        .....
        # set the deltax values to a reasonable range
        x = np.array(self.SetRange(...))
        ...
        # calculate the weight
        weight =  a function of x most probably
        # set the weight values
        self.SetWeight(weight)

A lot of distribution are predefined in the library distribution.

Parameters:
  • points (int) – Number of distribution points.

  • id (string) – User identifier.

points

Number of distribution points.

Type:

int

delta

The delta values of the distribution.

Type:

list

weight

Relative weight of the delta values.

Type:

list

id

User identifier.

Type:

string

fit_variables

List of nx.Var objects.

Type:

list

DistributionFunction()

Call of the distribution function implementation from python.

PrintDelta()

Prints all delta values.

PrintWeight()

Prints all weight values.

SetDelta(values)

Set delta.

Parameters:

values (list or ndarray) – List of delta values.

SetRange(range)

Set delta values to a specific range around zero.

Parameters:

range (double) – The total distribution range.

SetWeight(values)

Set weight. The sum of the weight values is normalized to one.

Parameters:

values (list or ndarray) – List of weight values.

Examples can be found in the Tutorial section.