Open kyleabeauchamp opened 10 years ago
PS: at some point we might want to create an abstract base class for all these test system classes
PS: at some point we might want to create an abstract base class for all these test system classes
Agreed. How about a TestSystem
object with some methods for computing analytical properties?
Which properties would we want to compute? I could imagine
IdealGas
): mean and standard deviationAre others useful?
Should we create a single method getAnalyticalProperties()
that returns a dict
of analytical properties, or should we have separate get*
functions such as getPotentialEnergyMean
, getPotentialEnergyStddev
, that return None
if this property is unavailable?
If we use a dict
, what naming convention is best? PotentialEnergyMean
, or potential_energy_mean
, or a double-dict with property['potential energy']['mean']
and property['potential energy']['stddev']
, etc?
So I think we should just have one function per analytical property.
A member function can be accessed in the same manner as a dict
object, but has the added benefit of having a docstring attached to it. To me, that's a huge benefit, as it allows us to attaching provenance and derivations directly to the data.
There are other ways we could handle this, obviously, but to me this is the most obvious one.
Good point. We'll effectively be using introspection to see what analytical results are available.
Is there any advantage to having a base class that implements all possible analytical result methods and returns a NotImplementedException for all of them? Or is introspection the more Pythonic way to do this?
I don't see any major advantage to that.
To me, one main benefit of having an abstract base class is to teach new developers how to create their own test systems--by listing the necessary member functions, we define a clear interface for future test additions.
PS: the base class would also be at the top of the module and say "This is how you create a new test..."
I changed the test systems to be classes, so that we can add member functions that calculate various analytical (or experimental) properties that will be useful for unit testing.
PS: we should also include docstrings with references and some equations, if necessary. The point here is for the member functions for calculating analytical properties to be self-documenting.