astro_data_descriptor

astrodata.astro_data_descriptor(fn)[source]

Mark a class method as an AstroData descriptor.

Parameters:

fn (method) – The method to be decorated

Return type:

The tagged method (not a wrapper)

Warning

If used in combination with other decorators, this one must be the one on the top (i.e., the last one being applied). It doesn’t modify the method in any other way.

e.g.,

@astro_data_descriptor # This must be above returns_list
@returns_list
def my_descriptor_method(self):
    pass

Notes

This decorator is exactly equivalent to:

class MyClass:
    def my_descriptor_method(self):
        pass

    my_descriptor_method.descriptor_method = True

It is used to mark descriptors for collective operations, such as listing out the descriptors an AstroData object has or applying them to a set of extensions. See the documentation for descriptors() for an example.