@@ -508,16 +508,13 @@ def run(self, save_redis=False, do_plot=False):
508508 if self ._do_get_fit_param :
509509 self ._fill_fit_param ()
510510 self ._do_get_fit_param = False
511-
512-
513-
514511
515512 # Do analysis
516513 self ._selected_data_array , self ._didv_data_dict , nb_avg = self ._analyzer .process (
517514 selected_data_array ,
518515 self ._adc_config
519516 )
520-
517+
521518 # display running avg
522519 if self ._is_qt_ui :
523520 if nb_avg > 0 :
@@ -606,8 +603,6 @@ def run(self, save_redis=False, do_plot=False):
606603
607604 self ._selected_channel_name_list .append (name )
608605
609-
610-
611606
612607 # Histogram
613608 if do_plot :
@@ -621,6 +616,8 @@ def run(self, save_redis=False, do_plot=False):
621616 fit_dt ,
622617 self ._analyzer .freq_array )
623618
619+ if self ._didv_data_dict is not None :
620+ self ._first_draw = True
624621
625622 # Fit results
626623 if self ._didv_data_dict is not None and self ._is_qt_ui :
@@ -632,8 +629,7 @@ def run(self, save_redis=False, do_plot=False):
632629 rp = None
633630 if resistance_type != 'Rp' :
634631 rp = float (self ._analyzer .get_config ('rp' ))
635-
636-
632+
637633 # loop channel
638634 nb_chan = len (self ._didv_data_dict ['results' ])
639635
@@ -651,8 +647,6 @@ def run(self, save_redis=False, do_plot=False):
651647 if 'infinite_l' in self ._didv_data_dict ['results' ][ichan ]:
652648 result_infinite_l = self ._didv_data_dict ['results' ][ichan ]['infinite_l' ]
653649
654-
655-
656650 rshunt = result ['rsh' ]
657651 result_list .append (['Input Rsh [mOhms]' , f"{ rshunt * 1000 :.2f} " ])
658652
@@ -668,9 +662,9 @@ def run(self, save_redis=False, do_plot=False):
668662 if resistance_type == 'Rn' :
669663 rn = result ['rp' ]- rp
670664 result_list .append (['Rn [mOhms]' , f"{ rn * 1000 :.2f} " ])
671-
672-
673- if 'tau0' in result :
665+
666+
667+ if ( 'tau0' in result and result [ 'tau0' ] is not None ) :
674668 result_list .append (['tau0 [us]' , f"{ result ['tau0' ]* 1e6 :.3f} " ])
675669
676670 #if 'tau3' in result:
@@ -679,13 +673,13 @@ def run(self, save_redis=False, do_plot=False):
679673 result_list .append (['L [nH]' , f"{ result ['L' ]* 1e9 :.3f} " ])
680674 result_list .append (['dt [mus]' , f"{ result ['dt' ]* 1e6 :.3f} " ])
681675
682- if 'l' in result :
676+ if ( 'l' in result and result [ 'l' ] is not None ) :
683677 result_list .append (['loop gain (l)' , f"{ result ['l' ]:.3f} " ])
684678
685- if 'beta' in result :
679+ if ( 'beta' in result and result [ 'beta' ] is not None ) :
686680 result_list .append (['beta' , f"{ result ['beta' ]:.3f} " ])
687681
688- if 'gratio' in result :
682+ if ( 'gratio' in result and result [ 'gratio' ] is not None ) :
689683 result_list .append (['gratio' , f"{ result ['gratio' ]:.3f} " ])
690684
691685
@@ -860,12 +854,10 @@ def _plot_data(self, data_array, fit_array=None, fit_dt=None, freq_array=[]):
860854 if self ._do_stop_run :
861855 return
862856
863-
864857 # chan/bins
865858 nchan = np .size (data_array ,0 )
866859 nbins = np .size (data_array ,1 )
867860
868-
869861 # sanity checks
870862 if nchan == 0 or nbins == 0 :
871863 return
@@ -883,19 +875,14 @@ def _plot_data(self, data_array, fit_array=None, fit_dt=None, freq_array=[]):
883875 if freq_array is None or len (freq_array )!= nbins :
884876 return
885877
886-
887878 if self ._nb_bins != nbins :
888879 self ._nb_bins = nbins
889880 self ._first_draw = True
890881
891-
892882 # label
893883 ylabel = self ._analyzer .get_config ('unit' )
894884 if self ._analyzer .get_config ('calc_psd' ):
895885 ylabel = ylabel + '/rtHz'
896-
897-
898-
899886
900887 # draw!
901888 if self ._first_draw :
0 commit comments