class_docstr: Test case for various AHI calibration types.
class_docstr_tok: ["Test","case","for","various","AHI","calibration","types","."]
docstr: Test user-defined calibration modes.
docstr_tok: ["Test","user-defined","calibration","modes","."]
code: def test_user_calibration(self):
      """Test user-defined calibration modes."""
      # This is for radiance correction
      self.fh.user_calibration = {
          "B13": {"slope": 0.95, "offset": -0.1}
      }
      self.fh.band_name = "B13"
      rad = self.fh.calibrate(data=self.counts, calibration="radiance")
      rad_np = rad.compute()
      assert rad.dtype == rad_np.dtype
      assert rad.dtype == np.float32
      rad_exp = np.array(
          [[16.10526316, 12.21052632], [8.31578947, -3.36842105]]
      )
      assert np.allclose(rad, rad_exp)
  
      # This is for DN calibration
      self.fh.user_calibration = {
          "B13": {"slope": -0.0032, "offset": 15.20},
          "type": "DN",
      }
      self.fh.band_name = "B13"
      rad = self.fh.calibrate(data=self.counts, calibration="radiance")
      rad_np = rad.compute()
      assert rad.dtype == rad_np.dtype
      assert rad.dtype == np.float32
      rad_exp = np.array([[15.2, 12.0], [8.8, -0.8]])
      assert np.allclose(rad, rad_exp)
  
imports: from __future__ import annotations
  import contextlib
  import unittest
  import warnings
  from datetime import datetime
  from typing import Any, Dict
  from unittest import mock
  import dask.array
  import numpy
  import pytest
  from satpy.readers.ahi_hsd import AHIHSDFileHandler
  from satpy.readers.utils import get_geostationary_mask
  from satpy.tests.utils import make_dataid
label_desc: Use image node_id 4 for calling the TestAHICalibration obj's underlying member method code with example usage: obj.test_user_calibration() without return types