from UliEngineering.Physics.Temperature import zero_point_celsius, normalize_temperature
from UliEngineering.EngineerIO import normalize_numeric
from UliEngineering.Units import Unit
import numpy as np

__all__ = ["ntc_resistance"]


def ntc_resistance(r25, b25, t) -> Unit("Ω"):
    """
    Compute the NTC resistance by  temperature and NTC parameters

    Parameters
    ----------
    r25 : float or EngineerIO string
        The NTC resistance at 25°C, sometimes also called "nominal resistance"
    b25: float or EngineerIO string
        The NTC b-constant (e.g. b25/50, b25/85 or b25/100)
    t : temperature
        The temperature. Will be interpreted using normalize_temperature()
    """
    # Normalize inputs
    r25 = normalize_numeric(r25)
    b25 = normalize_numeric(b25)
    t = normalize_temperature(t) # t is now in Kelvins
    # Compute resistance
    return r25 * np.exp(b25 * (1./t - 1./(25. + zero_point_celsius)))

from UliEngineering.Physics.Temperature import normalize_temperature
from UliEngineering.EngineerIO import normalize_numeric
from UliEngineering.Units import Unit
import numpy as np
from scipy.constants import zero_Celsius

__all__ = ["ntc_resistance"]


def ntc_resistance(r25, b25, t) -> Unit("Ω"):
    """
    Compute the NTC resistance by  temperature and NTC parameters

    Parameters
    ----------
    r25 : float or EngineerIO string
        The NTC resistance at 25°C, sometimes also called "nominal resistance"
    b25: float or EngineerIO string
        The NTC b-constant (e.g. b25/50, b25/85 or b25/100)
    t : temperature
        The temperature. Will be interpreted using normalize_temperature()
    """
    # Normalize inputs
    r25 = normalize_numeric(r25)
    b25 = normalize_numeric(b25)
    t = normalize_temperature(t) # t is now in Kelvins
    # Compute resistance
    return r25 * np.exp(b25 * (1./t - 1./(25. + zero_Celsius)))

Fix build error due to replacing zero_point_celsius by scipy equivalent
Fix build error due to replacing zero_point_celsius by scipy equivalent

- from UliEngineering.Physics.Temperature import zero_point_celsius, normalize_temperature
+ from UliEngineering.Physics.Temperature import normalize_temperature
  from UliEngineering.EngineerIO import normalize_numeric
  from UliEngineering.Units import Unit
  import numpy as np
+ from scipy.constants import zero_Celsius
  
  __all__ = ["ntc_resistance"]
  
  
  def ntc_resistance(r25, b25, t) -> Unit("Ω"):
      """
      Compute the NTC resistance by  temperature and NTC parameters
  
      Parameters
      ----------
      r25 : float or EngineerIO string
          The NTC resistance at 25°C, sometimes also called "nominal resistance"
      b25: float or EngineerIO string
          The NTC b-constant (e.g. b25/50, b25/85 or b25/100)
      t : temperature
          The temperature. Will be interpreted using normalize_temperature()
      """
      # Normalize inputs
      r25 = normalize_numeric(r25)
      b25 = normalize_numeric(b25)
      t = normalize_temperature(t) # t is now in Kelvins
      # Compute resistance
-     return r25 * np.exp(b25 * (1./t - 1./(25. + zero_point_celsius)))
+     return r25 * np.exp(b25 * (1./t - 1./(25. + zero_Celsius)))
  
Fix build error due to replacing zero_point_celsius by scipy equivalent
## Code Before:
from UliEngineering.Physics.Temperature import zero_point_celsius, normalize_temperature
from UliEngineering.EngineerIO import normalize_numeric
from UliEngineering.Units import Unit
import numpy as np

__all__ = ["ntc_resistance"]


def ntc_resistance(r25, b25, t) -> Unit("Ω"):
    """
    Compute the NTC resistance by  temperature and NTC parameters

    Parameters
    ----------
    r25 : float or EngineerIO string
        The NTC resistance at 25°C, sometimes also called "nominal resistance"
    b25: float or EngineerIO string
        The NTC b-constant (e.g. b25/50, b25/85 or b25/100)
    t : temperature
        The temperature. Will be interpreted using normalize_temperature()
    """
    # Normalize inputs
    r25 = normalize_numeric(r25)
    b25 = normalize_numeric(b25)
    t = normalize_temperature(t) # t is now in Kelvins
    # Compute resistance
    return r25 * np.exp(b25 * (1./t - 1./(25. + zero_point_celsius)))

## Instruction:
Fix build error due to replacing zero_point_celsius by scipy equivalent
## Code After:
from UliEngineering.Physics.Temperature import normalize_temperature
from UliEngineering.EngineerIO import normalize_numeric
from UliEngineering.Units import Unit
import numpy as np
from scipy.constants import zero_Celsius

__all__ = ["ntc_resistance"]


def ntc_resistance(r25, b25, t) -> Unit("Ω"):
    """
    Compute the NTC resistance by  temperature and NTC parameters

    Parameters
    ----------
    r25 : float or EngineerIO string
        The NTC resistance at 25°C, sometimes also called "nominal resistance"
    b25: float or EngineerIO string
        The NTC b-constant (e.g. b25/50, b25/85 or b25/100)
    t : temperature
        The temperature. Will be interpreted using normalize_temperature()
    """
    # Normalize inputs
    r25 = normalize_numeric(r25)
    b25 = normalize_numeric(b25)
    t = normalize_temperature(t) # t is now in Kelvins
    # Compute resistance
    return r25 * np.exp(b25 * (1./t - 1./(25. + zero_Celsius)))
