qiskit-community / qiskit-metal

Quantum Hardware Design. Open-source project for engineers and scientists to design superconducting quantum devices with ease.
https://qiskit-community.github.io/qiskit-metal/
Apache License 2.0
270 stars 201 forks source link

Input Type error of 'render_design()' in class 'QHFSSDrivenmodalPyaedt()' #992

Open ChrisW918 opened 2 weeks ago

ChrisW918 commented 2 weeks ago

Information

What is the current behavior?

I wanted to use pyaedt to build connect between my Ansys Student Version and the metal script, following by the notebook DrivenModal.

The issue occurs when I execute

hfss_dm.render_design(selection=[
    'TQ1', 'TQ2', 'cpw_openRight', 'cpw_openLeft', 'cpw_middle', 'Q1', 'Q2'],
                      open_pins=[],
                      port_list=[
                          ('cpw_openRight', 'end', 50),
                                 ('cpw_openLeft', 'end', 50)
                                 ],
                      jj_to_port=[ ('Q2', 'rect_jj', 51)],
                      ignored_jjs=[('Q1', 'rect_jj')],
                      box_plus_buffer=True)

, and it reports

TypeError: unsupported operand type(s) for /: 'Dict' and 'int'

Steps to reproduce the problem

I looked into the function description of render_design() and the suggested format of input is exactly (component name[str], element name[str], impedence[int]).

What I've tried is to replace the int value of impedence as str '50', and the cell successfully executed with notification

11:42PM 08s ERROR [confirm_port_list_have_valid_request]: Impedance should be either float or int. You have impedance=50 11:42PM 08s ERROR [valid_input_arguments]: Arguments are not in Design for port_list. 11:42PM 08s ERROR [render_design]: Check the arguments to render_design, invalid name was probably used.

Therefore, the value is not succefully imported.

What is the expected behavior?

As I run the cells in notebook, it should be well worked.

Suggested solutions

I would like to ask to look deep into the function of render_design() and its inherted functions to see which one reports the TypeError, and eventually makes the notebook successfully executes.

zlatko-minev commented 1 week ago

Hi Chris,

Thanks for checking this out.

Let's see, so the pyaedt codebase has changed a bit since the notebook was written.

Can you show the full trace back? So the issue is only with the port values?

Have you looked in here btw? https://github.com/qiskit-community/qiskit-metal/blob/main/qiskit_metal/renderers/renderer_ansys_pyaedt/hfss_renderer_drivenmodal_aedt.py This is where render_design is defined

ChrisW918 commented 1 week ago

Hi @zlatko-minev,

Here is the full trace back,

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[43], [line 1](vscode-notebook-cell:?execution_count=43&line=1)
----> [1](vscode-notebook-cell:?execution_count=43&line=1) hfss_dm.render_design(selection=[
      [2](vscode-notebook-cell:?execution_count=43&line=2)     'TQ1', 'TQ2', 'cpw_openRight', 'cpw_openLeft', 'cpw_middle', 'Q1', 'Q2'
      [3](vscode-notebook-cell:?execution_count=43&line=3) ],
      [4](vscode-notebook-cell:?execution_count=43&line=4)                       open_pins=[],
      [5](vscode-notebook-cell:?execution_count=43&line=5)                       port_list=[('cpw_openRight', 'end', 50),
      [6](vscode-notebook-cell:?execution_count=43&line=6)                                  ('cpw_openLeft', 'end', 50)],
      [7](vscode-notebook-cell:?execution_count=43&line=7)                       jj_to_port=[('Q2', 'rect_jj', 51)],
      [8](vscode-notebook-cell:?execution_count=43&line=8)                       ignored_jjs=[('Q1', 'rect_jj')],
      [9](vscode-notebook-cell:?execution_count=43&line=9)                       box_plus_buffer=True)

