astro_data_tag

astrodata.astro_data_tag(fn)[source]

Mark a method as a tag-producing method.

Parameters:

fn (method) – The method to be decorated

Return type:

A wrapper function

Notes

Decorator that marks methods of an AstroData derived class as part of the tag-producing system.

It wraps the method around a function that will ensure a consistent return value: the wrapped method can return any sequence of sequences of strings, and they will be converted to a TagSet. If the wrapped method returns None, it will be turned into an empty TagSet.

Example

class MyAstroData(AstroData):
    @astro_data_tag
    def my_tag_method(self):
        # Below are the tags generated by this method based on whether
        # the instrument is GMOS or not.
        if self.phu.get('INSTRUME') == 'GMOS':
            return {'GMOS'}

        return {'NOT_GMOS'}