Reporting during a run

class amuse.io.ReportTable(filename, format='csv', **format_specific_keyword_arguments)

Report quantities and values to a file.

Parameters:
  • filename – name of the file to write the data to
  • format – name of a registered format (‘csv’ or ‘txt’)

All other keywords are set as attributes on the fileformat processor. To determine the supported options for a processor call get_options_for_format()

Important options fot text and comma separated files are:

Parameters:
  • attribute_types – list of the units to store the values in
  • attribute_names – list of the names of for the values (used in the header of the file and when using add_row with keyword parameters)

Writes data per row to a file. Ideal for storing intermediate values of one Particle or one Gridpoint during a run.

Example usage:

report = ReportTable(
    "hrdiagram.txt", "txt", 
    attribute_types=(units.Myr, units.K, units.LSun), 
    attribute_names=('age', 'temperature_at_time', 'luminosity_at_time')
)
report.add_row(particle.age, particle.temperature_at_time, particle.luminosity_at_time) 
add_row(*fields, **fieldsbyname)

Add a row to the report, columns can be added by name or by position in list. If columns are given by name the order does not matter and will alway follow to order given in the ‘attribute_names’ option specified when creating the ReportTable.

Example usage:

report.add_row(
    particle.age, 
    particle.temperature_at_time, 
    particle.luminosity_at_time
)

report.add_row(
    temperature_at_time = particle.temperature_at_time,
    age = particle.age,
    luminosity_at_time = particle.luminosity_at_time
)