pytmosph3r.interface.io

Module Contents

class Input(filename)[source]

Bases: pytmosph3r.log.Logger

Base class to read input data. HDF5Input and ncInput inherit from it.

open()[source]
close()[source]
keys(path='.')[source]
abstract get(path)[source]
abstract getclass(path)[source]
read(path, class_obj=None)[source]

Read a class (class_obj) from path in HDF5. The keys in path have to match the class arguments.

Note

If you have parameters to read that are not inputs, you probably want to use a dict as class_obj.

Parameters:
  • path (string) – Path to class

  • class_obj (Class) – Class to read

class Output(filename, append=False)[source]

Bases: Input

Base class to write outputs. HDF5Output and ncOutput inherit from it.

group_func

Function pointer to the method creating a group

group_class

Class pointer to the subclass handling groups

abstract get(path)[source]
abstract getclass(path)[source]
create_group(group_name)[source]
createGroup(group_name)[source]
close()[source]
write_list(list_array, list_name=None, metadata=None)[source]
write_item(item, key=None, metadata=None, to_write='inputs', verbose=False)[source]
write_dictionary(dic)[source]

Recursively write a dictionary into output.

write_obj(obj, to_write='inputs', items=None)[source]

Write an object.

write_output(obj, items=None)[source]

Write outputs.

class Group(f)[source]

Bases: Output, abc.ABC

Base class to write outputs. HDF5Output and ncOutput inherit from it.

write_spectrum(output_file='pytmosph3r_spectrum.dat', model=None)[source]

Save a spectrum to a .dat file using a model. The first column lists the wavelengths, the second the value of the flux, the third the noise errorbar, and the fourth the widths of the wavelength edges.