TimeInfoBase¶
- class astropy.time.TimeInfoBase(bound=False)[source]¶
Bases:
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.
This base class is common between TimeInfo and TimeDeltaInfo.
Attributes Summary
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.
Return a list of arrays which can be lexically sorted to represent the order of the parent column.
info_summary_stats
(dat)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 columnscols
.new_like
(cols, length[, metadata_conflicts, ...])Return a new Time instance which is consistent with the input Time objects
cols
and haslength
rows.slice_indices
(col_slice, item, col_len)Given a sliced object, modify its indices to correctly represent the slice.
Attributes Documentation
- attr_names = {'description', 'dtype', 'format', 'indices', 'meta', 'name', 'parent_table', 'serialize_method', 'unit'}¶
- attrs_from_parent = {}¶
- description¶
- dtype¶
- format¶
- groups¶
- indices¶
- mask_val = masked¶
- meta¶
- name¶
- parent_table¶
- serialize_method¶
- unit¶
Methods Documentation
- __call__(option='attributes', out='')¶
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 likedtype
andformat
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
python:str
,python:callable()
,python:list
of (python:str
orpython:callable()
) Info option, defaults to ‘attributes’.
- outpython:file-like object,
python:None
Output destination, defaults to sys.stdout. If None then the OrderedDict with information attributes is returned
- option
- Returns:
- info
OrderedDict
orpython:None
OrderedDict
if out==None else None
- info
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)¶
Adjust info indices after column modification.
- Parameters:
- index
slice
,python:int
,python:list
, orndarray
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
python:int
,python:list
, orndarray
New value(s) to insert
- col_len
python:int
Length of the column
- index
- get_sortable_arrays()[source]¶
Return a list of arrays which can be lexically sorted to represent the order of the parent column.
- Returns:
- arrays
python:list
ofndarray
- arrays
- static info_summary_attributes(dat)¶
- static info_summary_stats(dat)¶
- iter_str_vals()¶
This is a mixin-safe version of Column.iter_str_vals.
- static merge_cols_attributes(cols, metadata_conflicts, name, attrs)¶
Utility method to merge and validate the attributes
attrs
for the input table columnscols
.Note that
dtype
andshape
attributes are handled specially. These should not be passed inattrs
but will always be in the returned dict of merged attributes.- Parameters:
- cols
python:list
List of input Table column objects
- metadata_conflicts
python:str
(‘warn’|’error’|’silent’) How to handle metadata conflicts
- name
python:str
Output column name
- attrs
python:list
List of attribute names to be merged
- cols
- Returns:
- attrs
python:dict
Of merged attributes.
- attrs
- new_like(cols, length, metadata_conflicts='warn', name=None)[source]¶
Return a new Time instance which is consistent with the input Time objects
cols
and haslength
rows.This is intended for creating an empty Time instance whose elements can be set in-place for table operations like join or vstack. It checks that the input locations and attributes are consistent. This is used when a Time object is used as a mixin column in an astropy Table.
- Parameters:
- cols
python:list
List of input columns (Time objects)
- length
python:int
Length of the output column object
- metadata_conflicts
python:str
(‘warn’|’error’|’silent’) How to handle metadata conflicts
- name
python:str
Output column name
- cols
- Returns:
- col
Time
(or subclass) Empty instance of this class consistent with
cols
- col
- slice_indices(col_slice, item, col_len)¶
Given a sliced object, modify its indices to correctly represent the slice.
- Parameters:
- col_slice
Column
or mixin Sliced object. If not a column, it must be a valid mixin, see https://docs.astropy.org/en/stable/table/mixin_columns.html
- item
slice
,python:list
, orndarray
Slice used to create col_slice
- col_len
python:int
Length of original object
- col_slice