@@ -233,6 +233,33 @@ def updateScreen(self):
233233 """Easier way to update the screen."""
234234 self .mainOpt .update ()
235235
236+ def get_selected_absorbance (self , scopes ):
237+ key_list = list (self .avh .devList .keys ())
238+ chosen = key_list .index (int (self .referenceChannel .get ()))
239+
240+ # Modification that justifies above copy
241+ ref_spectrum = scopes .pop (chosen )
242+ try :
243+ abs_spectras = \
244+ [spectro .Spectrum .absorbanceSpectrum (
245+ ref_spectrum , spec ).getInterpolated (
246+ int (self .config_dict [self .ROUT_START_LAM ].
247+ get ()),
248+ int (self .config_dict [self .ROUT_END_LAM ].
249+ get ()),
250+ int (self .config_dict [self .ROUT_NR_POINTS ].
251+ get ()),
252+ True ,
253+ int (self .config_dict [self .ROUT_INTERP_INT ].
254+ get ()))
255+ for spec in scopes ]
256+ except Exception :
257+ abs_spectras = \
258+ [spectro .Spectrum .absorbanceSpectrum (ref_spectrum , spec )
259+ for spec in scopes ]
260+
261+ return abs_spectras
262+
236263 def routine_data_sender (self ):
237264 if not self .pause_live_display .wait (0 ):
238265 self .avh .acquire ()
@@ -248,36 +275,14 @@ def routine_data_sender(self):
248275 # further modification of the list.
249276 # Send raw spectras.
250277 self .liveDisplay .putSpectrasAndUpdate (0 , scopes .copy ())
251-
278+ """
252279 if self.referenceChannel.get() != "":
253280 # Here we get the channel selected by user, process is a little
254281 # complex but first we get the list of channel names then
255282 # we get the one selected by user.
256- key_list = list (self .avh .devList .keys ())
257- chosen = key_list .index (int (self .referenceChannel .get ()))
258-
259- # Modification that justifies above copy
260- ref_spectrum = scopes .pop (chosen )
261- try :
262- to_plot_list = \
263- [spectro .Spectrum .absorbanceSpectrum (
264- ref_spectrum , spec ).getInterpolated (
265- int (self .config_dict [self .ROUT_START_LAM ].
266- get ()),
267- int (self .config_dict [self .ROUT_END_LAM ].
268- get ()),
269- int (self .config_dict [self .ROUT_NR_POINTS ].
270- get ()),
271- True ,
272- int (self .config_dict [self .ROUT_INTERP_INT ].
273- get ()))
274- for spec in scopes ]
275- except Exception :
276- to_plot_list = \
277- [spectro .Spectrum .absorbanceSpectrum (ref_spectrum , spec )
278- for spec in scopes ]
279- self .liveDisplay .putSpectrasAndUpdate (1 , to_plot_list )
280-
283+ self.liveDisplay.putSpectrasAndUpdate(
284+ 1, self.get_selected_absorbance(scopes))
285+ """
281286 self .avh .release ()
282287 try :
283288 self .after (int (self .config_dict [self .ROUT_PERIOD ].get ()),
@@ -608,6 +613,10 @@ def experiment(self):
608613 totalSpectras .append (tp_scopes )
609614 self .liveDisplay .putSpectrasAndUpdate (0 , tp_scopes )
610615
616+ if self .referenceChannel .get () != "" :
617+ self .liveDisplay .putSpectrasAndUpdate (
618+ 1 , self .get_selected_absorbance (tp_scopes ))
619+
611620 pop_up .destroy ()
612621
613622 if not self .experiment_on :
0 commit comments