*Convert a right-ascension from sexegesimal format to decimal degrees.*

        Precision should be respected. If a float is passed to this method, the same float will be returned (useful if unclear which format coordinates are in).

        The code will attempt to read the sexegesimal value in whatever form it is passed. Any of the following should be handled correctly

        - ``23:45:21.23232``
        - ``23h45m21.23232s``
        - ``23 45 21.23232``
        - ``2 04 21.23232``
        - ``04:45  21``

        **Key Arguments:**
            - ``ra`` -- ra in sexegesimal units

        **Return:**
            - ``decimalDegrees``

        **Usage:**

            .. code-block:: python

                - replace dryxPython ra_sexegesimal_to_decimal with this version in all my code

                from astrocalc.coords import unit_conversion
                converter = unit_conversion(
                    log=log
                )
                ra = converter.ra_sexegesimal_to_decimal(
                    ra="04:45  21"
                )
                print ra

                # OUTPUT: 71.3375

def ra_sexegesimal_to_decimal(
        self,
        ra
    ):
        """
        *Convert a right-ascension from sexegesimal format to decimal degrees.*

        Precision should be respected. If a float is passed to this method, the same float will be returned (useful if unclear which format coordinates are in).

        The code will attempt to read the sexegesimal value in whatever form it is passed. Any of the following should be handled correctly

        - ``23:45:21.23232``
        - ``23h45m21.23232s``
        - ``23 45 21.23232``
        - ``2 04 21.23232``
        - ``04:45  21``

        **Key Arguments:**
            - ``ra`` -- ra in sexegesimal units

        **Return:**
            - ``decimalDegrees``

        **Usage:**

            .. code-block:: python

                - replace dryxPython ra_sexegesimal_to_decimal with this version in all my code

                from astrocalc.coords import unit_conversion
                converter = unit_conversion(
                    log=log
                )
                ra = converter.ra_sexegesimal_to_decimal(
                    ra="04:45  21"
                )
                print ra

                # OUTPUT: 71.3375
        """
        import re

        # TEST TO SEE IF DECIMAL DEGREES PASSED
        try:
            ra = float(ra)
            if ra >= 0. and ra <= 360.:
                self.log.info(
                    'RA seems to already be in decimal degrees, returning original value' % locals())
                return float(ra)
        except:
            pass

        # REMOVE SURROUNDING WHITESPACE
        ra = str(ra).strip()

        regex = re.compile(
            '^(\+?(\d|[0-1]\d|2[0-3]))\D+([0-5]\d)\D+([0-6]?\d(\.\d*?)?)(s)?\s*?$')
        raMatch = regex.match(ra)

        if raMatch:
            degrees = raMatch.group(1)
            minutes = raMatch.group(3)
            seconds = raMatch.group(4)

            degrees = abs(float(degrees)) * 15.0
            minutes = float(minutes) * 15.0
            seconds = float(seconds) * 15.0

            # PRECISION TEST
            # 1s ARCSEC = .000018519 DEGREE
            # THEREFORE REPORT SECONDS TO A PRECISION = INPUT PRECISION + 5
            decimalLen = len(repr(seconds).split(".")[-1])
            precision = decimalLen + 5

            decimalDegrees = (degrees + (minutes / 60.0)
                              + (seconds / 3600.0))

            decimalDegrees = "%0.*f" % (precision, decimalDegrees)

        else:
            raise IOError(
                "could not convert ra to decimal degrees, could not parse sexegesimal input. Original value was `%(ra)s`" % locals())

        raDeg = decimalDegrees
        self.log.debug('raDeg: %(decimalDegrees)s' % locals())
        self.log.info(
            'completed the ``ra_sexegesimal_to_decimal`` method')

        return float(raDeg)