So I have two dictionaries that store specific "channels" and their values, these channels update every second. My end goal is to create a tool/GUI that will help us determine how off or misaligned our channels are, they correspond to optical mount DOFs.
I currently have a function that grabs the current time and determines the channels value at that time and puts it in a dictionary and another function that lets you select a time and then does the same.
The part of this project I'm a bit lost on is how to compare these dictionaries.
I want to match the keys (which are my channels) and then find the difference between their two values and store that in a 3rd dictionary with the same channels.
So here's the basic idea in code for what I'm looking to do:
diff_channels_dict = {}
### After my functions that create these dictionaries run, I'll have something like the following, but a lot longer
ref_channels_dict = {
'IM1_M1_P_OFFSET': 8,
'IM1_M1_Y_OFFSET': 8,
'IM2_M1_P_OFFSET': 8}
now_channels_dict = {
'IM1_M1_P_OFFSET': 2,
'IM1_M1_Y_OFFSET': 2,
'IM2_M1_P_OFFSET': 2}
def some_func():
for key in now_channels_dict and ref_channels_dict:
diff = now_channels_dict[value] - ref_channels_dict[value]
diff_channels_dict[key].append(diff)
return
some_func()
### So then
diff_channels_dict = {
'IM1_M1_P_OFFSET': -6,
'IM1_M1_Y_OFFSET': -6,
'IM2_M1_P_OFFSET': -6}
Can anyone give me some guidance on how to go about doing this? I looked into a few libraries, deepdiff, and Dictdiffer but I do not have access to them with the env that is used on all the machines that will use this tool.