Пример #1
0
 def setUp(self):
     path_to_project = r'..\_example_files'
     try:
         self.pinfo = epr.ProjectInfo(project_path=path_to_project,
                                      project_name='pyEPR_tutorial1',
                                      design_name='1. single_transmon')
     except:
         assert ConnectionError(
             'Failed to connect to HFSS. Opening it manually')
Пример #2
0
    def connect_ansys(self,
                      project_path: str = None,
                      project_name: str = None,
                      design_name: str = None):
        """
        If none of the optional parameters are provided: connects to the Ansys COM, then
        checks for, and grab if present, an active project, design, and design setup.

        If the optional parameters are provided: if present, opens the project file and design in Ansys.

        Args:
            project_path (str, optional): Path without file name
            project_name (str, optional): File name (with or without extension)
            design_name (str, optional): Name of the default design to open from the project file

        """
        if not system() == 'Windows':
            self.logger.warning(
                'You are using %s, but this is a renderer to Ansys, which only runs on Windows. '
                'Expect any sort of Errors if you try to work with this renderer beyond this point.'
                % system())

        # pyEPR does not like extensions
        if project_name:
            project_name = project_name.replace(".aedt", "")
        # open connection through pyEPR
        import pythoncom
        try:
            self._pinfo = epr.ProjectInfo(
                project_path=self._options['project_path']
                if not project_path else project_path,
                project_name=self._options['project_name']
                if not project_name else project_name,
                design_name=self._options['design_name']
                if not design_name else design_name)
        except pythoncom.com_error as error:
            print("com_error: ", error)
            hr, msg, exc, arg = error.args
            if msg == "Invalid class string":  # and hr == -2147221005 and exc is None and arg is None
                self.logger.error(
                    "pyEPR cannot find the Ansys COM. Ansys installation might not have registered it. "
                    "To verify if this is the problem, execute the following: ",
                    "`print(win32com.client.Dispatch('AnsoftHfss.HfssScriptInterface'))` ",
                    "If the print-out is not `<COMObject ...>` then Ansys COM is not registered, ",
                    "and you will need to look into correcting your Ansys installation."
                )
            raise error
Пример #3
0
# -*- coding: utf-8 -*-
"""
My First pyEPR Script
"""

import pyEPR as epr
from pathlib import Path
import logging
epr.logger.setLevel(logging.DEBUG)

if 1:
    path_to_project = r'Z:\akshay_koottandavida\3. Pair-Coherent States\HFSS\pcs_straddling_regime'
    pinfo = epr.ProjectInfo(project_path=path_to_project,
                            project_name='straddling_regime_transmon',
                            design_name='2. stradling_tmon_prev_sample')

    pinfo.junctions['j1'] = {
        'Lj_variable': 'LJ_wig',
        'rect': 'wigner_qubit',
        'line': 'Polyline1',
        'length': epr.parse_units('200um')
    }

    pinfo.validate_junction_info()
    eprh = epr.DistributedAnalysis(pinfo)
    eprh.do_EPR_analysis()

    epra = epr.QuantumAnalysis(eprh.data_filename)

    # Analyze
    epra.analyze_all_variations(cos_trunc=6, fock_trunc=7, return_ef=True)