code: def from_txt(filename, length, delta_f, low_freq_cutoff, is_asd_file=True):
      
      file_data = numpy.loadtxt(filename)
      if (file_data < 0).any() or \
                              numpy.logical_not(numpy.isfinite(file_data)).any():
          raise ValueError('Invalid data in ' + filename)
  
      freq_data = file_data[:, 0]
      noise_data = file_data[:, 1]
      if is_asd_file:
          noise_data = noise_data ** 2
  
      return from_numpy_arrays(freq_data, noise_data, length, delta_f,
                               low_freq_cutoff)
docs: Read an ASCII file containing one-sided ASD or PSD  data and generate
      a frequency series with the corresponding PSD. The ASD or PSD data is
      interpolated in order to match the desired resolution of the
      generated frequency series.
  
      Parameters
      ----------
      filename : string
          Path to a two-column ASCII file. The first column must contain
          the frequency (positive frequencies only) and the second column
          must contain the amplitude density OR power spectral density.
      length : int
          Length of the frequency series in samples.
      delta_f : float
          Frequency resolution of the frequency series in Herz.
      low_freq_cutoff : float
          Frequencies below this value are set to zero.
      is_asd_file : Boolean
          If false assume that the second column holds power spectral density.
          If true assume that the second column holds amplitude spectral density.
          Default: True
  
      Returns
      -------
      psd : FrequencySeries
          The generated frequency series.
  
      Raises
      ------
      ValueError
          If the ASCII file contains negative, infinite or NaN frequencies
          or amplitude densities.