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

PCVL 843 Input ports should be kept when composing a processor to an empty processor #516

Conversation

AliseeNguyen
Copy link
Contributor

…cessor

@@ -115,6 +115,27 @@ def test_remote_processor_creation(requests_mock):
rp.add(0, BS())


def test_remote_processor_composition_input_ports(requests_mock):
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, the bug was with any empty processor (so an empty remote processor or a local empty processor Processor("SLOS", 4)), you don't really need the requests_mock here. However, it can still be useful to test it like this since it is the principal use case

def test_remote_processor_composition_input_ports(requests_mock):
ls = LogicalState([0, 0])
cnot = catalog['postprocessed cnot'].build_processor()
cnot.min_detected_photons_filter(2)
Copy link
Contributor

Choose a reason for hiding this comment

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

You can remove this line (you don't need it since you don't use cnot.with_input(ls))

rp_input_port = rp.get_input_port(mode)
assert cnot_input_port == rp_input_port

cnot_output_port = cnot.get_output_port(mode)
Copy link
Contributor

Choose a reason for hiding this comment

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

The ticket only asks for the input ports, so here you are testing something that you didn't change (my bad).
Since there were no tests for the output ports, you can keep it though.

@AliseeNguyen AliseeNguyen changed the title Input ports should be kept when composing a processor to an empty pro… PCVL 843 Input ports should be kept when composing a processor to an empty processor Jan 16, 2025
@@ -397,6 +397,12 @@ def _compose_processor(self, connector: ModeConnector, processor, keep_port: boo
self._postselect = self._postselect or PostSelect()
self._postselect.merge(other_postselect)

# Adding input ports from component processor
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add this piece of code before or after the _out_ports piece of code.
Also, consider breaking this method in sub methods (one for ports & post selection and one for permutation at least ?)

@AliseeNguyen AliseeNguyen merged commit 65a4fc2 into Quandela:release/0.12.1 Jan 22, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants