Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update gdsfactory829 #77

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Update gdsfactory829 #77

wants to merge 6 commits into from

Conversation

joamatab
Copy link
Contributor

@joamatab joamatab commented Jan 7, 2025

Summary by Sourcery

Refactor FET and diode drawing functions to use relative coordinates.

Bug Fixes:

  • Fixed a bug where absolute coordinates were used instead of relative coordinates in the FET and diode drawing functions.

Enhancements:

  • Improved the readability and maintainability of the FET and diode drawing functions by using relative coordinates.

Copy link

sourcery-ai bot commented Jan 7, 2025

Reviewer's Guide by Sourcery

This pull request updates the gf180/cells/klayout/pymacros/cells library to use the new dx and dy properties instead of xmin, xmax, ymin, and ymax properties for getting the bounding box dimensions of components.

Class diagram showing the property name changes

classDiagram
    class Component {
        -size
        -position
        +dxmin
        +dxmax
        +dymin
        +dymax
        +dmove(dx, dy)
        note for Component "Changed from xmin/xmax/ymin/ymax
to dxmin/dxmax/dymin/dymax"
    }

    class Rectangle {
        +size
        +layer
        +dxmin
        +dxmax
        +dymin
        +dymax
        +dmove(dx, dy)
    }

    Component <|-- Rectangle
Loading

File-Level Changes

Change Details Files
Updated bounding box dimension accessors
  • Replaced xmin, xmax, ymin, and ymax with dxmin, dxmax, dymin, and dymax respectively.
  • Replaced x_range and y_range with dx_range and dy_range respectively in via_generator and via_stack functions.
  • Updated list comprehensions to use dx instead of x when appending elements based on bounding box dimensions.
  • Updated movex, movey, and move function calls with dmovex, dmovey, and dmove respectively.
  • Updated connect function calls to use the new port connection syntax.
  • Updated f-string formatting to use the new format specifier.
gf180/cells/klayout/pymacros/cells/draw_fet.py
gf180/diode.py
gf180/cells/klayout/pymacros/cells/draw_diode.py
gf180/fet.py
gf180/cells/klayout/pymacros/cells/draw_res.py
gf180/res.py
gf180/cap_mos.py
gf180/cells/klayout/pymacros/cells/draw_cap_mos.py
gf180/cap_mim.py
gf180/cells/klayout/pymacros/cells/draw_cap_mim.py
gf180/layers.py
gf180/via_generator.py
gf180/cells/klayout/pymacros/cells/via_generator.py
gf180/guardring.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Jan 7, 2025
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've reviewed this pull request using the Sourcery rules engine. If you would also like our AI-powered code review then let us know.

@@ -60,7 +60,7 @@ def __init__(self):

def display_text_impl(self):
# Provide a descriptive text for the cell
return "cap_mim(L=" + ("%.3f" % self.lc) + ",W=" + ("%.3f" % self.wc) + ")"
return "cap_mim(L=" + (f"{self.lc:.3f}") + ",W=" + (f"{self.wc:.3f}") + ")"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code-quality): Use f-string instead of string concatenation [×2] (use-fstring-for-concatenation)

Suggested change
return "cap_mim(L=" + (f"{self.lc:.3f}") + ",W=" + (f"{self.wc:.3f}") + ")"
return f"cap_mim(L={self.lc:.3f},W=" + f"{self.wc:.3f}" + ")"

@@ -66,7 +66,7 @@ def __init__(self):

def display_text_impl(self):
# Provide a descriptive text for the cell
return "cap_nmos(LC=" + ("%.3f" % self.lc) + ",WC=" + ("%.3f" % self.wc) + ")"
return "cap_nmos(LC=" + (f"{self.lc:.3f}") + ",WC=" + (f"{self.wc:.3f}") + ")"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code-quality): Use f-string instead of string concatenation [×2] (use-fstring-for-concatenation)

Suggested change
return "cap_nmos(LC=" + (f"{self.lc:.3f}") + ",WC=" + (f"{self.wc:.3f}") + ")"
return f"cap_nmos(LC={self.lc:.3f},WC=" + f"{self.wc:.3f}" + ")"

@@ -150,7 +150,7 @@

def display_text_impl(self):
# Provide a descriptive text for the cell
return "cap_pmos(LC=" + ("%.3f" % self.lc) + ",WC=" + ("%.3f" % self.wc) + ")"
return "cap_pmos(LC=" + (f"{self.lc:.3f}") + ",WC=" + (f"{self.wc:.3f}") + ")"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code-quality): Use f-string instead of string concatenation [×2] (use-fstring-for-concatenation)

Suggested change
return "cap_pmos(LC=" + (f"{self.lc:.3f}") + ",WC=" + (f"{self.wc:.3f}") + ")"
return f"cap_pmos(LC={self.lc:.3f},WC=" + f"{self.wc:.3f}" + ")"

@@ -232,7 +232,7 @@

