docstr: ...Test ProxBinarsity parameters setting
          
docstr_tok: ["...","Test","ProxBinarsity","parameters","setting"]
code: def test_ProxBinarsity_penalty_parameters_setting(self):
      """...Test ProxBinarsity parameters setting"""
      l_binarsity = 0.5
  
      blocks_start = [0, 3, 8]
      blocks_length = [3, 5]
      msg = "^``blocks_start`` and ``blocks_length`` must have the same size$"
      with self.assertRaisesRegex(ValueError, msg):
          ProxBinarsity(
              strength=l_binarsity,
              blocks_start=blocks_start,
              blocks_length=blocks_length,
          )
  
      blocks_start = [0, 3, 8]
      blocks_length = [4, 5, 1]
      msg = "^blocks must not overlap$"
      with self.assertRaisesRegex(ValueError, msg):
          ProxBinarsity(
              strength=l_binarsity,
              blocks_start=blocks_start,
              blocks_length=blocks_length,
          )
  
      # test not overlapping but not penalizing all coefficients either
      blocks_start = [0, 3, 8]
      blocks_length = [2, 2, 2]
      ProxBinarsity(
          strength=l_binarsity,
          blocks_start=blocks_start,
          blocks_length=blocks_length,
      )
  
      blocks_start = [0, 8, 3]
      blocks_length = [1, 1, 1]
      msg = "^``block_start`` must be sorted$"
      with self.assertRaisesRegex(ValueError, msg):
          ProxBinarsity(
              strength=l_binarsity,
              blocks_start=blocks_start,
              blocks_length=blocks_length,
          )
  
      blocks_start = [0, 3, 8]
      blocks_length = [-3, 5, 2]
      msg = "^all blocks must be of positive size$"
      with self.assertRaisesRegex(ValueError, msg):
          ProxBinarsity(
              strength=l_binarsity,
              blocks_start=blocks_start,
              blocks_length=blocks_length,
          )
  
      blocks_start = [0, -3, 8]
      blocks_length = [3, 5, 2]
      msg = "^all blocks must have positive starting indices$"
      with self.assertRaisesRegex(ValueError, msg):
          ProxBinarsity(
              strength=l_binarsity,
              blocks_start=blocks_start,
              blocks_length=blocks_length,
          )
  
      blocks_start = [0, 3, 8]
      blocks_length = [3, 5, 2]
      prox = ProxBinarsity(
          strength=l_binarsity,
          blocks_start=blocks_start,
          blocks_length=blocks_length,
      )
  
      msg = "^blocks_length and blocks_start must have the same size$"
      with self.assertRaisesRegex(ValueError, msg):
          prox.blocks_length = np.array([3, 5, 2, 3], dtype=np.uint64)
  
      blocks_start = [0, 4, 8]
      blocks_length = [3, 3, 10]
      msg = "^last block is not within the range \[0, end-start\)$"
      with self.assertRaisesRegex(ValueError, msg):
          ProxBinarsity(
              strength=l_binarsity,
              blocks_start=blocks_start,
              blocks_length=blocks_length,
              range=(0, 17),
          )
  
file_path: tick/tick/prox/tests/prox_binarsity_test.py
imports: import unittest
  from numpy.testing import assert_almost_equal
  import numpy
  from tick.prox import ProxBinarsity
  from tick.prox.tests.prox import TestProx
label_desc: Use image node_id 3 for calling the Test obj's underlying member method code with example usage: obj.test_ProxBinarsity_penalty_parameters_setting() without return types