@@ -76,12 +76,14 @@ def plot_diff_scans(self,measurandstring,dataset,dataset_avg=None):
7676 mask = DatasetUtil .unpack_flags (dataset ["quality_flag" ])["outliers" ]
7777 if dataset_avg is None :
7878 ids_used = np .where ((dataset ['series_id' ] == series_id [i ]) & np .invert (
79- DatasetUtil .unpack_flags (dataset ["quality_flag" ])["outliers" ]))
79+ DatasetUtil .unpack_flags (dataset ["quality_flag" ])["outliers" ]))[ 0 ]
8080 ydata_subset_used = dataset [measurandstring ].values [:,ids_used ]
81- avgs = np .tile (np .mean (ydata_subset_used ,axis = 1 )[...,None ],len (ydata_subset [0 ]))
81+ avgs = np .tile (np .mean (ydata_subset_used ,axis = 1 )[...,None ],len (ids_used ))
82+ mask = mask [ids_used ]
8283 else :
8384 avg_ids = np .where ((dataset_avg ['series_id' ] == series_id [i ]))[0 ]
84- avgs = np .tile (dataset_avg [measurandstring ].values [:,avg_ids ],len (ydata_subset [0 ]))
85+ avgs = np .tile (dataset_avg [measurandstring ].values [:,avg_ids ],len (avg_ids ))
86+ mask = mask [avg_ids ]
8587
8688 self .plot_variable ("relative difference" ,plotpath ,dataset ["wavelength" ].values ,
8789 (ydata_subset - avgs )/ avgs ,ylim = [- 0.2 ,0.2 ],mask = mask )
@@ -146,15 +148,16 @@ def plot_reflectance(self,plotpath,xdata,ydata,labels=None):
146148
147149 def plot_other_var (self ,measurandstring ,plotpath ,xdata ,ydata ,labels = None ,ylim = None ,mask = None ):
148150 fig1 ,ax1 = plt .subplots (figsize = (10 ,5 ))
149- if labels is None and mask is None :
151+ if labels is None and mask is None or len ( np . where ( mask )) == 0 :
150152 ax1 .plot (xdata ,ydata ,alpha = 0.3 )
151153 elif mask is None :
152154 for i in range (len (labels )):
153155 ax1 .plot (xdata ,ydata [:,i ],label = labels [i ],alpha = 0.3 )
154156 else :
155- print (mask .shape ,ydata [:,np .where (mask )].shape )
156- ax1 .plot (xdata ,ydata [:,np .where (mask )][:,0 ,0 ],label = "masked" ,alpha = 0.3 )
157- ax1 .plot (xdata ,ydata [:,np .where (np .invert (mask ))][:,0 ,0 ],label = "used" ,alpha = 0.3 )
157+ print (ydata .shape )
158+ print (ydata [:,np .where (np .invert (mask ))].shape ,ydata [:,np .where (np .invert (mask ))][:,0 ].shape )
159+ ax1 .plot (xdata ,ydata [:,np .where (mask )].reshape ((len (ydata ),len (np .where (mask )[0 ]))),label = "masked" ,alpha = 0.3 )
160+ ax1 .plot (xdata ,ydata [:,np .where (np .invert (mask ))].reshape ((len (ydata ),len (np .where (np .invert (mask ))[0 ]))),label = "used" ,alpha = 0.3 )
158161
159162 if labels is not None or mask is not None :
160163 ax1 .legend ()
0 commit comments