how to set the weights of field combiner in python?
Moved
Solved
Python API
-
Here is an example I used in the past (with Sim4Life v3.0), maybe it works for you?
sim = document.AllSimulations[0] results = sim.Results() sim_combiner = results.GetSimulationCombiner() sim_combiner.UpdateAttributes() weights = sim_combiner.GetChannelWeights() for n, channel in enumerate(weights): power, phase = weights[channel] weights[channel] = power, 45*n for channel in weights: print channel, weights[channel] sim_combiner.SetChannelWeight(channel, *weights[channel])
-
sorry, I gave you some code for the Simulation Combiner, not the Field Combiner...
This is how you can use the GetWeights and SetWeights functions for the field combiner:>>> field_combiner.GetWeights() ((1+0j), (1+0j)) >>> field_combiner.SetWeights( ( (2+0j), (-3+0j) ) )