An Example Function from CalculatorInterface_GEMINI.pyΒΆ

The example function below is auto-generated by the mkCalculatorInterface script. The CalculatorInterface_GEMINI.py file should never be edited directly.

def airmass(self, format=None, **args):
    """
    Return the airmass value

    :param dataset: the data set
    :type dataset: AstroData
    :param format: the return format
    :type format: string
    :rtype: float as default (i.e., format=None)
    :return: the mean airmass of the observation
    """
    try:
        self._lazyloadCalculator()
        keydict = self.descriptor_calculator._specifickey_dict
        key = "key_airmass"
        keyword = None
        if key in keydict.keys():
            keyword = keydict[key]

        if not hasattr(self.descriptor_calculator, "airmass"):
            if keyword is not None:
                retval = self.phu_get_key_value(keyword)
                if retval is None:
                    if hasattr(self, "exception_info"):
                        raise Errors.DescriptorError(self.exception_info)
            else:
                msg = ("Unable to find an appropriate descriptor "
                       "function or a default keyword for airmass")
                raise Errors.DescriptorError(msg)
        else:
            try:
                retval = self.descriptor_calculator.airmass(self, **args)
            except Exception as e:
                raise Errors.DescriptorError(e)


        ret = DescriptorValue( retval,
                               format = format,
                               name = "airmass",
                               keyword = keyword,
                               ad = self,
                               pytype = float )
        return ret

    except Errors.DescriptorError:
        if self.descriptor_calculator.throwExceptions == True:
            raise
        else:
            if not hasattr(self, \"exception_info\"):
                setattr(self, \"exception_info\", sys.exc_info()[1])
            return None
    except:
        raise

Previous topic

A Complete List of Available Descriptors

Next topic

An Example Descriptor Function from GMOS_Descriptor.py

This Page