fitsmgmt.table.group_fits

fitsmgmt.table.group_fits(
    summary_table,
    type_key=None,
    type_val=None,
    group_key=None,
    table_filecol='file',
    verbose=False,
)

Organize the group_by and type_key for select_fits

Parameters

summary_table : pd.DataFrame | Table

The table which contains the metadata (header) of files. If it is in the astropy table format, it will be converted to ~pandas.DataFrame object.

type_key : str | list[str] | None = None

The header keyword for the ccd type, and the value you want to match.

type_val : str | list[str] | None = None

The header keyword for the ccd type, and the value you want to match.

group_key : None, str, list of str = None

The header keyword which will be used to make groups for the CCDs that have selected from type_key and type_val. If None (default), no grouping will occur, but it will return the ~pandas.DataFrameGroupBy object will be returned for the sake of consistency. Default: None.

Returns

grouped : ~pandas.DataFrameGroupBy

The table after the grouping process.

group_type_key : list of str

The type_key that can directly be used for select_fits for each element of grouped.groups. Basically this is type_key + group_key.

Examples

>>> allfits = list(Path('.').glob("*.fits"))
>>> import astroimred as air
>>> summary_table = fm.fits_summary(allfits)
>>> type_key = ["OBJECT"]
>>> type_val = ["dark"]
>>> group_key = ["EXPTIME"]
>>> gs, g_key = group_fits(summary_table,
...                        type_key,
...                        type_val,
...                        group_key)
>>> for g_val, group in gs:
>>>     _ = combine_ccd(group["file"],
...                     type_key=g_key,
...                     type_val=g_val)