FoundryProductsTechnologyCompanyInvestor relationsResource libraryNews
Contact us
Resource library
    Resource library home
    Developer resources
    Applications
    Lessons
    Research and publications
    Support
      Software packages
        eqc-direct software package
        qci-client software package
        uqrng-direct software package
        emucore-direct software package
        eqc-models software package
          Getting Started
          Basic Usage
          eqc_models
          Dependencies
      Spec sheets
      User guides

Couldn’t find what you are looking for? Reach out to technical support.

Contact support
Privacy PolicyCookie PolicyTerms of UseForward Looking StatementsAccessibility Statement
Terms and Conditions of SaleEnd User License Agreement

© 2018-2026 Quantum Computing Inc.

Download

Default

Source code for eqc_models.utilities.fileio

  • # (C) Quantum Computing Inc., 2024.
  • import csv
  • [docs]
  • def read_config_file(filename):
  • config = {}
  • with open(filename, 'r') as file:
  • for line in file:
  • line = line.strip()
  • if line and '=' in line:
  • key, value = line.split('=', 1)
  • config[key.strip()] = value.strip()
  • return config
  • [docs]
  • def read_coefficient_file(filename):
  • with open(filename, 'r') as file:
  • reader = csv.reader(file)
  • coefficients = [float(x) for x, in reader]
  • return coefficients
  • [docs]
  • def read_index_file(filename):
  • indices = []
  • with open(filename, 'r') as file:
  • reader = csv.reader(file)
  • for item in reader:
  • indices.append([int(x.strip()) for x in item])
  • return indices
  • def write_coefficient_file(filename, coefficients):
  • with open(filename, "w") as fp:
  • for val in coefficients:
  • fp.write(f"{val}\n")
  • def write_indices_file(filename, indices):
  • with open(filename, "w") as fp:
  • writer = csv.writer(fp)
  • for row in indices:
  • writer.writerow(row)
Next page

Content

  • Source code for eqc_models.utilities.fileio