docstr: Tests if all values contribute equally using the trapezoid membership function.
docstr_tok: ["Tests","if","all","values","contribute","equally","using","the","trapezoid","membership","function","."]
code: def test_trapezoid_membership_contribution(self):
      """Tests if all values contribute equally using the trapezoid membership function."""
      contribution = 1.0
  
      for smoothness in [0.1, 0.2, 0.3, 0.4, 0.49]:
          for bin_width in [0.5, 1, 1.5, 10]:
              mbs = []
              for bin_idx in range(
                  -int(math.ceil(smoothness)),
                  int(math.ceil(smoothness)) + 1,
              ):
                  mbs.append(
                      trapezoid_membership(
                          bin_idx * bin_width, bin_width, smoothness
                      )
                  )
              value = -0.5 * bin_width
              for _ in range(1, 11):
                  result = 0
                  for bin_idx in range(len(mbs)):
                      result += mbs[bin_idx](value)
                  self.assertAlmostEqual(
                      contribution,
                      result,
                      msg="invalid contribution of {} instead of expected {}".format(
                          result, contribution
                      ),
                  )
                  value += 1.0 / 10 * bin_width
  
file_path: medpy/tests/features_/histogram.py
imports: import unittest
  import math
  import scipy
  from medpy.features.histogram import fuzzy_histogram, triangular_membership, trapezoid_membership, gaussian_membership, sigmoidal_difference_membership
label_desc: Use image node_id 3 for calling the TestHistogramFeatures obj's underlying member method code with example usage: obj.test_trapezoid_membership_contribution() without return types