Here we describe how we can add specific functions to the new class defined in simpleformat.py. This may be usefull if you want for example to get specific informations on the class. You can simplay redefine the spec_info() functions that is called automatically by the info().
def spec_info(self):
"""
Write spec info
"""
infolist = []
infolist.append("")
infolist.append("tnow : %s"%self.tnow)
infolist.append("ngas : %s"%self.ngas)
infolist.append("nstar : %s"%self.nstar)
return infolist
Other functions may be defined, for example, a function that simplay return the metallicity of each particles.
def Metallicity(self):
"""
Return the metallicity
"""
return self.meta
With this function, you can easilly display the metallicity value of each particles in a plot, witout redefining anything else (See further).
See About this document... for information on suggesting changes.