diff --git a/Examples/python/fitting/ex02_FitCylindersAndPrisms/FitCylindersPrisms_detailed.py b/Examples/python/fitting/ex02_FitCylindersAndPrisms/FitCylindersPrisms_detailed.py
index 2b591cb3d8f1a5935bfe86293c149822a3ca8b21..459377d64fe9d702c856f2c86f0330e38cad33f6 100644
--- a/Examples/python/fitting/ex02_FitCylindersAndPrisms/FitCylindersPrisms_detailed.py
+++ b/Examples/python/fitting/ex02_FitCylindersAndPrisms/FitCylindersPrisms_detailed.py
@@ -118,7 +118,7 @@ class DrawObserver(ba.IFitObserver):
                   nplot=1, min=1.0, max=real_data.getMaximum())
         self.plot(fit_suite.getSimulationData(), "Simulated data",
                   nplot=2, min=1.0, max=real_data.getMaximum())
-        self.plot(fit_suite.getChiSquaredMap(), "Chi2 map",
+        self.plot(fit_suite.getChiSquaredMap(), "Chi2 map.
 
                   nplot=3, min=0.001, max=10.0)
 
diff --git a/Examples/python/fitting/ex08_SimultaneousFitOfTwoDatasets/SimultaneousFitOfTwoDatasets.py b/Examples/python/fitting/ex08_SimultaneousFitOfTwoDatasets/SimultaneousFitOfTwoDatasets.py
index 37cd0a4899600163985e76c6396159dc797f0504..f8228e365fefbe4e634070c94108cb4547dddcb3 100644
--- a/Examples/python/fitting/ex08_SimultaneousFitOfTwoDatasets/SimultaneousFitOfTwoDatasets.py
+++ b/Examples/python/fitting/ex08_SimultaneousFitOfTwoDatasets/SimultaneousFitOfTwoDatasets.py
@@ -75,7 +75,7 @@ def create_real_data(incident_alpha):
 class DrawObserver(ba.IFitObserver):
     """
     Draws fit progress every nth iteration. Real data, simulated data
-    and chi2 map will be shown for both datasets.
+    and chi2 map.ill be shown for both datasets.
     """
     def __init__(self, draw_every_nth=10):
         ba.IFitObserver.__init__(self, draw_every_nth)
@@ -83,7 +83,7 @@ class DrawObserver(ba.IFitObserver):
         self.fig.canvas.draw()
         plt.ion()
 
-    def plot_colormap(self, data, title, min=1, max=1e6):
+    def plot_colormap.elf, data, title, min=1, max=1e6):
         im = plt.imshow(
             data.getArray(),
             norm=matplotlib.colors.LogNorm(min, max),
@@ -97,16 +97,16 @@ class DrawObserver(ba.IFitObserver):
         for i_dataset in range(0, fit_suite.getNumberOfFitObjects()):
             real_data = fit_suite.getRealData(i_dataset)
             simul_data = fit_suite.getSimulationData(i_dataset)
-            chi2_map = fit_suite.getChiSquaredMap(i_dataset)
+            chi2_map. fit_suite.getChiSquaredMap(i_dataset)
 
             plt.subplot(canvas[i_dataset*3])
-            self.plot_colormap(real_data, "\"Real\" data - #"+str(i_dataset+1),
+            self.plot_colormap.eal_data, "\"Real\" data - #"+str(i_dataset+1),
                                min=1.0, max=real_data.getMaximum())
             plt.subplot(canvas[1+i_dataset*3])
-            self.plot_colormap(simul_data, "Simulated data - #"+str(i_dataset+1),
+            self.plot_colormap.imul_data, "Simulated data - #"+str(i_dataset+1),
                                min=1.0, max=real_data.getMaximum())
             plt.subplot(canvas[2+i_dataset*3])
-            self.plot_colormap(chi2_map, "Chi2 map - #"+str(i_dataset+1),
+            self.plot_colormap.hi2_map, "Chi2 map - #"+str(i_dataset+1),
                                min=0.001, max=10.0)
 
     def plot_fit_parameters(self, fit_suite, canvas):
diff --git a/Examples/python/simulation/ex01_BasicParticles/AllFormFactorsAvailable.py b/Examples/python/simulation/ex01_BasicParticles/AllFormFactorsAvailable.py
index b63e65aeedb074a763ab8319387edaf49191c13c..2686f86b8865422898cd2f7067d4d456d7dece01 100644
--- a/Examples/python/simulation/ex01_BasicParticles/AllFormFactorsAvailable.py
+++ b/Examples/python/simulation/ex01_BasicParticles/AllFormFactorsAvailable.py
@@ -114,7 +114,7 @@ if __name__ == '__main__':
         for nplot in range(len(formfactors)):
             ff = formfactors[nplot]
             name = ff.__class__.__name__.replace("FormFactor","")
-            print("Generating intensity map for " + name)
+            print("Generating intensity map.or " + name)
             intensities = simulate(ff)
             plot(intensities, nplot+1, name)
         plt.show()
@@ -124,4 +124,4 @@ if __name__ == '__main__':
             intensities = simulate(ff)
             fname = "%s.%s.int" % (sys.argv[1], name)
             ba.IntensityDataIOFactory.writeIntensityData(intensities, fname)
-            print("Stored intensity map in " + fname)
+            print("Stored intensity map.n " + fname)
diff --git a/Examples/python/simulation/ex01_BasicParticles/CylindersAndPrisms.py b/Examples/python/simulation/ex01_BasicParticles/CylindersAndPrisms.py
index 2065d8195f321e964b6961779d1ede0dfe597f99..cefa41da8228200471ad68b2b1ecc9516204b776 100644
--- a/Examples/python/simulation/ex01_BasicParticles/CylindersAndPrisms.py
+++ b/Examples/python/simulation/ex01_BasicParticles/CylindersAndPrisms.py
@@ -53,7 +53,7 @@ def get_simulation():
 
 def simulate():
     """
-    Run simulation and plot results
+    Runs simulation and returns resulting intensity map.
     """
     sample = get_sample()
     simulation = get_simulation()
@@ -62,6 +62,9 @@ def simulate():
     return simulation.getIntensityData()
 
 def plot(result):
+    """
+    Plots intensity map.
+    """
     import matplotlib
     from matplotlib import pyplot as plt
     im = plt.imshow(
@@ -79,11 +82,11 @@ def plot(result):
 if __name__ == '__main__':
     if len(sys.argv)<=1:
         print('Usage:')
-        print('    '+sys.argv[0]+' -p         # to plot simulation result')
-        print('    '+sys.argv[0]+' <filename> # to save results to file')
+        print('    '+sys.argv[0]+' -p      # to plot result')
+        print('    '+sys.argv[0]+' <fname> # to save result in <fname>.int')
         sys.exit(1)
-    intensities = simulate()
+    result = simulate()
     if sys.argv[1] != '-p':
-        ba.IntensityDataIOFactory.writeIntensityData(intensities, sys.argv[1]+".int")
+        ba.IntensityDataIOFactory.writeIntensityData(result, sys.argv[1]+".int")
     else:
-        plot(intensities)
+        plot(result)
diff --git a/Examples/python/simulation/ex01_BasicParticles/CylindersInBA.py b/Examples/python/simulation/ex01_BasicParticles/CylindersInBA.py
index 98e4d73060964d42a0069530124c2a4ea6070906..5c1335deab389eabe98b4073469c5a956f72a3c1 100644
--- a/Examples/python/simulation/ex01_BasicParticles/CylindersInBA.py
+++ b/Examples/python/simulation/ex01_BasicParticles/CylindersInBA.py
@@ -2,8 +2,6 @@
 Cylinder formfactor in Born approximation
 """
 import numpy, sys
-import matplotlib
-from matplotlib import pyplot as plt
 import bornagain as ba
 from bornagain import deg, angstrom, nm
 
@@ -47,15 +45,21 @@ def get_simulation():
 
 def simulate():
     """
-    Run simulation and plot results
+    Runs simulation and returns intensity map.
     """
     sample = get_sample()
     simulation = get_simulation()
     simulation.setSample(sample)
     simulation.runSimulation()
-    result = simulation.getIntensityData()
+    return simulation.getIntensityData()
 
-    # showing the result
+
+def plot(result):
+    """
+    Plots intensity map.
+    """
+    import matplotlib
+    from matplotlib import pyplot as plt
     im = plt.imshow(
         result.getArray(),
         norm=matplotlib.colors.LogNorm(1.0, result.getMaximum()),
@@ -68,6 +72,14 @@ def simulate():
     plt.ylabel(r'$\alpha_f (^{\circ})$', fontsize=16)
     plt.show()
 
-
 if __name__ == '__main__':
-    simulate()
+    if len(sys.argv)<=1:
+        print('Usage:')
+        print('    '+sys.argv[0]+' -p      # to plot result')
+        print('    '+sys.argv[0]+' <fname> # to save result in <fname>.int')
+        sys.exit(1)
+    result = simulate()
+    if sys.argv[1] != '-p':
+        ba.IntensityDataIOFactory.writeIntensityData(result, sys.argv[1]+".int")
+    else:
+        plot(result)
diff --git a/Examples/python/simulation/ex01_BasicParticles/CylindersInDWBA.py b/Examples/python/simulation/ex01_BasicParticles/CylindersInDWBA.py
index 165fd48789e58af8b070aeeb3b791cc57472e7a8..d60c9af3d3d75068eb10baf50cfe632a36114c48 100644
--- a/Examples/python/simulation/ex01_BasicParticles/CylindersInDWBA.py
+++ b/Examples/python/simulation/ex01_BasicParticles/CylindersInDWBA.py
@@ -49,7 +49,7 @@ def get_simulation():
 
 def simulate():
     """
-    Run simulation and plot results
+    Runs simulation and returns intensity map.
     """
     sample = get_sample()
     simulation = get_simulation()
diff --git a/Examples/python/simulation/ex01_BasicParticles/CylindersWithSizeDistribution.py b/Examples/python/simulation/ex01_BasicParticles/CylindersWithSizeDistribution.py
index a77c3cc382a1f68b8014a413f54bfb0a3ecee385..d63255067708829e76b2f0c9623ca626a4cad4bc 100644
--- a/Examples/python/simulation/ex01_BasicParticles/CylindersWithSizeDistribution.py
+++ b/Examples/python/simulation/ex01_BasicParticles/CylindersWithSizeDistribution.py
@@ -62,7 +62,7 @@ def get_simulation():
 
 def simulate():
     """
-    Run simulation and plot results
+    Runs simulation and returns intensity map.
     """
     sample = get_sample()
     sample.printSampleTree()
diff --git a/Examples/python/simulation/ex01_BasicParticles/RotatedPyramids.py b/Examples/python/simulation/ex01_BasicParticles/RotatedPyramids.py
index 59fdfb3d3fe82760b8a81d073ef5b8d6af7dfeac..6c2ca1e52cc6cfcb1e9e9163813124cd552e54b9 100644
--- a/Examples/python/simulation/ex01_BasicParticles/RotatedPyramids.py
+++ b/Examples/python/simulation/ex01_BasicParticles/RotatedPyramids.py
@@ -51,7 +51,7 @@ def get_simulation():
 
 def simulate():
     """
-    Run simulation and plot results
+    Runs simulation and returns intensity map.
     """
     sample = get_sample()
     simulation = get_simulation()
diff --git a/Examples/python/simulation/ex01_BasicParticles/TwoTypesOfCylindersWithSizeDistribution.py b/Examples/python/simulation/ex01_BasicParticles/TwoTypesOfCylindersWithSizeDistribution.py
index 2382057542f2ba4f5d04ce56e55053849c44acf3..00cc0cbeba49f3fddd4d556595c8963ca7838d46 100644
--- a/Examples/python/simulation/ex01_BasicParticles/TwoTypesOfCylindersWithSizeDistribution.py
+++ b/Examples/python/simulation/ex01_BasicParticles/TwoTypesOfCylindersWithSizeDistribution.py
@@ -77,7 +77,7 @@ def get_simulation():
 
 def simulate():
     """
-    Run simulation and plot results
+    Runs simulation and returns intensity map.
     """
     sample = get_sample()
     simulation = get_simulation()
diff --git a/Examples/python/simulation/ex02_LayeredStructures/BuriedParticles.py b/Examples/python/simulation/ex02_LayeredStructures/BuriedParticles.py
index 50afe720ac2839001882f5e9f0d53833d98cc3b6..10cd4b2c87bf3542a6a99910ada253e89423823d 100644
--- a/Examples/python/simulation/ex02_LayeredStructures/BuriedParticles.py
+++ b/Examples/python/simulation/ex02_LayeredStructures/BuriedParticles.py
@@ -54,7 +54,7 @@ def get_simulation():
 
 def simulate():
     """
-    Run simulation and plot results
+    Runs simulation and returns intensity map.
     """
     sample = get_sample()
     simulation = get_simulation()
diff --git a/Examples/python/simulation/ex02_LayeredStructures/CorrelatedRoughness.py b/Examples/python/simulation/ex02_LayeredStructures/CorrelatedRoughness.py
index d1a47e6ac2381717fed8cc8b4ee6814aecaecdde..fd549e6be02f14fa080e508247b5504d4d548f41 100644
--- a/Examples/python/simulation/ex02_LayeredStructures/CorrelatedRoughness.py
+++ b/Examples/python/simulation/ex02_LayeredStructures/CorrelatedRoughness.py
@@ -61,7 +61,7 @@ def get_simulation():
 
 def simulate():
     """
-    Run simulation and plot results
+    Runs simulation and returns intensity map.
     """
     sample = get_sample()
     simulation = get_simulation()
diff --git a/Examples/python/simulation/ex03_InterferenceFunctions/ApproximationDA.py b/Examples/python/simulation/ex03_InterferenceFunctions/ApproximationDA.py
index 456f813b15c6ebc6e877bc86f3098c6d1f639c2f..8c2779fec36afac01533cce74b9c680132ad091d 100644
--- a/Examples/python/simulation/ex03_InterferenceFunctions/ApproximationDA.py
+++ b/Examples/python/simulation/ex03_InterferenceFunctions/ApproximationDA.py
@@ -66,7 +66,7 @@ def get_simulation():
 
 def simulate():
     """
-    Run simulation and plot results
+    Runs simulation and returns intensity map.
     """
     sample = get_sample()
     simulation = get_simulation()
diff --git a/Examples/python/simulation/ex03_InterferenceFunctions/ApproximationLMA.py b/Examples/python/simulation/ex03_InterferenceFunctions/ApproximationLMA.py
index eaa56a56a0904704fb58db56e3a8c6981ecd5e57..784826769044d3c69ff07870cfdd72ce656e37c0 100644
--- a/Examples/python/simulation/ex03_InterferenceFunctions/ApproximationLMA.py
+++ b/Examples/python/simulation/ex03_InterferenceFunctions/ApproximationLMA.py
@@ -75,7 +75,7 @@ def get_simulation():
 
 def simulate():
     """
-    Run simulation and plot results
+    Runs simulation and returns intensity map.
     """
     sample = get_sample()
     simulation = get_simulation()
diff --git a/Examples/python/simulation/ex03_InterferenceFunctions/ApproximationSSCA.py b/Examples/python/simulation/ex03_InterferenceFunctions/ApproximationSSCA.py
index 66d4743770b214067858a5dbc00d76d628917cbe..aa688431c4febf2ca3c818141cfddc58de6048f8 100644
--- a/Examples/python/simulation/ex03_InterferenceFunctions/ApproximationSSCA.py
+++ b/Examples/python/simulation/ex03_InterferenceFunctions/ApproximationSSCA.py
@@ -68,7 +68,7 @@ def get_simulation():
 
 def simulate():
     """
-    Run simulation and plot results
+    Runs simulation and returns intensity map.
     """
     sample = get_sample()
     simulation = get_simulation()
diff --git a/Examples/python/simulation/ex03_InterferenceFunctions/CosineRipplesAtRectLattice.py b/Examples/python/simulation/ex03_InterferenceFunctions/CosineRipplesAtRectLattice.py
index 039b7373f0989e2637bbae57a3c5ee901fe591f6..cd2ed9e273a98427b5abce35e08e54177c8e3aaf 100644
--- a/Examples/python/simulation/ex03_InterferenceFunctions/CosineRipplesAtRectLattice.py
+++ b/Examples/python/simulation/ex03_InterferenceFunctions/CosineRipplesAtRectLattice.py
@@ -59,7 +59,7 @@ def get_simulation():
 
 def simulate():
     """
-    Run simulation and plot results
+    Runs simulation and returns intensity map.
     """
     sample = get_sample()
     simulation = get_simulation()
diff --git a/Examples/python/simulation/ex03_InterferenceFunctions/Interference1DLattice.py b/Examples/python/simulation/ex03_InterferenceFunctions/Interference1DLattice.py
index d5d7425b56761b77607193e91b41c41bfc0d0114..55f72df30ac41e221259148745f60225e50db9e6 100644
--- a/Examples/python/simulation/ex03_InterferenceFunctions/Interference1DLattice.py
+++ b/Examples/python/simulation/ex03_InterferenceFunctions/Interference1DLattice.py
@@ -60,7 +60,7 @@ def get_simulation():
 
 def simulate():
     """
-    Run simulation and plot results
+    Runs simulation and returns intensity map.
     """
     sample = get_sample()
     simulation = get_simulation()
diff --git a/Examples/python/simulation/ex03_InterferenceFunctions/Interference1DRadialParaCrystal.py b/Examples/python/simulation/ex03_InterferenceFunctions/Interference1DRadialParaCrystal.py
index b11af9f74e2d88f7750d2d0d46f5f001598b07f9..332e18c67829001629017b11db2b6317469b63cb 100644
--- a/Examples/python/simulation/ex03_InterferenceFunctions/Interference1DRadialParaCrystal.py
+++ b/Examples/python/simulation/ex03_InterferenceFunctions/Interference1DRadialParaCrystal.py
@@ -57,7 +57,7 @@ def get_simulation():
 
 def simulate():
     """
-    Run simulation and plot results
+    Runs simulation and returns intensity map.
     """
     sample = get_sample()
     simulation = get_simulation()
diff --git a/Examples/python/simulation/ex03_InterferenceFunctions/Interference2DCenteredSquareLattice.py b/Examples/python/simulation/ex03_InterferenceFunctions/Interference2DCenteredSquareLattice.py
index 52581e672dd64df88187938e3a9f06fc2effa9ef..6dfcd3050f17a2589a1664bcdd7733137337acfb 100644
--- a/Examples/python/simulation/ex03_InterferenceFunctions/Interference2DCenteredSquareLattice.py
+++ b/Examples/python/simulation/ex03_InterferenceFunctions/Interference2DCenteredSquareLattice.py
@@ -62,7 +62,7 @@ def get_simulation():
 
 def simulate():
     """
-    Run simulation and plot results
+    Runs simulation and returns intensity map.
     """
     sample = get_sample()
     simulation = get_simulation()
diff --git a/Examples/python/simulation/ex03_InterferenceFunctions/Interference2DParaCrystal.py b/Examples/python/simulation/ex03_InterferenceFunctions/Interference2DParaCrystal.py
index 71af65dc6e9b8337c32abcf936de682247308279..ed17848a0975de317e422680316a9bcf0172cc37 100644
--- a/Examples/python/simulation/ex03_InterferenceFunctions/Interference2DParaCrystal.py
+++ b/Examples/python/simulation/ex03_InterferenceFunctions/Interference2DParaCrystal.py
@@ -58,7 +58,7 @@ def get_simulation():
 
 def simulate():
     """
-    Run simulation and plot results
+    Runs simulation and returns intensity map.
     """
     sample = get_sample()
     simulation = get_simulation()
diff --git a/Examples/python/simulation/ex03_InterferenceFunctions/Interference2DRotatedSquareLattice.py b/Examples/python/simulation/ex03_InterferenceFunctions/Interference2DRotatedSquareLattice.py
index cd99e3e850cf43e6a68c5b22e0a762b48f95d5ec..6268332b237ee4ef8cdf59855d409ca0d86716b4 100644
--- a/Examples/python/simulation/ex03_InterferenceFunctions/Interference2DRotatedSquareLattice.py
+++ b/Examples/python/simulation/ex03_InterferenceFunctions/Interference2DRotatedSquareLattice.py
@@ -59,7 +59,7 @@ def get_simulation():
 
 def simulate():
     """
-    Run simulation and plot results
+    Runs simulation and returns intensity map.
     """
     sample = get_sample()
     simulation = get_simulation()
diff --git a/Examples/python/simulation/ex03_InterferenceFunctions/Interference2DSquareLattice.py b/Examples/python/simulation/ex03_InterferenceFunctions/Interference2DSquareLattice.py
index f7072b1fa5594ba5f70420fef53e61c07d9e38d8..5910e22f015a02126c1bfc55cc090fb888661369 100644
--- a/Examples/python/simulation/ex03_InterferenceFunctions/Interference2DSquareLattice.py
+++ b/Examples/python/simulation/ex03_InterferenceFunctions/Interference2DSquareLattice.py
@@ -56,7 +56,7 @@ def get_simulation():
 
 def simulate():
     """
-    Run simulation and plot results
+    Runs simulation and returns intensity map.
     """
     sample = get_sample()
     simulation = get_simulation()
diff --git a/Examples/python/simulation/ex03_InterferenceFunctions/RectangularGrating.py b/Examples/python/simulation/ex03_InterferenceFunctions/RectangularGrating.py
index 1f730bd6ddee2901033f4664573a5a5638fc4401..a0486576c2e84d18004013084e6862825d83a25d 100644
--- a/Examples/python/simulation/ex03_InterferenceFunctions/RectangularGrating.py
+++ b/Examples/python/simulation/ex03_InterferenceFunctions/RectangularGrating.py
@@ -66,7 +66,7 @@ def get_simulation(monte_carlo_integration=True):
 
 def simulate():
     """
-    Run simulation and plot results
+    Runs simulation and returns intensity map.
     """
     sample = get_sample(lattice_rotation_angle=45.0*deg)
     simulation = get_simulation(monte_carlo_integration=True)
diff --git a/Examples/python/simulation/ex03_InterferenceFunctions/SpheresAtHexLattice.py b/Examples/python/simulation/ex03_InterferenceFunctions/SpheresAtHexLattice.py
index 4d6945098622864bbe019b87390b79bacdab46d9..93f99af6e34fbe496c49c61d2086fb7affad0e2f 100644
--- a/Examples/python/simulation/ex03_InterferenceFunctions/SpheresAtHexLattice.py
+++ b/Examples/python/simulation/ex03_InterferenceFunctions/SpheresAtHexLattice.py
@@ -53,7 +53,7 @@ def get_simulation():
 
 def simulate():
     """
-    Run simulation and plot results
+    Runs simulation and returns intensity map.
     """
     sample = get_sample()
     simulation = get_simulation()
diff --git a/Examples/python/simulation/ex03_InterferenceFunctions/TriangularRipple.py b/Examples/python/simulation/ex03_InterferenceFunctions/TriangularRipple.py
index 6d6d389322b9b429631428d57a68e925dd6eeb0b..6dfdb24970264391faf89506efe2f3cabaffee0b 100644
--- a/Examples/python/simulation/ex03_InterferenceFunctions/TriangularRipple.py
+++ b/Examples/python/simulation/ex03_InterferenceFunctions/TriangularRipple.py
@@ -60,7 +60,7 @@ def get_simulation():
 
 def simulate():
     """
-    Run simulation and plot results
+    Runs simulation and returns intensity map.
     """
     sample = get_sample()
     simulation = get_simulation()
diff --git a/Examples/python/simulation/ex04_ComplexShapes/CoreShellNanoparticles.py b/Examples/python/simulation/ex04_ComplexShapes/CoreShellNanoparticles.py
index 5f70e32f9fae7f8cca78db5a3f0dc7e9125c1710..b2bcc020f3bc36e5ad480f6ec5db73c4ba38754b 100644
--- a/Examples/python/simulation/ex04_ComplexShapes/CoreShellNanoparticles.py
+++ b/Examples/python/simulation/ex04_ComplexShapes/CoreShellNanoparticles.py
@@ -55,7 +55,7 @@ def get_simulation():
 
 def simulate():
     """
-    Run simulation and plot results
+    Runs simulation and returns intensity map.
     """
     sample = get_sample()
     simulation = get_simulation()
diff --git a/Examples/python/simulation/ex04_ComplexShapes/CustomFormFactor.py b/Examples/python/simulation/ex04_ComplexShapes/CustomFormFactor.py
index 0764d866df7452906b4589556c3a1e28b2026144..002c945f12491f5d15ddcd4c6e2fa74b875b30f6 100644
--- a/Examples/python/simulation/ex04_ComplexShapes/CustomFormFactor.py
+++ b/Examples/python/simulation/ex04_ComplexShapes/CustomFormFactor.py
@@ -92,7 +92,7 @@ def get_simulation():
 
 def simulate():
     """
-    Run simulation and plot results
+    Runs simulation and returns intensity map.
     """
     sample = get_sample()
     simulation = get_simulation()
diff --git a/Examples/python/simulation/ex04_ComplexShapes/HexagonalLatticesWithBasis.py b/Examples/python/simulation/ex04_ComplexShapes/HexagonalLatticesWithBasis.py
index 84b8c90ab45e28059dee6f63efc4cdeb979ac29b..e7fc0ef1cbf9fad3170554d4e00939142f3a995e 100644
--- a/Examples/python/simulation/ex04_ComplexShapes/HexagonalLatticesWithBasis.py
+++ b/Examples/python/simulation/ex04_ComplexShapes/HexagonalLatticesWithBasis.py
@@ -59,7 +59,7 @@ def get_simulation():
 
 def simulate():
     """
-    Run simulation and plot results
+    Runs simulation and returns intensity map.
     """
     sample = get_sample()
     simulation = get_simulation()
diff --git a/Examples/python/simulation/ex05_BeamAndDetector/BeamDivergence.py b/Examples/python/simulation/ex05_BeamAndDetector/BeamDivergence.py
index 7cc57090f9a3008eeefeb240f35faac85ed66e22..84ba9f54ce902cdd7cbfe659d3b7853b52f1bba7 100644
--- a/Examples/python/simulation/ex05_BeamAndDetector/BeamDivergence.py
+++ b/Examples/python/simulation/ex05_BeamAndDetector/BeamDivergence.py
@@ -56,7 +56,7 @@ def get_simulation():
 
 def simulate():
     """
-    Run simulation and plot results
+    Runs simulation and returns intensity map.
     """
     sample = get_sample()
     simulation = get_simulation()
diff --git a/Examples/python/simulation/ex05_BeamAndDetector/DetectorResolutionFunction.py b/Examples/python/simulation/ex05_BeamAndDetector/DetectorResolutionFunction.py
index 8e4474cfa8c49852428b48b965ba71439e3ab3fe..44167c48fb40e3c249816955479c6f11aac22c03 100644
--- a/Examples/python/simulation/ex05_BeamAndDetector/DetectorResolutionFunction.py
+++ b/Examples/python/simulation/ex05_BeamAndDetector/DetectorResolutionFunction.py
@@ -52,7 +52,7 @@ def get_simulation():
 
 def simulate():
     """
-    Run simulation and plot results
+    Runs simulation and returns intensity map.
     """
     sample = get_sample()
     simulation = get_simulation()
diff --git a/Examples/python/simulation/ex05_BeamAndDetector/OffSpecularSimulation.py b/Examples/python/simulation/ex05_BeamAndDetector/OffSpecularSimulation.py
index 87a79968e7d88355f5ae81b43a67c61c64839756..a6d2c4073f4838e6a3bfbea7d3b4e9e545abcf0e 100644
--- a/Examples/python/simulation/ex05_BeamAndDetector/OffSpecularSimulation.py
+++ b/Examples/python/simulation/ex05_BeamAndDetector/OffSpecularSimulation.py
@@ -66,7 +66,7 @@ def get_simulation():
 
 def simulate():
     """
-    Run simulation and plot results
+    Runs simulation and returns intensity map.
     """
     sample = get_sample()
     simulation = get_simulation()
diff --git a/Examples/python/simulation/ex05_BeamAndDetector/SpecularSimulation.py b/Examples/python/simulation/ex05_BeamAndDetector/SpecularSimulation.py
index e4ae6988d9bc33edc4a9ee39cad208945e1198f1..577104f53b4d09c1c34f848bc12b6ec83cd56a7d 100644
--- a/Examples/python/simulation/ex05_BeamAndDetector/SpecularSimulation.py
+++ b/Examples/python/simulation/ex05_BeamAndDetector/SpecularSimulation.py
@@ -57,7 +57,7 @@ def get_simulation():
 
 def simulate():
     """
-    Run simulation and plot results
+    Runs simulation and returns intensity map.
     """
     sample = get_sample()
     simulation = get_simulation()
diff --git a/Examples/python/simulation/ex06_Miscellaneous/AccessingSimulationResults.py b/Examples/python/simulation/ex06_Miscellaneous/AccessingSimulationResults.py
index 4250d14795d6c8c44c3514a0f82b7fc0a487bcb9..6f3aabc8e0c62f60737ef4515ba0d62eabcf75c1 100644
--- a/Examples/python/simulation/ex06_Miscellaneous/AccessingSimulationResults.py
+++ b/Examples/python/simulation/ex06_Miscellaneous/AccessingSimulationResults.py
@@ -50,7 +50,7 @@ def get_simulation():
     return simulation
 
 
-def plot_as_colormap(hist, zmin=None, zmax=None):
+def plot_as_colormap.ist, zmin=None, zmax=None):
     """
     Simple plot of intensity data as color map
     """
@@ -71,12 +71,12 @@ def plot_as_colormap(hist, zmin=None, zmax=None):
     plt.ylabel(r'$\alpha_f ^{\circ}$', fontsize=16)
 
 
-def plot_cropped_map(hist):
+def plot_cropped_map.ist):
     """
     Plot cropped version of intensity data
     """
     crop = hist.crop(-1.0*deg, 0.5*deg, 1.0*deg, 1.0*deg)
-    plot_as_colormap(crop)
+    plot_as_colormap.rop)
 
 
 def get_noisy_image(hist):
@@ -100,7 +100,7 @@ def plot_relative_difference(hist):
     """
     noisy = get_noisy_image(hist)
     diff = noisy.relativeDifferenceHistogram(hist)
-    plot_as_colormap(diff, zmin=1e-03, zmax=10)
+    plot_as_colormap.iff, zmin=1e-03, zmax=10)
 
 
 def plot_slices(hist):
@@ -157,11 +157,11 @@ def plot_results(result):
     fig = plt.figure(figsize=(12.80, 10.24))
 
     plt.subplot(2, 2, 1)
-    plot_as_colormap(result)
-    plt.title("Intensity as colormap")
+    plot_as_colormap.esult)
+    plt.title("Intensity as colormap.
 
     plt.subplot(2, 2, 2)
-    plot_cropped_map(result)
+    plot_cropped_map.esult)
     plt.title("Cropping")
 
     plt.subplot(2, 2, 3)
