I have a function which does the following computation and then saves the data in the dictionary. The function is called several time through a loop.
el_flip = self.element_flip(element_data)
avg = np.array(el_flip[1])
flip = np.array(el_flip[0])
self.updated_element_data={}
self.updated_element_data.update({})
self.updated_element_data['avg'+self.elem_name+self.elem_path]=[avg]
self.updated_element_data['flip'+self.elem_name+self.elem_path]=[flip]
self.updated_element_data['orig'+self.elem_name+self.elem_path]=[element_data]
print('dict',self.updated_element_data)
I tried using the update function, but it does not seem to help. I want each time this function is called, new values are computed and they should be added in the dictionary, rather they are over written.
Here, values for elem_name, elem_path, [avg,flip,element_data] change for each function call.