You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current implementation I'm using is below. This is useful for being able to sample a temperature response function, and in theory could be an anlytic function, or just interpolating between points.
classTemperatureResponse:
""" A discretely sampled temperature response function. Parameters ---------- temps : astropy.units.Quantity Temperatures. responses : astropy.units.Quantity Response function. """# TODO: use astropy quantity input heredef__init__(self, temps, responses):
iftemps.shape!=responses.shape:
raiseValueError('Shape of temps must be the same as ''shape of responses')
self.temps=tempsself.responses=responsesdef__repr__(self):
returnf'TemperatureResponse, T={self.temps}, response={self.responses}'# TODO: use astropy quantity input heredefsample(self, temps):
""" Sample the temperature repsonse function at temperatures *temps*. Uses linear interpolation. """resps=np.interp(temps, self.temps, self.responses,
left=np.nan, right=np.nan)
returnresps
The text was updated successfully, but these errors were encountered:
The current implementation I'm using is below. This is useful for being able to sample a temperature response function, and in theory could be an anlytic function, or just interpolating between points.
The text was updated successfully, but these errors were encountered: