This isn't the right way to wrap it, but if any wrapping's to be done, it should be done here, not by bodging Radiator's __init__ method !\n""" try: if temperature > 0: T = temperature * Kelvin else: T = Centigrade(temperature) except TypeError: # temperature has units, so > 0 check bombed. if temperature / Kelvin > 0: T = temperature # TypeError if wrong units else: T = temperature + Centigrade(0) if T / Kelvin < 0: raise ValueError, 'Negative temperature, even after Centigrade coercion' return Radiator(T, *args, **what) from study.value.quantity import Quantity Human = Radiator(Quantity.fromDecimal(309.5, 1, None, Kelvin), oral=Centigrade(Quantity.gaussian(36.8, .5)), axillary=Centigrade(Quantity.flat(36, 36.9, 36.6)), __doc__="""Human body as a radiator. The human body maintains a roughly constant temperature, so naturally radiates as a body of that temperature, in so far as it's exposed. Skin temperature is doubtless less than one would measure in an arm-pit (an 'axillary' measurement, commonly used in Russia and Poland), which is about .2 K lower than oral measurement (common in the anglophone world); which, in turn, is about .5 K below anal measurements; while core temperatures are presumed to be higher yet than this. """) del Quantity, Centigrade
def waterviscosity(T, A=2.414e-5 * Pascal * second, K=Kelvin, ten=Quantity(10)): """Variation of water's dynamic viscosity with temperature. Takes one argument, an absolute temperature (e.g. a return from study.value.archaea's Centigrade or Fahrenheit). Result is probably only valid if this is a temperature at which water is a liquid !\n""" return A * ten**(247.8 / (T / K - 140)) # adapted from Wikipedia water = Substance( density=Quantity.fromDecimal( 1 - 27e-6, 6, None, kilogramme / litre, """Density of water. at 277.13K, when density is maximal. The definition of the UK gallon used to make the density of water 10 pound / gallon at some specific temperature; but now both pound and gallon are defined in terms of SI.\n"""), viscosity=waterviscosity, heat=Heats(capacity=Quantity( 1, calorie / gram / Kelvin, """The specific heat capacity of water. The definition of the (short) calorie is as the energy it takes to heat one gram of water by one degree Celsius. Naturally, this varies with temperature; see calorie's documentation for consequences. """)), temperature=Temperatures( triple=Quantity( 273.16, Kelvin, "Triple point of water (by definition of the Kelvin)."), melt=Quantity(273.150, Kelvin,
del Nucleon def waterviscosity(T, A=2.414e-5 * Pascal * second, K=Kelvin, ten=Quantity(10)): """Variation of water's dynamic viscosity with temperature. Takes one argument, an absolute temperature (e.g. a return from study.value.archaea's Centigrade or Fahrenheit). Result is probably only valid if this is a temperature at which water is a liquid !\n""" return A * ten**(247.8/(T/K -140)) # adapted from Wikipedia water = Substance( density = Quantity.fromDecimal(1 -27e-6, 6, None, kilogramme / litre, """Density of water. at 277.13K, when density is maximal. The definition of the UK gallon used to make the density of water 10 pound / gallon at some specific temperature; but now both pound and gallon are defined in terms of SI.\n"""), viscosity = waterviscosity, heat = Heats( capacity = Quantity(1, calorie / gram / Kelvin, """The specific heat capacity of water. The definition of the (short) calorie is as the energy it takes to heat one gram of water by one degree Celsius. Naturally, this varies with temperature; see calorie's documentation for consequences. """)), temperature = Temperatures( triple = Quantity(273.16, Kelvin, "Triple point of water (by definition of the Kelvin)."),