[我想尝试的是我认为特定的,但是我想知道是否有人对如何编写一些可以完成我想要的东西的想法有所了解。
我从这种格式的字典开始:
inp = {
"val1":{
'param1': [0.0, 0.003543809774418695, 0.0],
'param2': [0.0, 0.04439156494695967, 0.0],
'param3': [0.0, 0.27337841732514817, 1.0]
},
"val2":{
'param1': [0.0, 0.27704015849313185, 1.0],
'param2': [0.0, 0.004835039503062099, 0.0],
'param3': [0.0, 0.038987106843840116, 0.0]
},
"val3":{
'param1': [0.0, 0.02446316540346886, 0.0],
'param2': [0.0, 0.0, 1.0],
'param3': [0.0, 0.011166103115052235, 0.0]
}
}
而且我想从中输出的是另一本看起来像这样的字典:
bounds = {
'param1': [[min of first coordinate, max of first coordinate], [min of second coordinate, max of second coordinate], [min of third coordinate,max of third coordinate]],
'param2': [[min of first coordinate, max of first coordinate], [min of second coordinate, max of second coordinate], [min of third coordinate,max of third coordinate]],
'param3': [[min of first coordinate, max of first coordinate], [min of second coordinate, max of second coordinate], [min of third coordinate,max of third coordinate]]
}
具体来说,我应该在param1的结尾处结束:
'param1':[[0.0,0.0],[0.003543809774418695,0.27704015849313185], [0.0,1.0]]
我正在尝试编写一个简洁漂亮的代码,但是目前我很难找到一些东西...
列表的“ val”,“ params”的数量和长度必须是灵活的...有什么主意吗?
非常感谢
欢呼
虽然不漂亮,但我认为是这样:
最终结果存储在边界字典中: