DataInfo¶
-
class
astropy.utils.data_info.DataInfo(bound=False)[source]¶ Bases:
objectDescriptor that data classes use to add an
infoattribute for storing data attributes in a uniform and portable way. Note that it must be calledinfoso that the DataInfo() object can be stored in theinstanceusing theinfokey. Because owner_cls.x is a descriptor, Python doesn’t use __dict__[‘x’] normally, and the descriptor can safely store stuff there. Thanks to http://nbviewer.ipython.org/urls/gist.github.com/ChrisBeaumont/5758381/raw/descriptor_writeup.ipynb for this trick that works for non-hashable classes.Parameters: - bound : bool
If True this is a descriptor attribute in a class definition, else it is a DataInfo() object that is bound to a data object instance. Default is False.
Attributes Summary
attr_namesattrs_from_parentMethods Summary
__call__([option, out])Write summary information about data object to the outfilehandle.info_summary_attributes(dat)info_summary_stats(dat)Attributes Documentation
-
attr_names= {'meta', 'name', 'format', 'unit', 'description', 'dtype'}¶
-
attrs_from_parent= set()¶
Methods Documentation
-
__call__(option='attributes', out='')[source]¶ Write summary information about data object to the
outfilehandle. By default this prints to standard output via sys.stdout.The
optionargument specifies what type of information to include. This can be a string, a function, or a list of strings or functions. Built-in options are:attributes: data object attributes likedtypeandformatstats: basic statistics: min, mean, and max
If a function is specified then that function will be called with the data object as its single argument. The function must return an OrderedDict containing the information attributes.
If a list is provided then the information attributes will be appended for each of the options, in order.
Parameters: - option : str, function, list of (str or function)
Info option, defaults to ‘attributes’.
- out : file-like object, None
Output destination, defaults to sys.stdout. If None then the OrderedDict with information attributes is returned
Returns: - info : OrderedDict if out==None else None
Examples
>>> from astropy.table import Column >>> c = Column([1, 2], unit='m', dtype='int32') >>> c.info() dtype = int32 unit = m class = Column n_bad = 0 length = 2
>>> c.info(['attributes', 'stats']) dtype = int32 unit = m class = Column mean = 1.5 std = 0.5 min = 1 max = 2 n_bad = 0 length = 2
-
static
info_summary_attributes(dat)¶
-
static
info_summary_stats(dat)¶