diff --git a/DSSC.py b/DSSC.py index 1caa4cc37ec10cc7abeece9c580a274d4c8fd61d..89cae9e5196c1b043bcfe30093b5144fda34eb54 100644 --- a/DSSC.py +++ b/DSSC.py @@ -330,6 +330,10 @@ class DSSC: if do_pulse_mean: self.module_data = xr.merge([self.module_data, self.scan.groupby('scan_variable').mean('trainId')]) + else: + xgm_pumped = self.xgm[:, :self.nbunches:2].mean('trainId').to_dataset(name='xgm_pumped').rename({'dim_0':'scan_variable'}) + xgm_unpumped = self.xgm[:, 1:self.nbunches:2].mean('trainId').to_dataset(name='xgm_unpumped').rename({'dim_0':'scan_variable'}) + self.module_data = xr.merge([self.module_data, xgm_pumped, xgm_unpumped]) self.module_data = self.module_data.squeeze() if do_pulse_mean: @@ -528,7 +532,7 @@ class DSSC: """ fig, [ax1, ax2] = plt.subplots(nrows=2, sharex=True, sharey=True) - xr.plot.imshow(self.azimuthal.pumped, ax=ax1, robust=True) + xr.plot.imshow(self.azimuthal.pumped, ax=ax1, vmin=0, robust=True) ax1.set_title('pumped') ax1.set_xlabel(self.scan_vname) xr.plot.imshow(self.azimuthal.pumped - self.azimuthal.unpumped, ax=ax2, robust=True) @@ -654,7 +658,7 @@ def process_one_module(job): for var in ['pumped', 'unpumped', 'sum_count']: module_data[var].loc[where] = module_data[var].loc[where] + data[var] - + for var in ['pumped', 'unpumped']: module_data[var] = module_data[var] / module_data.sum_count #module_data = module_data.drop('sum_count')