I have a python code that operates on measurements of devices. In one section, I have to apply a matching network to the measurement. I am handling everything related to rf measurement with Scikit Rf module and I am creating a circuit with the stuff I need, and then extract the network from the circuit with the .network attribute, and substitute it to the network attribute of my object.
This operation is pretty slow and I would like to speed it up by doing multiple matching in parallel. Note that this operation is done element by element and nothing is fed back to a main loop or anything, the only thing that gets updated is the .network attribute of my object (which is an rf.Network).
I have tried the following (suggested by chatGPT):
def process_element(element, matching_network):
return element.apply_matching(matching_network)
with multiprocessing.Pool(processes=8) as pool:
pool.starmap(process_element, [(element, matching_network) for element in list_measurements])
I know that the method apply_matching() works because I have tested it extensively, but the multiprocessing does not. When I plot measurements, I see them unmatched, so the replacement between the original response and the matched response did not take place.