예제 #1
0
    def get_ref_image(self, preprocess=True):
        """Return the reference image (:class:`libwise.imgutils.Image`) of the project, 
        used for the projection defintion and several plotting tasks.

        A reference image can be set using self.config.data.ref_image_filename. 
        Alternatively the first file of the project is used.
        
        Parameters
        ----------
        preprocess : bool, optional
            If True, the reference image is pre processed .
        """
        ref_file = os.path.join(self.get_data_dir(),
                                self.config.data.ref_image_filename)
        if not os.path.isfile(ref_file):
            if len(self.files) == 0:
                raise Exception("No files selected")
            ref_file = self.files[0]

        img = imgutils.guess_and_open(ref_file, check_stack_img=True)

        if preprocess:
            self.pre_process(img)

        return img
예제 #2
0
파일: project.py 프로젝트: flomertens/wise
 def open_file(self, file):
     """Open `file` and return an image (:class:`libwise.imgutils.Image`).
     """
     img = imgutils.guess_and_open(file, fits_extension=self.config.data.fits_extension)
     if self.config.data.crval is not None:
         img.set_crval(self.config.data.crval)
     if self.config.data.crpix is not None:
         img.set_pix_ref(self.config.data.crpix)
     return img
예제 #3
0
 def open_file(self, file):
     """Open `file` and return an image (:class:`libwise.imgutils.Image`).
     """
     img = imgutils.guess_and_open(
         file, fits_extension=self.config.data.fits_extension)
     if self.config.data.crval is not None:
         img.set_crval(self.config.data.crval)
     if self.config.data.crpix is not None:
         img.set_pix_ref(self.config.data.crpix)
     return img
예제 #4
0
def main():
    sh.init(libwise.get_version(), USAGE)
    args = sh.get_args(min_nargs=1)

    img = imgutils.guess_and_open(args[0])
    editor = PolyRegionEditor.PolyRegionEditor(img, current_folder=os.path.dirname(img.file))

    if len(args) >= 2:
        poly_region = imgutils.PolyRegion.from_file(args[1], img.get_coordinate_system())
        editor.load_poly_region(poly_region)

    editor.start()
예제 #5
0
def main():
    sh.init(libwise.get_version(), USAGE)
    args = sh.get_args(min_nargs=1)

    img = imgutils.guess_and_open(args[0])
    editor = PolyRegionEditor.PolyRegionEditor(img,
                                               current_folder=os.path.dirname(
                                                   img.file))

    if len(args) >= 2:
        poly_region = imgutils.PolyRegion.from_file(
            args[1], img.get_coordinate_system())
        editor.load_poly_region(poly_region)

    editor.start()
예제 #6
0
파일: project.py 프로젝트: flomertens/wise
    def get_ref_image(self, preprocess=True):
        """Return the reference image (:class:`libwise.imgutils.Image`) of the project, 
        used for the projection defintion and several plotting tasks.

        A reference image can be set using self.config.data.ref_image_filename. 
        Alternatively the first file of the project is used.
        
        Parameters
        ----------
        preprocess : bool, optional
            If True, the reference image is pre processed .
        """
        ref_file =  os.path.join(self.get_data_dir(), self.config.data.ref_image_filename)
        if not os.path.isfile(ref_file):
            if len(self.files) == 0:
                raise Exception("No files selected")
            ref_file = self.files[0]

        img = imgutils.guess_and_open(ref_file, check_stack_img=True)

        if preprocess:
            self.pre_process(img)

        return img