Ejemplo n.º 1
0
    def read_linelist(self, fname=''):
        '''
        Reads in a txt linelist file. Frequencies should be in MHz. 
        It creates a plottable spectrum.
        
        Parameters
        ----------
        fname (str): Filename of the linelist file (''). If no filename is specified, 
        it uses the default filename "test.txt".

        Returns
        -------
        none
        
        Notes
        -----
        none
        
        '''
        
        try:
            if fname == '':
                fname = self.gen_params['fname']
            else:
                self.gen_params['fname'] = fname
            f = open(fname, 'r')
            f.close()
        except IOError:
            print 'Cannot open: ', self.gen_params['fname']
        else:
            h = readout.linesReadoutTxt(fname=self.gen_params['fname'])

            self.spec = lines_to_spec(h.lines)
            self.spec_params['max_f'] = h.meas_params['max_f']
            self.spec_params['min_f'] = h.meas_params['min_f']
Ejemplo n.º 2
0
def del_lines(spec=np.array([[]]), linelist_path='', files=[], thresh=.2, new_val=.0):
    '''
    Deletes unwanted lines in the spectrum. Makes use of one or more linelist 
    text files.
    
    
    Parameters
    ----------        
    lineliste_path (str): folderpath, where the linelist files are located
    files (list, str): filenames of the linelist files
    thresh (float): specifies the range (+-) of deleted points in MHz
    
    Path: /Users/davidschmitz/Documents/Programmierung/Python/linelists/
    '''

    lines = np.array([[]])
    
    for x in files:
        h = readout.linesReadoutTxt(fname=linelist_path + x)
        lines = h.lines[:,0]
        for x in lines: # Delete line if within 200 kHz range
            spec[np.where(np.abs(spec[:,0] - x) < thresh), 1] = 0.
            
    return spec