예제 #1
0
    def setpara_bdsm(self, img):
        from types import ClassType, TypeType

        chain = [
            Op_preprocess,
            Op_rmsimage(),
            Op_threshold(),
            Op_islands(),
            Op_gausfit(),
            Op_gaul2srl(),
            Op_make_residimage()
        ]

        opts = img.opts.to_dict()
        if img.opts.pi_thresh_isl != None:
            opts['thresh_isl'] = img.opts.pi_thresh_isl
        if img.opts.pi_thresh_pix != None:
            opts['thresh_pix'] = img.opts.pi_thresh_pix
        opts['thresh'] = 'hard'
        opts['polarisation_do'] = False
        opts['filename'] = ''
        opts['detection_image'] = ''

        ops = []
        for op in chain:
            if isinstance(op, (ClassType, TypeType)):
                ops.append(op())
            else:
                ops.append(op)

        return ops, opts
예제 #2
0
    def setpara_bdsm(self, img):
        from types import ClassType, TypeType

        chain = [
            Op_preprocess,
            Op_rmsimage(),
            Op_threshold(),
            Op_islands(),
            Op_gausfit(),
            Op_gaul2srl(),
            Op_make_residimage()
        ]

        opts = {'thresh': 'hard'}
        opts['thresh_pix'] = img.thresh_pix
        opts['kappa_clip'] = 3.0
        opts['rms_map'] = img.opts.rms_map
        opts['mean_map'] = img.opts.mean_map
        opts['thresh_isl'] = img.opts.thresh_isl
        opts['minpix_isl'] = 6
        opts['savefits_rmsim'] = False
        opts['savefits_meanim'] = False
        opts['savefits_rankim'] = False
        opts['savefits_normim'] = False
        opts['polarisation_do'] = False
        opts['aperture'] = None
        opts['group_by_isl'] = img.opts.group_by_isl
        opts['quiet'] = img.opts.quiet
        opts['ncores'] = img.opts.ncores

        opts['flag_smallsrc'] = False
        opts['flag_minsnr'] = 0.2
        opts['flag_maxsnr'] = 1.2
        opts['flag_maxsize_isl'] = 2.5
        opts['flag_bordersize'] = 0
        opts['flag_maxsize_bm'] = 50.0
        opts['flag_minsize_bm'] = 0.2
        opts['flag_maxsize_fwhm'] = 0.5
        opts['bbs_patches'] = img.opts.bbs_patches
        opts['filename'] = ''
        opts['output_all'] = img.opts.output_all
        opts['verbose_fitting'] = img.opts.verbose_fitting
        opts['split_isl'] = False
        opts['peak_fit'] = True
        opts['peak_maxsize'] = 30.0
        opts['detection_image'] = ''
        opts['verbose_fitting'] = img.opts.verbose_fitting

        ops = []
        for op in chain:
            if isinstance(op, (ClassType, TypeType)):
                ops.append(op())
            else:
                ops.append(op)

        return ops, opts
예제 #3
0
    def rms_spectrum(self, img, image):
        from rmsimage import Op_rmsimage
        global bar1
        mylog = img.mylog

        nchan = image.shape[0]
        rms_map = img.use_rms_map
        if img.opts.kappa_clip is None:
            kappa = -img.pixel_beamarea()
        else:
            kappa = img.opts.kappa_clip
        map_opts = (kappa, img.rms_box, img.opts.spline_rank)

        if rms_map:
            rms_spec = N.zeros(image.shape, dtype=N.float32)
            mean = N.zeros(image.shape[1:], dtype=N.float32)
            rms = N.zeros(image.shape[1:], dtype=N.float32)
            median_rms = N.zeros(nchan)
            for ichan in range(nchan):
                if bar1.started:
                    bar1.increment()
                dumi = Op_rmsimage()
                Op_rmsimage.map_2d(dumi, image[ichan], mean, rms, None, *map_opts)
                rms_spec[ichan,:,:] = rms
                median_rms[ichan] = N.median(rms)
        else:
            rms_spec = N.zeros(image.shape, dtype=N.float32)
            for ichan in range(nchan):
              if bar1.started:
                  bar1.increment()
              rms_spec[ichan,:,:] = img.channel_clippedrms[ichan]
            median_rms = rms_spec

        str1 = " ".join(["%9.4e" % n for n in img.channel_clippedrms])
        if rms_map:
            mylog.debug('%s %s ' % ('Median rms of channels : ', str1))
            mylog.info('RMS image made for each channel')
        else:
            mylog.debug('%s %s ' % ('RMS of channels : ', str1))
            mylog.info('Clipped rms calculated for each channel')

        return rms_spec
예제 #4
0
    def setpara_bdsm(self, img, det_file):
        from types import ClassType, TypeType

        chain=[Op_readimage(), Op_collapse(), Op_preprocess, Op_rmsimage(),
                Op_threshold(), Op_islands()]
        opts = img.opts.to_dict()
        opts['filename'] = det_file
        opts['detection_image'] = ''
        opts['polarisation_do'] = False

        ops = []
        for op in chain:
          if isinstance(op, (ClassType, TypeType)):
            ops.append(op())
          else:
            ops.append(op)

        return ops, opts
예제 #5
0
from make_residimage import Op_make_residimage
from output import Op_outlist
from shapefit import Op_shapelets
from gaul2srl import Op_gaul2srl
from spectralindex import Op_spectralindex
from polarisation import Op_polarisation
from wavelet_atrous import Op_wavelet_atrous
from psf_vary import Op_psf_vary
from cleanup import Op_cleanup
from _version import __version__
import gc

default_chain = [Op_readimage(),
                 Op_collapse(),
                 Op_preprocess(),
                 Op_rmsimage(),
                 Op_threshold(),
                 Op_islands(),
                 Op_gausfit(),
                 Op_wavelet_atrous(),
                 Op_shapelets(),
                 Op_gaul2srl(),
                 Op_spectralindex(),
                 Op_polarisation(),
                 Op_make_residimage(),
                 Op_psf_vary(),
                 Op_outlist(),
                 Op_cleanup()
                 ]
fits_chain = default_chain # for legacy scripts