diff --git a/DSSC.py b/DSSC.py
index 89cae9e5196c1b043bcfe30093b5144fda34eb54..eeea3149b5b4a04b36cf24be0082f49f40f48085 100644
--- a/DSSC.py
+++ b/DSSC.py
@@ -330,7 +330,7 @@ class DSSC:
                    
         if do_pulse_mean:
             self.module_data = xr.merge([self.module_data, self.scan.groupby('scan_variable').mean('trainId')])
-        else:
+        elif self.xgm is not None:
             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])
@@ -527,17 +527,32 @@ class DSSC:
 
         self.azimuthal = azimuthal.swap_dims({'distance': 'delta_q (1/nm)'})
                    
-    def plot_azimuthal_int(self):
+    def plot_azimuthal_int(self, kind='difference', lim=None):
         """ Plot a computed azimuthal integration.
+        
+            inputs:
+                kind: (str) either 'difference' or 'relative' to change the type of plot.
         """
         fig, [ax1, ax2] = plt.subplots(nrows=2, sharex=True, sharey=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)
-        ax2.set_title('pumped - unpumped')
+        
+        if kind == 'difference':
+            val = self.azimuthal.pumped - self.azimuthal.unpumped
+            ax2.set_title('pumped - unpumped')
+        elif kind == 'relative':
+            val = (self.azimuthal.pumped - self.azimuthal.unpumped)/self.azimuthal.unpumped
+            ax2.set_title('(pumped - unpumped)/unpumped')
+        else:
+            raise ValueError('kind should be either difference or relative')
 
+        if lim is None:
+            xr.plot.imshow(val, ax=ax2, robust=True)
+        else:
+            xr.plot.imshow(val, ax=ax2, vmin=lim[0], vmax=lim[1])
+                   
         ax2.set_xlabel(self.scan_vname)
         fig.suptitle(f'{self.plot_title}')