Skip to content

Commit dfe1c87

Browse files
committed
Simplified spectrum gathering procedure to match Spectrum_Storage add and fixing update.
1 parent 0e22288 commit dfe1c87

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

spectro.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,11 @@ def waitAll(self):
505505
self.waitMeasurmentReady(device)
506506

507507
def getScopes(self):
508-
return [self.getScope(device) for device in self.devList]
508+
tp_dict_to_return = dict([])
509+
for device in self.devList:
510+
tp_tup = self.getScope(device)
511+
tp_dict_to_return[tp_tup[0]] = tp_tup[1]
512+
return tp_dict_to_return
509513

510514
def stopAll(self):
511515
for device in self.devList:
@@ -831,10 +835,9 @@ def putSpectra(self, folder_id, subfolder_id, spectra):
831835
First we create a new subfolder (append it in the folder)
832836
Then we create a subfolder.
833837
Then we associate channel id to the corresponding Spectrum.
834-
We base this method on AvaSpec_Handler.getScopes, which returns a list
835-
of tuple like so :
838+
We base this method on AvaSpec_Handler.getScopes, which returns a dict:
836839
837-
[(channel_id, spectrum), ...]
840+
{channel_id: spectrum, ...}
838841
"""
839842

840843
if folder_id not in self._hidden_directory:
@@ -852,12 +855,7 @@ def putSpectra(self, folder_id, subfolder_id, spectra):
852855
"subfolder_id must be an integer."
853856
)
854857

855-
tp_spectrum_dict = dict({})
856-
857-
for channel_id, spectrum in spectra:
858-
tp_spectrum_dict[channel_id] = spectrum
859-
860-
self._hidden_directory[folder_id][subfolder_id] = tp_spectrum_dict
858+
self._hidden_directory[folder_id][subfolder_id] = spectra
861859

862860
def putBlack(self, new_spectra):
863861

0 commit comments

Comments
 (0)