def display_text_impl(self):
# Provide a descriptive text for the cell
return "cap_nmos_b(LC=" + ("%.3f" % self.lc) + ",WC=" + ("%.3f" % self.wc) + ")"
return "cap_nmos_b(LC=" + (f"{self.lc:.3f}") + ",WC=" + (f"{self.wc:.3f}") + ")"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code-quality): Use f-string instead of string concatenation [×2] (use-fstring-for-concatenation)

Suggested change
return "cap_nmos_b(LC=" + (f"{self.lc:.3f}") + ",WC=" + (f"{self.wc:.3f}") + ")"
return f"cap_nmos_b(LC={self.lc:.3f},WC=" + f"{self.wc:.3f}" + ")"

@@ -314,7 +314,7 @@

def display_text_impl(self):
# Provide a descriptive text for the cell
return "cap_pmos_b(LC=" + ("%.3f" % self.lc) + ",WC=" + ("%.3f" % self.wc) + ")"
return "cap_pmos_b(LC=" + (f"{self.lc:.3f}") + ",WC=" + (f"{self.wc:.3f}") + ")"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code-quality): Use f-string instead of string concatenation [×2] (use-fstring-for-concatenation)

Suggested change
return "cap_pmos_b(LC=" + (f"{self.lc:.3f}") + ",WC=" + (f"{self.wc:.3f}") + ")"
return f"cap_pmos_b(LC={self.lc:.3f},WC=" + f"{self.wc:.3f}" + ")"

@@ -322,7 +322,7 @@

def display_text_impl(self):
# Provide a descriptive text for the cell
return "diode_pw2dw(L=" + ("%.3f" % self.la) + ",W=" + ("%.3f" % self.wa) + ")"
return "diode_pw2dw(L=" + (f"{self.la:.3f}") + ",W=" + (f"{self.wa:.3f}") + ")"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code-quality): Use f-string instead of string concatenation [×2] (use-fstring-for-concatenation)

Suggested change
return "diode_pw2dw(L=" + (f"{self.la:.3f}") + ",W=" + (f"{self.wa:.3f}") + ")"
return f"diode_pw2dw(L={self.la:.3f},W=" + f"{self.wa:.3f}" + ")"

@@ -404,7 +404,7 @@

def display_text_impl(self):
# Provide a descriptive text for the cell
return "diode_dw2ps(L=" + ("%.3f" % self.la) + ",W=" + ("%.3f" % self.wa) + ")"
return "diode_dw2ps(L=" + (f"{self.la:.3f}") + ",W=" + (f"{self.wa:.3f}") + ")"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code-quality): Use f-string instead of string concatenation [×2] (use-fstring-for-concatenation)

Suggested change
return "diode_dw2ps(L=" + (f"{self.la:.3f}") + ",W=" + (f"{self.wa:.3f}") + ")"
return f"diode_dw2ps(L={self.la:.3f},W=" + f"{self.wa:.3f}" + ")"

@@ -485,7 +485,7 @@

def display_text_impl(self):
# Provide a descriptive text for the cell
return "sc_diode(L=" + ("%.3f" % self.la) + ",W=" + ("%.3f" % self.wa) + ")"
return "sc_diode(L=" + (f"{self.la:.3f}") + ",W=" + (f"{self.wa:.3f}") + ")"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code-quality): Use f-string instead of string concatenation [×2] (use-fstring-for-concatenation)

Suggested change
return "sc_diode(L=" + (f"{self.la:.3f}") + ",W=" + (f"{self.wa:.3f}") + ")"
return f"sc_diode(L={self.la:.3f},W=" + f"{self.wa:.3f}" + ")"

@@ -106,7 +106,7 @@ def __init__(self):

def display_text_impl(self):
# Provide a descriptive text for the cell
return "nfet(L=" + ("%.3f" % self.l_gate) + ",W=" + ("%.3f" % self.w_gate) + ")"
return "nfet(L=" + (f"{self.l_gate:.3f}") + ",W=" + (f"{self.w_gate:.3f}") + ")"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code-quality): Use f-string instead of string concatenation [×2] (use-fstring-for-concatenation)

Suggested change
return "nfet(L=" + (f"{self.l_gate:.3f}") + ",W=" + (f"{self.w_gate:.3f}") + ")"
return f"nfet(L={self.l_gate:.3f},W=" + f"{self.w_gate:.3f}" + ")"

@@ -245,7 +245,7 @@

def display_text_impl(self):
# Provide a descriptive text for the cell
return "pfet(L=" + ("%.3f" % self.l_gate) + ",W=" + ("%.3f" % self.w_gate) + ")"
return "pfet(L=" + (f"{self.l_gate:.3f}") + ",W=" + (f"{self.w_gate:.3f}") + ")"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code-quality): Use f-string instead of string concatenation [×2] (use-fstring-for-concatenation)

Suggested change
return "pfet(L=" + (f"{self.l_gate:.3f}") + ",W=" + (f"{self.w_gate:.3f}") + ")"
return f"pfet(L={self.l_gate:.3f},W=" + f"{self.w_gate:.3f}" + ")"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant