class_docstr: Tests for AdaptiveScalarEncoder
docstr: Test setting the min and max using setFieldStats
docstr_tok: ["Test","setting","the","min","and","max","using","setFieldStats"]
code: def testSetFieldStats(self):
      """Test setting the min and max using setFieldStats"""
  
      def _dumpParams(enc):
          return (
              enc.n,
              enc.w,
              enc.minval,
              enc.maxval,
              enc.resolution,
              enc._learningEnabled,
              enc.recordNum,
              enc.radius,
              enc.rangeInternal,
              enc.padding,
              enc.nInternal,
          )
  
      sfs = AdaptiveScalarEncoder(
          name="scalar",
          n=14,
          w=5,
          minval=1,
          maxval=10,
          periodic=False,
          forced=True,
      )
      reg = AdaptiveScalarEncoder(
          name="scalar",
          n=14,
          w=5,
          minval=1,
          maxval=100,
          periodic=False,
          forced=True,
      )
      self.assertNotEqual(
          _dumpParams(sfs),
          _dumpParams(reg),
          (
              "Params should not be equal, since the two encoders "
              "were instantiated with different values."
          ),
      )
      # set the min and the max using sFS to 1,100 respectively.
      sfs.setFieldStats("this", {"this": {"min": 1, "max": 100}})
  
      # Now the parameters for both should be the same
      self.assertEqual(
          _dumpParams(sfs),
          _dumpParams(reg),
          (
              "Params should now be equal, but they are not. sFS "
              "should be equivalent to initialization."
          ),
      )
  
file_path: nupic-legacy/tests/unit/nupic/encoders/adaptivescalar_test.py
imports: import tempfile
  import unittest
  import numpy
  from nupic.data import SENTINEL_VALUE_FOR_MISSING_DATA
  from nupic.encoders.adaptive_scalar import AdaptiveScalarEncoder
  from nupic.encoders.base import defaultDtype
label_desc: Use image node_id 7 for calling the AdaptiveScalarTest obj's underlying member method code with example usage: obj.testSetFieldStats() and returns: enc,  enc,  enc,  enc,  enc,  enc,  enc,  enc,  enc,  enc,  enc