code: def set_current(self, channel, value, unit='A'):
          '''Setting current of current source
          '''
          dac_offset = self._ch_cal[channel]['DAC']['offset']
          dac_gain = self._ch_cal[channel]['DAC']['gain']
          if unit == 'raw':
              value = value
          elif unit == 'A':
              value = int((-value * 1000000 - dac_offset) / dac_gain)  # fix sign of output
          elif unit == 'mA':
              value = int((-value * 1000 - dac_offset) / dac_gain)  # fix sign of output
          elif unit == 'uA':
              value = int((-value - dac_offset) / dac_gain)  # fix sign of output
          else:
              raise TypeError("Invalid unit type.")
  
          self._set_dac_value(channel=channel, value=valuef set_current(self, channel, value, unit='A'):
          '''Setting current of current source
          '''
          dac_offset = self._ch_cal[channel]['DAC']['offset']
          dac_gain = self._ch_cal[channel]['DAC']['gain']
          if unit == 'raw':
              value = value
          elif unit == 'A':
              value = int((-value * 1000000 - dac_offset) / dac_gain)  # fix sign of output
          elif unit == 'mA':
              value = int((-value * 1000 - dac_offset) / dac_gain)  # fix sign of output
          elif unit == 'uA':
              value = int((-value - dac_offset) / dac_gain)  # fix sign of output
          else:
              raise TypeError("Invalid unit type.")
  
          self._set_dac_value(channel=channel, value=value)
docs: Setting current of current source