Exemple #1
0
 def action(self, Data) :
     params = self.params
     # Keep track of how many pre existing flags there are for feedback
     # purposes.
     already_flagged = ma.count_masked(Data.data)
     if params["rotate"]:
         if (tuple(Data.field['CRVAL4']) == (1, 2, 3, 4)):
             rotate_pol.rotate(Data, (-5,-7,-8,-6))
             Data.add_history('Rotated to XX,XY,YX,YY')
     # Few operations to be performed before flagging.
     if params["perform_hanning"] :
         hanning.hanning_smooth(Data)
         Data.add_history('Hanning smoothed.')
     if params["cal_scale"] :
         cal_scale.scale_by_cal(Data, True, False, False)
         Data.add_history('Converted to units of noise cal temperture.')
     # Flag the data.
     apply_cuts(Data, sigma_thres=params['sigma_thres'], 
                 badness_thres=params['badness_thres'],
                 time_cut=params['time_cut'])
     Data.add_history('Flagged Bad Data.', ('Sigma threshold: '
                 + str(self.params['sigma_thres']), 'Badness threshold: '
                 + str(self.params['badness_thres']), 'Time mask size: '
                 + str(self.params['time_cut'])))
     # Report the number of new flags.
     new_flags = ma.count_masked(Data.data) - already_flagged
     self.block_feedback = str(new_flags) + ', '
     return Data
Exemple #2
0
    def action(self, Data):
        '''Prepares Data and flags RFI.
        
        Parameters
        ----------
        Data : DataBlock
            Contains information in a usable format direct from GBT. 

        Returns
        -------
        Data : DataBlock
            The input `Data` with RFI flagged. Will also be cal scaled and
            rotated to XX,YY... if so chosen.

        '''
        params = self.params
        # Keep track of how many pre existing flags there are for feedback
        # purposes.
        already_flagged = ma.count_masked(Data.data)
        if params["rotate"]:
            if (tuple(Data.field['CRVAL4']) == (1, 2, 3, 4)):
                rotate_pol.rotate(Data, (-5, -7, -8, -6))
                Data.add_history('Rotated to XX,XY,YX,YY')
        # Few operations to be performed before flagging.
        if params["perform_hanning"]:
            hanning.hanning_smooth(Data)
            Data.add_history('Hanning smoothed.')
        if params["cal_scale"] or params["cal_phase"]:
            cal_scale.scale_by_cal(Data,
                                   params['cal_scale'],
                                   False,
                                   False,
                                   False,
                                   rotate=params['cal_phase'])
            Data.add_history('Converted to units of noise cal temperture.')
        # Flag the data.
        apply_cuts(Data,
                   sigma_thres=params['sigma_thres'],
                   badness_thres=params['badness_thres'],
                   time_cut=params['time_cut'])
        Data.add_history(
            'Flagged Bad Data.',
            ('Sigma threshold: ' + str(self.params['sigma_thres']),
             'Badness threshold: ' + str(self.params['badness_thres']),
             'Time mask size: ' + str(self.params['time_cut'])))
        # Report the number of new flags.
        new_flags = ma.count_masked(Data.data) - already_flagged
        percent = float(new_flags) / Data.data.size * 100
        self.block_feedback = '%d (%f%%), ' % (new_flags, percent)
        return Data
    def action(self, Data):
        '''Prepares Data and flags RFI.
        
        Parameters
        ----------
        Data : DataBlock
            Contains information in a usable format direct from GBT. 

        Returns
        -------
        Data : DataBlock
            The input `Data` with RFI flagged. Will also be cal scaled and
            rotated to XX,YY... if so chosen.

        '''
        params = self.params
        # Keep track of how many pre existing flags there are for feedback
        # purposes.
        already_flagged = ma.count_masked(Data.data)
        if params["rotate"]:
            if (tuple(Data.field['CRVAL4']) == (1, 2, 3, 4)):
                rotate_pol.rotate(Data, (-5,-7,-8,-6))
                Data.add_history('Rotated to XX,XY,YX,YY')
        # Few operations to be performed before flagging.
        if params["perform_hanning"] :
            hanning.hanning_smooth(Data)
            Data.add_history('Hanning smoothed.')
        if params["cal_scale"] or params["cal_phase"]:
            cal_scale.scale_by_cal(Data, params['cal_scale'], False, False,
                                  False, rotate=params['cal_phase'])
            Data.add_history('Converted to units of noise cal temperture.')
        # Flag the data.
        apply_cuts(Data, sigma_thres=params['sigma_thres'], 
                    badness_thres=params['badness_thres'],
                    time_cut=params['time_cut'])
        Data.add_history('Flagged Bad Data.', ('Sigma threshold: '
                    + str(self.params['sigma_thres']), 'Badness threshold: '
                    + str(self.params['badness_thres']), 'Time mask size: '
                    + str(self.params['time_cut'])))
        # Report the number of new flags.
        new_flags = ma.count_masked(Data.data) - already_flagged
        percent = float(new_flags) / Data.data.size * 100
        self.block_feedback = '%d (%f%%), ' % (new_flags, percent)
        return Data