TimeInfo

class astropy.time.TimeInfo(bound=False)[source] [edit on github]

Bases: astropy.utils.data_info.MixinInfo

Container for meta information like name, description, format. This is required when the object is used as a mixin column within a table, but can be used as a general way to store meta information.

Attributes Summary

attr_names
attrs_from_parent
unit

Methods Summary

__call__([option, out]) Write summary information about data object to the out filehandle.
adjust_indices(index, value, col_len) Adjust info indices after column modification.
info_summary_attributes(dat)
info_summary_stats(dat)
iter_str_vals() This is a mixin-safe version of Column.iter_str_vals.
merge_cols_attributes(cols, …) Utility method to merge and validate the attributes attrs for the input table columns cols.
slice_indices(col_slice, item, col_len) Given a sliced object, modify its indices to correctly represent the slice.

Attributes Documentation

attr_names = {'name', 'description', 'dtype', 'parent_table', 'serialize_method', 'unit', 'format', 'meta', 'indices'}
attrs_from_parent = {'unit'}
unit

Methods Documentation

__call__(option='attributes', out='') [edit on github]

Write summary information about data object to the out filehandle. By default this prints to standard output via sys.stdout.

The option argument 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 like dtype and format
  • stats: 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
adjust_indices(index, value, col_len) [edit on github]

Adjust info indices after column modification.

Parameters:

index : slice, int, list, or ndarray

Element(s) of column to modify. This parameter can be a single row number, a list of row numbers, an ndarray of row numbers, a boolean ndarray (a mask), or a column slice.

value : int, list, or ndarray

New value(s) to insert

col_len : int

Length of the column

static info_summary_attributes(dat) [edit on github]
static info_summary_stats(dat) [edit on github]
iter_str_vals() [edit on github]

This is a mixin-safe version of Column.iter_str_vals.

static merge_cols_attributes(cols, metadata_conflicts, name, attrs) [edit on github]

Utility method to merge and validate the attributes attrs for the input table columns cols.

Note that dtype and shape attributes are handled specially. These should not be passed in attrs but will always be in the returned dict of merged attributes.

Parameters:

cols : list

List of input Table column objects

metadata_conflicts : str (‘warn’|’error’|’silent’)

How to handle metadata conflicts

name : str

Output column name

attrs : list

List of attribute names to be merged

Returns:

attrs : dict of merged attributes

slice_indices(col_slice, item, col_len) [edit on github]

Given a sliced object, modify its indices to correctly represent the slice.

Parameters:

col_slice : Column or mixin

Sliced object

item : slice, list, or ndarray

Slice used to create col_slice

col_len : int

Length of original object