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

improve get_cross_sections #2714

Merged
merged 2 commits into from
May 5, 2024
Merged

improve get_cross_sections #2714

merged 2 commits into from
May 5, 2024

Conversation

joamatab
Copy link
Contributor

@joamatab joamatab commented May 5, 2024

  • get cross_section can also get cross_section factories
  • fix trans_sc_nc second port

@joamatab joamatab added the bug Something isn't working label May 5, 2024
Copy link
Contributor

@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.

Hey @joamatab - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

Comment on lines +140 to +142
use_slab_port: if True, uses the port associated with the slab layer (layer_slab)
for the second output port of the component.
If False, the second port uses the same layer as the first port (layer_wg).
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion (code_clarification): Consider adding more detail to the 'use_slab_port' parameter description.

It would be helpful to specify what the implications are for signal integrity or other operational characteristics when changing the port layer.

Suggested change
use_slab_port: if True, uses the port associated with the slab layer (layer_slab)
for the second output port of the component.
If False, the second port uses the same layer as the first port (layer_wg).
use_slab_port: if True, uses the port associated with the slab layer (layer_slab)
for the second output port of the component. This can affect the modal properties
of the signal, potentially altering its propagation characteristics due to the
different material or structural properties of the slab layer.
If False, the second port uses the same layer as the first port (layer_wg),
maintaining consistent signal characteristics across both ports.

Comment on lines 2347 to 2356
if callable(t[1]) and not t[0].startswith("_"):
try:
r = signature(
t[1] if not isinstance(t[1], partial) else t[1].func
).return_annotation
if r == CrossSection or (
isinstance(r, str) and r.endswith("CrossSection")
):
xs[t[0]] = t[1]
except ValueError as e:
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion (code_refinement): Review error handling strategy for cross-section retrieval.

Consider whether logging a warning is sufficient for error handling in this context, or if these errors should be escalated or handled differently.

gdsfactory/cross_section.py Outdated Show resolved Hide resolved
Copy link

codecov bot commented May 5, 2024

Codecov Report

Attention: Patch coverage is 88.88889% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 71.72%. Comparing base (b6aa7fc) to head (6c6da7f).

❗ Current head 6c6da7f differs from pull request most recent head f6bc691. Consider uploading reports for the commit f6bc691 to get more accurate results

Files Patch % Lines
gdsfactory/cross_section.py 80.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2714   +/-   ##
=======================================
  Coverage   71.72%   71.72%           
=======================================
  Files         366      366           
  Lines       23804    23814   +10     
  Branches     3878     3881    +3     
=======================================
+ Hits        17073    17081    +8     
- Misses       5604     5605    +1     
- Partials     1127     1128    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
@joamatab joamatab merged commit b426682 into main May 5, 2024
9 checks passed
@joamatab joamatab deleted the improve_get_cross_sections branch May 5, 2024 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant