-
Notifications
You must be signed in to change notification settings - Fork 67
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
PCVL-780 Barrier can be invisible #451
PCVL-780 Barrier can be invisible #451
Conversation
@@ -98,6 +98,9 @@ def defined(self) -> bool: | |||
def params(self): | |||
return self._params.keys() | |||
|
|||
def param(self, param_name) -> Parameter: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type hinting for param_name
|
||
:param out_parameters: out dictionary, where key/value pairs are added. | ||
:param pname: parameter name to consider, in the component definition. | ||
e.g. fto retrieve "phi0" from PS(phi=P("phi0")), ask for pname="phi", as it's the parameter name for a PS. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo, fto -> to
|
||
def definition(self): | ||
return self.U | ||
|
||
# noinspection PyMethodMayBeStatic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C'est specific pycharm ça non ? 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
En effet, j'avais pas remarqué. Mais ce ne sont pas les premiers "noinspection" du code
@@ -128,7 +128,10 @@ def _expand_td(self, component_list: List): | |||
can_output_circuit = False | |||
|
|||
else: # case time delay | |||
t = int(c.get_variables()["t"]) | |||
t = float(c.param("t")) | |||
if abs(t - int(t)) > 1e-6: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if not t.is_integer() ?
tests/test_generic_interferometer.py
Outdated
@@ -40,6 +40,19 @@ | |||
mzi_generator_func = catalog['mzi phase last'].generate | |||
|
|||
|
|||
# noinspection PyTypeChecker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😬
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just moved this code. This "noinspection" mark was moved with it. I've just deleted it and it adds no warning. It seems it was useless.
def describe(self, _=None): | ||
return f"Barrier({self.num_modes})" | ||
@property | ||
def visible(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a setter also to allow the user to have invisible barriers ?
@visible.setter
def visible(self, value: bool):
self._visible = value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
visible
is already a parameter of Barrier.__init__
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes but when you create a barrier with the operator @ you don't have the possibility to make it invisible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't have to use @ operator. It's only a facilitator for a very very specific case
No description provided.