Trimming.TrimmingUtils#
Trimming.TrimmingUtils.py
- make_and_slicepair(pair1, pair2, judge_info, debug=False)#
Create slices for a pair of ranges, considering the judge_info.
- Parameters:
- Returns:
start, stop – The combined range (start, stop).
- Return type:
- make_trimming_impl(ssd, xr_qr=None, xr_mt=None, uv_wr=None, uv_mt=None, uv_fc=None, flowchange=None, ip_effect_info=None, nsigmas=None, nguiniers=None, jranges=None, mapping=None, debug=False)#
Create trimming slices for the given data.
- Parameters:
ssd (SampledScatteringData) – The data to be trimmed.
xr_qr (tuple (start, stop) or None) – The q-range for XR data. If None, use the usable q-range.
xr_mt (Moment or None) – The moment for XR data. If None, compute from the data.
uv_wr (tuple (start, stop) or None) – The w-range for UV data. If None, use the usable w-range.
uv_mt (Moment or None) – The moment for UV data. If None, compute from the data.
uv_fc (any) – Flow change information for UV data. (Not used in this function)
flowchange (bool or 'auto' or None) – Whether to consider flow change points. If ‘auto’, determine automatically.
ip_effect_info (any) – Information for IP effect. (Not used in this function)
nsigmas (int or None) – Number of sigmas for moment calculation. If None, an adaptive default is used: max(TRIMMING_NSIGMAS, n_xr_frames // 75), which widens the trimming window for longer datasets to avoid over-trimming that can cause downstream peak detection failures.
nguiniers (int or None) – Number of Guinier points to consider. If None, use default.
jranges (tuple of tuples or None) – The j-ranges for XR and UV data. If None, compute from the data.
mapping (MappingInfo or None) – The mapping information between XR and UV data. If None, compute if needed.
debug (bool) – If True, print debug information.
- Returns:
The trimming information with slices and mapping.
- Return type:
- slice_to_values(vec, slice_)#
Convert a slice to its start and stop values in the given vector. If start or stop is None, use the first or last element of the vector.
- make_mapped_trimming_info(ssd, xr_jslice, uv_jslice, debug=False)#
Create mapped trimming slices for XR and UV data. In mapped trimming, the trimming ranges of XR and UV data are adjusted to correspond to each other based on the mapping information.
- Parameters:
- Returns:
xr_jslice (slice) – The adjusted j-slice for XR data.
uv_jslice (slice) – The adjusted j-slice for UV data.
mapping (MappingInfo) – The mapping information between XR and UV data.