How to use the fitsio._fitsio_wrap.parse_card function in fitsio

To help you get started, we’ve selected a few fitsio examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github esheldon / fitsio / fitsio / header.py View on Github external
def _set_as_key(self):
        card_string = self['card_string']
        res = _fitsio_wrap.parse_card(card_string)
        if len(res) == 5:
            keyclass, name, value, dtype, comment = res
        else:
            keyclass, name, dtype, comment = res
            value = None

        if keyclass == TYP_CONT_KEY:
            raise ValueError("bad card '%s'.  CONTINUE not "
                             "supported" % card_string)

        self['class'] = keyclass
        self['name'] = name
        self['value_orig'] = value
        self['value'] = self._convert_value(value)
        self['dtype'] = dtype
        self['comment'] = comment