parameters: (self, file_name)
return_statement: return file_data
docstring: Select the appropriate file parser and check data was successfully
          loaded from file.
  
          @param file_name - path to the file.
          @return tuple of the frequencies, ir and raman intensities and weights
docstring_summary: Select the appropriate file parser and check data was successfully
          loaded from file.
docstring_tokens: Select the appropriate file parser and check data was successfully loaded from file .
function: def _read_data_from_file(self, file_name):
          """
          Select the appropriate file parser and check data was successfully
          loaded from file.
  
          @param file_name - path to the file.
          @return tuple of the frequencies, ir and raman intensities and weights
          """
          ext = os.path.splitext(file_name)[1]
  
          if ext == '.phonon':
              record_eigenvectors = self._calc_partial \
                                     or (self._spec_type == 'DOS' and self._scale_by_cross_section != 'None') \
                                     or self._spec_type == 'BondAnalysis'
  
              file_data, element_isotopes = parse_phonon_file(file_name, record_eigenvectors)
              self._element_isotope = element_isotopes
              self._num_ions = file_data['num_ions']
  
          elif ext == '.castep':
              if len(self._ions_of_interest) > 0:
                  raise ValueError("Cannot compute partial density of states from .castep files.")
  
              ir_or_raman = self._spec_type == 'IR_Active' or self._spec_type == 'Raman_Active'
              file_data = parse_castep_file(file_name, ir_or_raman)
  
          if file_data['frequencies'].size == 0:
              raise ValueError("Failed to load any frequencies from file.")
  
          return file_data
function_tokens: def _read_data_from_file ( self , file_name ) : ext = os . path . splitext ( file_name ) [ 1 ] if ext == '.phonon' : record_eigenvectors = self . _calc_partial or ( self . _spec_type == 'DOS' and self . _scale_by_cross_section != 'None' ) or self . _spec_type == 'BondAnalysis' file_data , element_isotopes = parse_phonon_file ( file_name , record_eigenvectors ) self . _element_isotope = element_isotopes self . _num_ions = file_data [ 'num_ions' ] elif ext == '.castep' : if len ( self . _ions_of_interest ) > 0 : raise ValueError ( "Cannot compute partial density of states from .castep files." ) ir_or_raman = self . _spec_type == 'IR_Active' or self . _spec_type == 'Raman_Active' file_data = parse_castep_file ( file_name , ir_or_raman ) if file_data [ 'frequencies' ] . size == 0 : raise ValueError ( "Failed to load any frequencies from file." ) return file_data