def between(lo, hi, units, *args, **what): return Quantity.flat(lo, hi, None, units, *args, **what)
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
IcePoint = water.temperature.freeze milk = Substance(density=10.5 * pound / gallon) air = Gas( RMM=1.6 * Nitrogen.A + .4 * Oxygen.A, # close enough ... sound=Object(speed=Quantity(mach))) air.sound.speed.observe(331.36 * metre / second) # duno where I got this one ... methanol = Substance(density=.7918 * kilogramme / litre) kerosene = Substance(density=.81715 * kilogramme / litre) # at Fahrenheith(60) alcohol = ethanol = Substance(density=.789 * kilogramme / litre) petrol = Substance(density=.73722 * kilogramme / litre) # liquid hydrogen, at 20K: 70.99 gram / litre granite = Substance(density=Quantity.flat(2.6, 2.7, units=kilogramme / litre), strength=Object(compressive=175e6 * Newton / metre**2)) gneiss = Substance(density=Quantity.flat(2.6, 2.9, units=kilogramme / litre), strength=Object(compressive=125e6 * Newton / metre**2)) quartz = Substance(density=2.65 * kilogramme / litre, melt=1883 * Kelvin, boil=2503 * Kelvin) mixture_doc = """Modeling chemical mixtures. The underlying model is the `atomist' model of molecular-scale thermodynamics. A body of space (of volume V) contains a population of little objects; these move about, may fall apart, especially when bouncing off one another, at which moments they may likewise stick to one another.