Example #1
0
    def _make_header(self, tolerance=1e-8):
        """
        Generate a set of WCS parameter for the X-array
        """
        self.make_dxarr()

        if self.wcshead is None:
            self.wcshead = {}

        self.wcshead['CUNIT1'] = self.unit
        if fits_type[
                self.unit.
                physical_type] == 'VELO' and self.velocity_convention is not None:
            ctype = 'V' + convention_suffix[self.velocity_convention]
        else:
            ctype = fits_type[self.unit.physical_type]
        #self.wcshead['CTYPE1'] = ctype+fits_frame[self.frame]
        try:
            from spectral_cube import spectral_axis
            self.wcshead['CTYPE1'] = spectral_axis.determine_ctype_from_vconv(
                ctype, self.unit, self.velocity_convention)
        except ImportError:
            self.wcshead['CTYPE1'] = ctype
        # not needed ? self.wcshead['SPECSYS'] = fits_specsys[self.frame]
        self.wcshead['RESTFRQ'] = self.refX

        # check to make sure the X-axis is linear
        cdelt = self.cdelt(tolerance=tolerance)
        if cdelt is None:
            self.wcshead['CDELT1'] = None
            self.wcshead['CRPIX1'] = None
            self.wcshead['CRVAL1'] = None
            return False
        else:
            self.wcshead['CDELT1'] = cdelt
            self.wcshead['CRVAL1'] = self[0]
            self.wcshead['CRPIX1'] = 1.0
            return True
Example #2
0
    def _make_header(self, tolerance=1e-8):
        """
        Generate a set of WCS parameter for the X-array
        """
        self.make_dxarr()

        if self.wcshead is None:
            self.wcshead = {}

        self.wcshead['CUNIT1'] = self.unit
        if fits_type[self.unit.physical_type] == 'VELO' and self.velocity_convention is not None:
            ctype = 'V'+convention_suffix[self.velocity_convention]
        else:
            ctype = fits_type[self.unit.physical_type]
        #self.wcshead['CTYPE1'] = ctype+fits_frame[self.frame]
        try:
            from spectral_cube import spectral_axis
            self.wcshead['CTYPE1'] = spectral_axis.determine_ctype_from_vconv(ctype,
                                                                              self.unit,
                                                                              self.velocity_convention)
        except ImportError:
            self.wcshead['CTYPE1'] = ctype
        # not needed ? self.wcshead['SPECSYS'] = fits_specsys[self.frame]
        self.wcshead['RESTFRQ'] = self.refX

        # check to make sure the X-axis is linear
        cdelt = self.cdelt(tolerance=tolerance)
        if cdelt is None:
            self.wcshead['CDELT1'] = None
            self.wcshead['CRPIX1'] = None
            self.wcshead['CRVAL1'] = None
            return False
        else:
            self.wcshead['CDELT1'] = cdelt
            self.wcshead['CRVAL1'] = self[0]
            self.wcshead['CRPIX1'] = 1.0
            return True