polyTEM.crystal_peaks.flow_fields.scale_values¶
- polyTEM.crystal_peaks.flow_fields.scale_values(values, vmin=0, brightness=1, contrast=1, gamma=1)¶
Rescales data such as intensity, q, or similar to values suitable for linewidth, alpha, or similar. There are many possible versions of this function - this is the one that works best for my data so far. My guess is that some users will write a different version of this function to fit their needs.
- Inputs:
values: the values to be scaled. Typically an array. vmin: any values below vmin are set equal to vmin before scaling. brightness: the highest value output by this function. Note that when mapping to RGBA values, brightness
generally can’t be greater than 1.
contrast: the value of input data that yields the brightest possible signal. gamma: the nonlinearity of the mapping curve. If gamma > 1, strong signals will be spaced more than weak
signals, and vice versa for gamma < 1.
If gamma = 0, all inputs will be mapped to the same value.