@@ -180,7 +180,7 @@ def plot_results(result):
 
 def simulate():
     """
-    Run simulation and plot results
+    Runs simulation and returns intensity map.
     """
     sample = get_sample()
     simulation = get_simulation()
diff --git a/Examples/python/simulation/ex06_Miscellaneous/AxesInDifferentUnits.py b/Examples/python/simulation/ex06_Miscellaneous/AxesInDifferentUnits.py
index 792fb83210508084d380cf5932907141ad4f4ac4..b9d6ab9036d0d5abca3bc59c5d47fa0985b23f0f 100644
--- a/Examples/python/simulation/ex06_Miscellaneous/AxesInDifferentUnits.py
+++ b/Examples/python/simulation/ex06_Miscellaneous/AxesInDifferentUnits.py
@@ -59,7 +59,7 @@ def get_simulation():
     return simulation
 
 
-def plot_as_colormap(hist, Title, xLabel, yLabel):
+def plot_as_colormap.ist, Title, xLabel, yLabel):
     """
     Simple plot of intensity data as color map
     """
@@ -90,22 +90,22 @@ def simulate():
     plt.subplot(2, 2, 1)
     # default units for rectangular detector are millimeters
     result = simulation.getIntensityData()
-    plot_as_colormap(result, "In default units",
+    plot_as_colormap.esult, "In default units",
                      r'$X_{mm}$', r'$Y_{mm}$')
 
     plt.subplot(2, 2, 2)
     result = simulation.getIntensityData(ba.IDetector2D.NBINS)
