def get_apspec(self, aperture, coordsys=None, method='mean'):
        """
        Extract an aperture using cubes.extract_aperture
        (defaults to Cube coordinates)

        *aperture* [tuple or list] (x, y, radius)
            The aperture to use when extracting the data

        *coordsys* [ 'celestial' | 'galactic' | None]
            the coordinate system the aperture is specified in
            None indicates pixel coordinates (default)

        """

        import cubes
        if coordsys is not None:
            data = cubes.extract_aperture(self.cube, aperture,
                                          coordsys=coordsys,
                                          wcs=self.mapplot.wcs,
                                          method=method)
            sp = pyspeckit.Spectrum(xarr=self.xarr.copy(),
                                    data=data,
                                    header=self.header)
        else:
            data = cubes.extract_aperture(self.cube, aperture, coordsys=None,
                                          method=method)
            sp = pyspeckit.Spectrum(xarr=self.xarr.copy(),
                                    data=data,
                                    header=self.header)

        sp.specfit = copy.copy(self.specfit)
        sp.specfit.includemask = self.specfit.includemask.copy()
        sp.specfit.Spectrum = sp

        return sp
Exemple #2
0
    def get_apspec(self, aperture, coordsys=None, method='mean', **kwargs):
        """
        Extract an aperture using cubes.extract_aperture
        (defaults to Cube coordinates)

        *aperture* [tuple or list] (x, y, radius)
            The aperture to use when extracting the data

        *coordsys* [ 'celestial' | 'galactic' | None]
            the coordinate system the aperture is specified in
            None indicates pixel coordinates (default)

        """

        import cubes
        if coordsys is not None:
            wcs = self.mapplot.wcs
        else:
            wcs = None

        data = cubes.extract_aperture(self.cube,
                                      aperture,
                                      coordsys=coordsys,
                                      wcs=wcs,
                                      method=method,
                                      **kwargs)
        if self.errorcube is not None:
            error = cubes.extract_aperture(self.errorcube,
                                           aperture,
                                           coordsys=coordsys,
                                           wcs=self.mapplot.wcs,
                                           method='error',
                                           **kwargs)
        else:
            error = None

        header = cubes.speccen_header(
            fits.Header(cards=[(k, v) for k, v in self.header.iteritems()
                               if k != 'HISTORY']),
            lon=aperture[0],
            lat=aperture[1],
            system=self.system,
            proj=self.header['CTYPE1'][-3:])
        header['APRADIUS'] = aperture[2]

        sp = pyspeckit.Spectrum(xarr=self.xarr.copy(),
                                data=data,
                                error=error,
                                header=header)

        sp.specfit = copy.copy(self.specfit)
        sp.specfit.includemask = self.specfit.includemask.copy()
        sp.specfit.Spectrum = sp

        return sp
    def set_apspec(self, aperture, coordsys=None, method='mean'):
        """
        Extract an aperture using cubes.extract_aperture
        (defaults to Cube coordinates)
        """

        import cubes
        if coordsys is not None:
            self.data = cubes.extract_aperture( self.cube, aperture , coordsys=coordsys , wcs=self.mapplot.wcs, method=method )
        else:
            self.data = cubes.extract_aperture( self.cube, aperture , coordsys=None, method=method)
    def get_apspec(self, aperture, coordsys=None, method='mean', **kwargs):
        """
        Extract an aperture using cubes.extract_aperture
        (defaults to Cube coordinates)

        *aperture* [tuple or list] (x, y, radius)
            The aperture to use when extracting the data

        *coordsys* [ 'celestial' | 'galactic' | None]
            the coordinate system the aperture is specified in
            None indicates pixel coordinates (default)

        """

        import cubes
        if coordsys is not None:
            wcs = self.mapplot.wcs
        else:
            wcs = None

        data = cubes.extract_aperture(self.cube, aperture,
                                      coordsys=coordsys,
                                      wcs=wcs,
                                      method=method,
                                      **kwargs)
        if self.errorcube is not None:
            error = cubes.extract_aperture(self.errorcube, aperture,
                                           coordsys=coordsys,
                                           wcs=self.mapplot.wcs,
                                           method='error', **kwargs)
        else:
            error = None

        header = cubes.speccen_header(fits.Header(cards=[(k,v) for k,v in
                                                         self.header.iteritems()
                                                         if k != 'HISTORY']),
                                      lon=aperture[0],
                                      lat=aperture[1],
                                      system=self.system,
                                      proj=self.header['CTYPE1'][-3:])
        header['APRADIUS'] = aperture[2]

        sp = pyspeckit.Spectrum(xarr=self.xarr.copy(),
                                data=data,
                                error=error,
                                header=header)

        sp.specfit = copy.copy(self.specfit)
        sp.specfit.includemask = self.specfit.includemask.copy()
        sp.specfit.Spectrum = sp

        return sp
Exemple #5
0
    def set_apspec(self, aperture, coordsys=None, method='mean'):
        """
        Extract an aperture using cubes.extract_aperture
        (defaults to Cube coordinates)
        """

        import cubes
        if coordsys is not None:
            self.data = cubes.extract_aperture(self.cube,
                                               aperture,
                                               coordsys=coordsys,
                                               wcs=self.mapplot.wcs,
                                               method=method)
        else:
            self.data = cubes.extract_aperture(self.cube,
                                               aperture,
                                               coordsys=None,
                                               method=method)