Declaring weights in simulation combiner from array changes wrong channels
-
I want to use the Python API to generate different predefined configurations of eight channels in a multiport simulation. As a simplified example, I would like to make eight different simulation combiners, with for every nth simulation, the power of the nth channel being 1W (and all other channels 0W). I would do this using the following code:
def multiport_SAR_export(powers, phases, config_nr): # Adding a new EmMultiPortSimulationCombiner inputs = [em_multi_port_simulation_extractor.Outputs["EM - Source 1 (pTx coil/Channel 1)"], em_multi_port_simulation_extractor.Outputs["EM - Source 2 (pTx coil/Channel 2)"], em_multi_port_simulation_extractor.Outputs["EM - Source 3 (pTx coil/Channel 3)"], em_multi_port_simulation_extractor.Outputs["EM - Source 4 (pTx coil/Channel 4)"], em_multi_port_simulation_extractor.Outputs["EM - Source 5 (pTx coil/Channel 5)"], em_multi_port_simulation_extractor.Outputs["EM - Source 6 (pTx coil/Channel 6)"], em_multi_port_simulation_extractor.Outputs["EM - Source 7 (pTx coil/Channel 7)"], em_multi_port_simulation_extractor.Outputs["EM - Source 8 (pTx coil/Channel 8)"]] em_multi_port_simulation_combiner = analysis.extractors.EmMultiPortSimulationCombiner(inputs=inputs) em_multi_port_simulation_combiner.UpdateAttributes() weights = em_multi_port_simulation_combiner.GetChannelWeights() for n, channel in enumerate(weights): weights[channel] = powers[n], phases[n] for channel in weights: em_multi_port_simulation_combiner.SetChannelWeight(channel, *weights[channel]) document.AllAlgorithms.Add(em_multi_port_simulation_combiner) # Adding a new EmMultiPortSensorCombiner inputs = [em_multi_port_simulation_combiner.Outputs["Overall Field"]] em_multi_port_sensor_combiner = analysis.extractors.EmMultiPortSensorCombiner(inputs=inputs) em_multi_port_sensor_combiner.Name = "Overall Field (combined)" em_multi_port_sensor_combiner.UpdateAttributes() document.AllAlgorithms.Add(em_multi_port_sensor_combiner) configs_powers = np.identity(8) for config_nr in range(8): multiport_SAR_export(configs_powers[config_nr,:], np.zeros(8), config_nr)As expected, I get eight simulation combiners, in which each one has a single channel with power 1. However, it is not always the case that the nth channel has a power of 1W for the nth simulation combiner. For example, I've had a case with the following combination of simulation numbers and powered channels:
simulation 1 = channel 1
simulation 2 = channel 7
simulation 3 = channel 3
simulation 4 = channel 8
simulation 5 = channel 2
simulation 6 = channel 6
simulation 7 = channel 4
simulation 8 = channel 5This "remapping" is consistent throughout simulations: if I would in the next simulation try to power channels 4 and 5, in the simulation combiner channels 8 and 2 would be powered. However, after a restart of the computer (and changing a few things to the code) a new remapping has appeared:
simulation 1 = channel 4
simulation 2 = channel 5
simulation 3 = channel 3
simulation 4 = channel 6
simulation 5 = channel 1
simulation 6 = channel 2
simulation 7 = channel 8
simulation 8 = channel 7Does anyone know what could cause those seemingly random changes in channel declarations? I've something is not clear, please ask me and I am happy to try explaining it better.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login