Skip to content

Draft: Disconnected node quantum noise filling

finesse importer requested to merge qnoise_inputs into master

Following the discussion in !51 (merged), in this MR filling of quantum noise inputs from disconnected nodes is now (mostly) done by the components themselves, rather than the simulation. This makes more sense from a conceptual point of view, as it's pretty ugly having a special case for quantum noise in the simulation, and some components are filling quantum noise inputs anyway. Practically, however, I'm not a big fan. The result is that what was a small amount of special-cased code,

if NoiseType.QUANTUM in self.signal.noise_sources:
    # Fill in all open port quantum noise vacuum contributions
    for comp in self.model.components:
        for port in comp.ports:
            if port.type != NodeType.OPTICAL or port.is_connected:
                continue
            for i in range(self.signal.optical_frequencies.size):
                freq = self.signal.optical_frequencies.frequency_info[i]
                qn = self.model_data.UNIT_VACUUM / 2 * (1 + freq.f_car[0] / self.model_data.f0)
                for hom in range(self.model_data.num_HOMs):
                    self.signal.set_noise_source(NoiseType.QUANTUM, port.i, freq.index, hom, qn)

now requires every Connector to define its own quantum noise filling functions just to fill in the unconnected nodes. This adds quite a lot of code and function calls, and means any new optical components have to remember to fill in their own unconnected nodes as well. I've put this here as a draft merge request, in case anyone has any strong opinion on the matter. Otherwise, I'll try the other method @daniel-brown suggested in the original MR, moving this old code to fill_noise_inputs & optimising it some more.

Merge request reports