File c:\Users\kriswang\anaconda3\envs\qiskitMetal\lib\site-packages\qiskit_metal\renderers\renderer_ansys_pyaedt\hfss_renderer_drivenmodal_aedt.py:513, in QHFSSDrivenmodalPyaedt.render_design(self, selection, open_pins, port_list, jj_to_port, ignored_jjs, box_plus_buffer)
    [509](file:///C:/Users/kriswang/anaconda3/envs/qiskitMetal/lib/site-packages/qiskit_metal/renderers/renderer_ansys_pyaedt/hfss_renderer_drivenmodal_aedt.py:509) # self.fill_info will hold the name of newly generated box,
    [510](file:///C:/Users/kriswang/anaconda3/envs/qiskitMetal/lib/site-packages/qiskit_metal/renderers/renderer_ansys_pyaedt/hfss_renderer_drivenmodal_aedt.py:510) # along with information from layer stack
    [511](file:///C:/Users/kriswang/anaconda3/envs/qiskitMetal/lib/site-packages/qiskit_metal/renderers/renderer_ansys_pyaedt/hfss_renderer_drivenmodal_aedt.py:511) self.fill_info = self.design.ls.get_layer_datatype_when_fill_is_true()
--> [513](file:///C:/Users/kriswang/anaconda3/envs/qiskitMetal/lib/site-packages/qiskit_metal/renderers/renderer_ansys_pyaedt/hfss_renderer_drivenmodal_aedt.py:513) super().render_design(selection, open_pins, port_list, jj_to_port,
    [514](file:///C:/Users/kriswang/anaconda3/envs/qiskitMetal/lib/site-packages/qiskit_metal/renderers/renderer_ansys_pyaedt/hfss_renderer_drivenmodal_aedt.py:514)                       ignored_jjs, box_plus_buffer)
    [516](file:///C:/Users/kriswang/anaconda3/envs/qiskitMetal/lib/site-packages/qiskit_metal/renderers/renderer_ansys_pyaedt/hfss_renderer_drivenmodal_aedt.py:516) if self.case == 2:
    [517](file:///C:/Users/kriswang/anaconda3/envs/qiskitMetal/lib/site-packages/qiskit_metal/renderers/renderer_ansys_pyaedt/hfss_renderer_drivenmodal_aedt.py:517)     self.logger.warning(
    [518](file:///C:/Users/kriswang/anaconda3/envs/qiskitMetal/lib/site-packages/qiskit_metal/renderers/renderer_ansys_pyaedt/hfss_renderer_drivenmodal_aedt.py:518)         'Unable to proceed with rendering. Please check selection.')

File c:\Users\kriswang\anaconda3\envs\qiskitMetal\lib\site-packages\qiskit_metal\renderers\renderer_ansys_pyaedt\hfss_renderer_aedt.py:240, in QHFSSPyaedt.render_design(self, selection, open_pins, port_list, jj_to_port, ignored_jjs, box_plus_buffer)
    [236](file:///C:/Users/kriswang/anaconda3/envs/qiskitMetal/lib/site-packages/qiskit_metal/renderers/renderer_ansys_pyaedt/hfss_renderer_aedt.py:236) # Add something to clear design.
...
    [342](file:///C:/Users/kriswang/anaconda3/envs/qiskitMetal/lib/site-packages/qiskit_metal/renderers/renderer_ansys_pyaedt/pyaedt_base.py:342)     matname=material)
    [344](file:///C:/Users/kriswang/anaconda3/envs/qiskitMetal/lib/site-packages/qiskit_metal/renderers/renderer_ansys_pyaedt/pyaedt_base.py:344) # The transparency is hardcoded.  Ugh.
    [345](file:///C:/Users/kriswang/anaconda3/envs/qiskitMetal/lib/site-packages/qiskit_metal/renderers/renderer_ansys_pyaedt/pyaedt_base.py:345) # However, it was hardcoded without pyaedt, so for now, will leave it alone.

TypeError: unsupported operand type(s) for /: 'Dict' and 'int'

and here I also attach the argment setting, which should be two pairs of float Transmon-resonator model sharing one transmission line. Pleas check my arguments setting.

hfss_dm.render_design(selection=[
    'TQ1', 'TQ2', 'cpw_openRight', 'cpw_openLeft', 'cpw_middle', 'Q1', 'Q2'
],
                      open_pins=[],

                      port_list=[('cpw_openRight', 'end', '50'),
                                 ('cpw_openLeft', 'start', '50')
                                 ],
                      jj_to_port=[ ('Q2', 'rect_jj', 51),
                                  ('Q1', 'rect_jj', 52)],
                    #   ignored_jjs=[('Q1', 'rect_jj')],
                      box_plus_buffer=True)

I think only the port values arg report this issue since as I change the value into str and keep the setting of jj_to_port, it does not report error.

Also, I read the function description, and confused about the blink arg open_pins since apparently, the two pins of the transmission line should be open right?