A plehtora of Quantities

Martin Hill mchill at dial.pipex.com
Wed May 12 07:05:08 PDT 2004


So now we have QuantitySet, CoreQuantity, AtomicQuantity, StandardQuantity, 
ListQuantity, CompositeQuantity, etc. So in a familiar whingy ranty voice: This 
is an example of what happens when you and try and find one class to rule them 
all.  We now (appear to) have a set of Quantity classes that we can 'pick' from 
to create our new objects (such as Passband) - and if we can't find an exactly 
suitable one we just have to get something close.  We can't model exactly what 
we want.

Perhaps a simple example would help to sort this out.  How would we, for 
example, model a SED?

A first stab would be to define a Passband interface that has methods something 
like getMinWavelength(), getMaxWavelength() and getLimit(wavelength), the last 
of which returns some proportion of passed flux given a wavelength.  (There is 
more, but this is just an example).  Then we have SimplePassband (which is just 
a wavelength range with a flat top), a FormulaPassband (which has a formalae 
behind it describing the shape of the passband), a GraphPassband (which has a 
set of points behind it describing the shape of the passband), and we can create 
standard instances of these for standard filters.  This gives us a Passband 
model that is easy to implement (for simple passbands) and we can plug into 
other models with no fuss, as we just need to include the Passband interface 
definition.

We can have an abstract Wave object, with both getFrequency() and 
getWavelength(), implemented by Wavelength and Frequency which have Accuracy, 
UCD and can return each other suitably inverted.

So now we can create a Flux object (or interface?) that has a Passband and a 
total energy - perhaps subclasses might include Magnitude that can handle 
magnitudes as well as returning estimated energy values.

A list of Flux objects along with a coordinate is a Spectral Energy Distribution.

These are reasonably simple to build using the components included as part of 
the Quantity concept.  But they are much easier to build and adapt by themselves 
without having to be Quantitys themselves.  For example, it might be useful to 
have Passband implement Accuracy (though I am probably showing my astronomical 
ignorance here) as I understand they often act as the error on a flux.

How would this work with the Quantity philosophy?





More information about the dm mailing list