I am trying to add entries to a dictionary with the following loop:
for p in pressures:
q70in.resetKeyword( "expansionRatio", p )
q70in.writeInput( prefix + tempInput )
commands.getstatusoutput( runq70 )
q70out = q70.Q70Output( prefix + outputFile )
results[p] = {}
#results[p]['Performance'] = q70out.performance
results[p]['Conditions'] = q70out.conditions
print q70out
print results
print ''
however, earlier entries of the dictionary are being 'overwritten' with new values as follows:
(here's the output from the code print statements)
<q70.Q70Output instance at 0x400cbccc>
{'2.0': {'Conditions': {'Vane2INLET': {'WG': '3.200'}, 'Blade1INLET': {'WG': '3.191'}, 'Blade2INLET': {'WG': '3.200'}, 'Vane1INLET': {'WG': '3.191'}}}}
<q70.Q70Output instance at 0x400cbccc>
{'2.0': {'Conditions': {'Vane2INLET': {'WG': '3.320'}, 'Blade1INLET': {'WG': '3.311'}, 'Blade2INLET': {'WG': '3.320'}, 'Vane1INLET': {'WG': '3.311'}}}, '3.0': {'Conditions': {'Vane2INLET': {'WG': '3.320'}, 'Blade1INLET': {'WG': '3.311'}, 'Blade2INLET': {'WG': '3.320'}, 'Vane1INLET': {'WG': '3.311'}}}}
<q70.Q70Output instance at 0x400cbccc>
{'2.0': {'Conditions': {'Vane2INLET': {'WG': '3.326'}, 'Blade1INLET': {'WG': '3.316'}, 'Blade2INLET': {'WG': '3.326'}, 'Vane1INLET': {'WG': '3.316'}}}, '3.5': {'Conditions': {'Vane2INLET': {'WG': '3.326'}, 'Blade1INLET': {'WG': '3.316'}, 'Blade2INLET': {'WG': '3.326'}, 'Vane1INLET': {'WG': '3.316'}}}, '3.0': {'Conditions': {'Vane2INLET': {'WG': '3.326'}, 'Blade1INLET': {'WG': '3.316'}, 'Blade2INLET': {'WG': '3.326'}, 'Vane1INLET': {'WG': '3.316'}}}}
So what's happening?
Note that #### in:
results{ '2.0':{'Conditions':{'Vane2INLET':{'WG': ####}}}}
SHOULD NOT CHANGE WITH ITERATION based on the loop