-    plot_as_colormap(result, "In number of bins",
+    plot_as_colormap.esult, "In number of bins",
                      r'$X_{nbins}$', r'$Y_{nbins}$')
 
     plt.subplot(2, 2, 3)
     result = simulation.getIntensityData(ba.IDetector2D.DEGREES)
-    plot_as_colormap(result, "In degs",
+    plot_as_colormap.esult, "In degs",
                      r'$\phi_f ^{\circ}$', r'$\alpha_f ^{\circ}$')
 
     plt.subplot(2, 2, 4)
     result = simulation.getIntensityData(ba.IDetector2D.QYQZ)
-    plot_as_colormap(result, "Q-space",
+    plot_as_colormap.esult, "Q-space",
                      r'$Q_{y} [1/nm]$', r'$Q_{z} [1/nm]$')
 
     plt.subplots_adjust(left=0.07, right=0.97, top=0.9, bottom=0.1, hspace=0.25)
diff --git a/Examples/python/utils/show2d.py b/Examples/python/utils/show2d.py
index f2156e1ef41fd2f8dcce6515e625b460967f9a37..6ebc6a97986d89e5f6859479b84be7d512cb47ea 100755
--- a/Examples/python/utils/show2d.py
+++ b/Examples/python/utils/show2d.py
@@ -13,7 +13,7 @@ import os
 cdict = {'red':   ((0.0, 0.0, 0.0), (0.5, 0.0, 0.0), (1.0, 1.0, 1.0)),
          'green': ((0.0, 0.0, 0.0), (0.5, 0.0, 0.0), (1.0, 1.0, 1.0)),
          'blue':  ((0.0, 0.0, 0.0), (0.5, 1.0, 1.0), (1.0, 1.0, 1.0))}
-blue_cmap = matplotlib.colors.LinearSegmentedColormap('blue_map', cdict, 256)
+blue_cmap. matplotlib.colors.LinearSegmentedColormap('blue_map', cdict, 256)
 
 
 def PlotNumpyArray(a, zmin = 1, zmax = None):
@@ -26,8 +26,8 @@ def PlotNumpyArray(a, zmin = 1, zmax = None):
     dataarray=np.flipud(np.transpose(a))
     plt.xlabel(r'$\phi_f$', fontsize=20)
     plt.ylabel(r'$\alpha_f$', fontsize=20)
-    # Use one of the predefined colormaps or the above defined 'blue_cmap':
-    im=plt.imshow(dataarray, norm=LogNorm(), vmax=zmax, cmap=cm.jet) #, interpolation='none')
+    # Use one of the predefined colormap.or the above defined 'blue_cmap':
+    im=plt.imshow(dataarray, norm=LogNorm(), vmax=zmax, cmap.m.jet) #, interpolation='none')
     plt.gca().axes.get_xaxis().set_ticks([])
     plt.gca().axes.get_yaxis().set_ticks([])
     plt.colorbar(im)