diff --git a/Examples/Python/sim01_Particles/CylindersAndPrisms.py b/Examples/Python/sim01_Particles/CylindersAndPrisms.py
index e2c13192a9c9dfa02c774de3d157353ce3431f62..795c4f2f1adfa97b9fb120f57f53beb6c2e6fd13 100644
--- a/Examples/Python/sim01_Particles/CylindersAndPrisms.py
+++ b/Examples/Python/sim01_Particles/CylindersAndPrisms.py
@@ -50,7 +50,8 @@ def get_sample():
 
 def get_simulation():
     beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0.0*deg))
-    detector = ba.SphericalDetector(100, 2.0*deg, 0.0*deg, 1.0*deg)
+    nbin = 100
+    detector = ba.SphericalDetector(nbin, 2.0*deg, 0.0*deg, 1.0*deg)
 
     simulation = ba.GISASSimulation(beam, get_sample(), detector)
     return simulation
diff --git a/Examples/Python/sim01_Particles/CylindersInBA.py b/Examples/Python/sim01_Particles/CylindersInBA.py
index 50c91c0e3a87b4414c39677c4d72b215c2b1641c..4ff161164ef0215c5dca4e1f6a52f23215042dfe 100644
--- a/Examples/Python/sim01_Particles/CylindersInBA.py
+++ b/Examples/Python/sim01_Particles/CylindersInBA.py
@@ -41,8 +41,9 @@ def get_sample():
 
 def get_simulation():
     beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0.0*deg))
-    detector = ba.SphericalDetector(200, -2.0*deg, 2.0*deg, 200, 0.0*deg,
-                                    2.0*deg)
+    nx = 200
+    ny = 200
+    detector = ba.SphericalDetector(nx, -2.0*deg, 2.0*deg, ny, 0.0*deg, 2.0*deg)
 
     simulation = ba.GISASSimulation(beam, get_sample(), detector)
     return simulation
diff --git a/Examples/Python/sim01_Particles/CylindersInDWBA.py b/Examples/Python/sim01_Particles/CylindersInDWBA.py
index 97f141dc8699fb130d762551a34435ae8f645a62..73a903eb021ed19559b9200433a9969298bdcdf7 100644
--- a/Examples/Python/sim01_Particles/CylindersInDWBA.py
+++ b/Examples/Python/sim01_Particles/CylindersInDWBA.py
@@ -43,8 +43,9 @@ def get_sample():
 
 def get_simulation():
     beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0.0*deg))
-    detector = ba.SphericalDetector(200, -2.0*deg, 2.0*deg, 200, 0.0*deg,
-                                    2.0*deg)
+    nx = 200
+    ny = 200
+    detector = ba.SphericalDetector(nx, -2.0*deg, 2.0*deg, ny, 0.0*deg, 2.0*deg)
 
     simulation = ba.GISASSimulation(beam, get_sample(), detector)
     return simulation
diff --git a/Examples/Python/sim01_Particles/CylindersWithSizeDistribution.py b/Examples/Python/sim01_Particles/CylindersWithSizeDistribution.py
index b825706563d62d98319687a8f9658f3db809088e..81e115809deace253452a6de7e9d30a74f5dcd2d 100644
--- a/Examples/Python/sim01_Particles/CylindersWithSizeDistribution.py
+++ b/Examples/Python/sim01_Particles/CylindersWithSizeDistribution.py
@@ -47,7 +47,8 @@ def get_sample():
 
 def get_simulation():
     beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0.0*deg))
-    detector = ba.SphericalDetector(200, 2.0*deg, 1.0*deg, 1.0*deg)
+    nbin = 200
+    detector = ba.SphericalDetector(nbin, 2.0*deg, 1.0*deg, 1.0*deg)
 
     simulation = ba.GISASSimulation(beam, get_sample(), detector)
     return simulation
diff --git a/Examples/Python/sim01_Particles/RotatedPyramids.py b/Examples/Python/sim01_Particles/RotatedPyramids.py
index a758f45164b54dc48c78964a70635fa52e59eb1d..7c83b39452ae51fb227d738aa9e72b028473d3ca 100644
--- a/Examples/Python/sim01_Particles/RotatedPyramids.py
+++ b/Examples/Python/sim01_Particles/RotatedPyramids.py
@@ -45,8 +45,9 @@ def get_sample():
 
 def get_simulation():
     beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0.0*deg))
-    detector = ba.SphericalDetector(200, -2.0*deg, 2.0*deg, 200, 0.0*deg,
-                                    2.0*deg)
+    nx = 200
+    ny = 200
+    detector = ba.SphericalDetector(nx, -2.0*deg, 2.0*deg, ny, 0.0*deg, 2.0*deg)
 
     simulation = ba.GISASSimulation(beam, get_sample(), detector)
     return simulation
diff --git a/Examples/Python/sim01_Particles/TwoTypesOfCylindersWithSizeDistribution.py b/Examples/Python/sim01_Particles/TwoTypesOfCylindersWithSizeDistribution.py
index 1894c7a5aa24c3e51960c88aad3910bf087bd850..6fa2b1f0786120ee50aaf6fa06923ddf39962b0e 100644
--- a/Examples/Python/sim01_Particles/TwoTypesOfCylindersWithSizeDistribution.py
+++ b/Examples/Python/sim01_Particles/TwoTypesOfCylindersWithSizeDistribution.py
@@ -56,7 +56,8 @@ def get_sample():
 
 def get_simulation():
     beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0.0*deg))
-    detector = ba.SphericalDetector(200, 2.0*deg, 1.0*deg, 1.0*deg)
+    nbin = 200
+    detector = ba.SphericalDetector(nbin, 2.0*deg, 1.0*deg, 1.0*deg)
 
     simulation = ba.GISASSimulation(beam, get_sample(), detector)
     return simulation
diff --git a/Examples/Python/sim02_Complexes/BiMaterialCylinders.py b/Examples/Python/sim02_Complexes/BiMaterialCylinders.py
index 3f7fbc62f61971b483d33ee8a0f5a13755ab2e58..6b4f501baa909f97000aba19f199337fa625f3bd 100644
--- a/Examples/Python/sim02_Complexes/BiMaterialCylinders.py
+++ b/Examples/Python/sim02_Complexes/BiMaterialCylinders.py
@@ -59,7 +59,8 @@ def get_sample():
 
 def get_simulation():
     beam = ba.Beam(100000000.0, 0.1*nm, ba.Direction(0.2*deg, 0.0*deg))
-    detector = ba.SphericalDetector(100, 2.0*deg, 0.0*deg, 1.0*deg)
+    nbin = 100
+    detector = ba.SphericalDetector(nbin, 2.0*deg, 0.0*deg, 1.0*deg)
 
     simulation = ba.GISASSimulation(beam, get_sample(), detector)
     return simulation
diff --git a/Examples/Python/sim02_Complexes/CoreShellNanoparticles.py b/Examples/Python/sim02_Complexes/CoreShellNanoparticles.py
index bae3d599ae328ae10cf3303d4387af9ac1ccf8e5..c6452b607b2fee7671d9b6c15dae326918b202fd 100644
--- a/Examples/Python/sim02_Complexes/CoreShellNanoparticles.py
+++ b/Examples/Python/sim02_Complexes/CoreShellNanoparticles.py
@@ -50,7 +50,8 @@ def get_sample():
 
 def get_simulation():
     beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0.0*deg))
-    detector = ba.SphericalDetector(200, 2.0*deg, 0.0*deg, 1.0*deg)
+    nbin = 200
+    detector = ba.SphericalDetector(nbin, 2.0*deg, 0.0*deg, 1.0*deg)
 
     simulation = ba.GISASSimulation(beam, get_sample(), detector)
     return simulation
diff --git a/Examples/Python/sim02_Complexes/HexagonalLatticesWithBasis.py b/Examples/Python/sim02_Complexes/HexagonalLatticesWithBasis.py
index 25aeb82c29fb2d67705aa9c0878179ccde8d4711..4fc0c6d8f666cb69e5254176103c77e7ae08e283 100644
--- a/Examples/Python/sim02_Complexes/HexagonalLatticesWithBasis.py
+++ b/Examples/Python/sim02_Complexes/HexagonalLatticesWithBasis.py
@@ -62,8 +62,9 @@ def get_sample():
 
 def get_simulation():
     beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0.0*deg))
-    detector = ba.SphericalDetector(200, -1.0*deg, 1.0*deg, 200, 0.0*deg,
-                                    1.0*deg)
+    nx = 200
+    ny = 200
+    detector = ba.SphericalDetector(nx, -1.0*deg, 1.0*deg, ny, 0.0*deg, 1.0*deg)
 
     simulation = ba.GISASSimulation(beam, get_sample(), detector)
     return simulation
diff --git a/Examples/Python/sim02_Complexes/MesoCrystal.py b/Examples/Python/sim02_Complexes/MesoCrystal.py
index de317479061d9f6afbcb586fbc51f214a381ced5..a3b78a2461fa0fca832355d4ac13c5922eb7a281 100644
--- a/Examples/Python/sim02_Complexes/MesoCrystal.py
+++ b/Examples/Python/sim02_Complexes/MesoCrystal.py
@@ -55,8 +55,9 @@ def get_sample():
 
 def get_simulation():
     beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0.0*deg))
-    detector = ba.SphericalDetector(200, -2.0*deg, 2.0*deg, 200, 0.0*deg,
-                                    2.0*deg)
+    nx = 200
+    ny = 200
+    detector = ba.SphericalDetector(nx, -2.0*deg, 2.0*deg, ny, 0.0*deg, 2.0*deg)
 
     simulation = ba.GISASSimulation(beam, get_sample(), detector)
     return simulation
diff --git a/Examples/Python/sim02_Complexes/ParticlesCrossingInterface.py b/Examples/Python/sim02_Complexes/ParticlesCrossingInterface.py
index 3f84a0ee061273dd9451eb8068278384aa99300f..493b78308c09cdfafad51b77a9dc6a5c0d254405 100644
--- a/Examples/Python/sim02_Complexes/ParticlesCrossingInterface.py
+++ b/Examples/Python/sim02_Complexes/ParticlesCrossingInterface.py
@@ -69,7 +69,8 @@ def get_sample():
 
 def get_simulation():
     beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0.0*deg))
-    detector = ba.SphericalDetector(100, 2.0*deg, 0.0*deg, 1.0*deg)
+    nbin = 100
+    detector = ba.SphericalDetector(nbin, 2.0*deg, 0.0*deg, 1.0*deg)
 
     simulation = ba.GISASSimulation(beam, get_sample(), detector)
     return simulation
diff --git a/Examples/Python/sim03_Structures/ApproximationDA.py b/Examples/Python/sim03_Structures/ApproximationDA.py
index 41feff79dc36a3fdc0a2acf61cdda8619ab84183..bdac8aa52541d7ea9192a3687d49ee01fdf613f0 100644
--- a/Examples/Python/sim03_Structures/ApproximationDA.py
+++ b/Examples/Python/sim03_Structures/ApproximationDA.py
@@ -53,7 +53,8 @@ def get_sample():
 
 def get_simulation():
     beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0.0*deg))
-    detector = ba.SphericalDetector(200, 2.0*deg, 1.0*deg, 1.0*deg)
+    nbin = 200
+    detector = ba.SphericalDetector(nbin, 2.0*deg, 1.0*deg, 1.0*deg)
 
     simulation = ba.GISASSimulation(beam, get_sample(), detector)
     return simulation
diff --git a/Examples/Python/sim03_Structures/ApproximationLMA.py b/Examples/Python/sim03_Structures/ApproximationLMA.py
index 85dab0a77e1172596b31cf735dc6e8909ccf3631..158032846f186d29d70d70a7d1b1217a312ac908 100644
--- a/Examples/Python/sim03_Structures/ApproximationLMA.py
+++ b/Examples/Python/sim03_Structures/ApproximationLMA.py
@@ -61,7 +61,8 @@ def get_sample():
 
 def get_simulation():
     beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0.0*deg))
-    detector = ba.SphericalDetector(200, 2.0*deg, 1.0*deg, 1.0*deg)
+    nbin = 200
+    detector = ba.SphericalDetector(nbin, 2.0*deg, 1.0*deg, 1.0*deg)
 
     simulation = ba.GISASSimulation(beam, get_sample(), detector)
     return simulation
diff --git a/Examples/Python/sim03_Structures/ApproximationSSCA.py b/Examples/Python/sim03_Structures/ApproximationSSCA.py
index 790ac4aea4f208919051f353f250f9b64f122574..8530cfe49f7126a8a1a4627bd4f1eb11c71085f1 100644
--- a/Examples/Python/sim03_Structures/ApproximationSSCA.py
+++ b/Examples/Python/sim03_Structures/ApproximationSSCA.py
@@ -54,7 +54,8 @@ def get_sample():
 
 def get_simulation():
     beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0.0*deg))
-    detector = ba.SphericalDetector(200, 2.0*deg, 1.0*deg, 1.0*deg)
+    nbin = 200
+    detector = ba.SphericalDetector(nbin, 2.0*deg, 1.0*deg, 1.0*deg)
 
     simulation = ba.GISASSimulation(beam, get_sample(), detector)
     return simulation
diff --git a/Examples/Python/sim03_Structures/CosineRipplesAtRectLattice.py b/Examples/Python/sim03_Structures/CosineRipplesAtRectLattice.py
index b14ee49a5cc64696a7ca30691d08da38d5d2397f..fc0993f33e756073b3e876780472505ffd71a4b5 100644
--- a/Examples/Python/sim03_Structures/CosineRipplesAtRectLattice.py
+++ b/Examples/Python/sim03_Structures/CosineRipplesAtRectLattice.py
@@ -53,8 +53,9 @@ def get_sample():
 
 def get_simulation():
     beam = ba.Beam(1.0, 0.16*nm, ba.Direction(0.3*deg, 0.0*deg))
-    detector = ba.SphericalDetector(100, -1.5*deg, 1.5*deg, 100, 0.0*deg,
-                                    2.5*deg)
+    nx = 100
+    ny = 100
+    detector = ba.SphericalDetector(nx, -1.5*deg, 1.5*deg, ny, 0.0*deg, 2.5*deg)
 
     simulation = ba.GISASSimulation(beam, get_sample(), detector)
     return simulation
diff --git a/Examples/Python/sim03_Structures/Interference1DRadialParaCrystal.py b/Examples/Python/sim03_Structures/Interference1DRadialParaCrystal.py
index 29281c48b85420952d7c40467be19a3f5baee079..a411314da8651bc490d2d319d1207db2f37b1854 100644
--- a/Examples/Python/sim03_Structures/Interference1DRadialParaCrystal.py
+++ b/Examples/Python/sim03_Structures/Interference1DRadialParaCrystal.py
@@ -49,8 +49,9 @@ def get_sample():
 
 def get_simulation():
     beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0.0*deg))
-    detector = ba.SphericalDetector(200, -2.0*deg, 2.0*deg, 200, 0.0*deg,
-                                    2.0*deg)
+    nx = 200
+    ny = 200
+    detector = ba.SphericalDetector(nx, -2.0*deg, 2.0*deg, ny, 0.0*deg, 2.0*deg)
 
     simulation = ba.GISASSimulation(beam, get_sample(), detector)
     return simulation
diff --git a/Examples/Python/sim03_Structures/Interference2DCenteredSquareLattice.py b/Examples/Python/sim03_Structures/Interference2DCenteredSquareLattice.py
index 696953b7f7670a1c85e35cfbdcff1a251ab3d2cb..5b5bb61fbc349340c5e105fe4cec728a9c28f5d7 100644
--- a/Examples/Python/sim03_Structures/Interference2DCenteredSquareLattice.py
+++ b/Examples/Python/sim03_Structures/Interference2DCenteredSquareLattice.py
@@ -62,8 +62,9 @@ def get_sample():
 
 def get_simulation():
     beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0.0*deg))
-    detector = ba.SphericalDetector(200, -2.0*deg, 2.0*deg, 200, 0.0*deg,
-                                    2.0*deg)
+    nx = 200
+    ny = 200
+    detector = ba.SphericalDetector(nx, -2.0*deg, 2.0*deg, ny, 0.0*deg, 2.0*deg)
 
     simulation = ba.GISASSimulation(beam, get_sample(), detector)
     return simulation
diff --git a/Examples/Python/sim03_Structures/Interference2DLatticeSumOfRotated.py b/Examples/Python/sim03_Structures/Interference2DLatticeSumOfRotated.py
index 4b7b35ae00a4f1c6b27867fdf23bd28f1d49e163..fb5b18b520bc400741edd71f58a918e734826739 100644
--- a/Examples/Python/sim03_Structures/Interference2DLatticeSumOfRotated.py
+++ b/Examples/Python/sim03_Structures/Interference2DLatticeSumOfRotated.py
@@ -38,7 +38,8 @@ def get_sample():
 
 def get_simulation():
     beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0.0*deg))
-    detector = ba.SphericalDetector(100, 2.0*deg, 1.0*deg, 1.0*deg)
+    nbin = 100
+    detector = ba.SphericalDetector(nbin, 2.0*deg, 1.0*deg, 1.0*deg)
 
     simulation = ba.GISASSimulation(beam, get_sample(), detector)
     distr_1 = ba.DistributionGate(0.0*deg, 240.0*deg)
diff --git a/Examples/Python/sim03_Structures/Interference2DParaCrystal.py b/Examples/Python/sim03_Structures/Interference2DParaCrystal.py
index c6106e79db38766efafd5dee52f485c07e4a5e47..86ad4e6daaa1b431755e70a60b449b0d75d57d0e 100644
--- a/Examples/Python/sim03_Structures/Interference2DParaCrystal.py
+++ b/Examples/Python/sim03_Structures/Interference2DParaCrystal.py
@@ -55,8 +55,9 @@ def get_sample():
 
 def get_simulation():
     beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0.0*deg))
-    detector = ba.SphericalDetector(200, -2.0*deg, 2.0*deg, 200, 0.0*deg,
-                                    2.0*deg)
+    nx = 200
+    ny = 200
+    detector = ba.SphericalDetector(nx, -2.0*deg, 2.0*deg, ny, 0.0*deg, 2.0*deg)
 
     simulation = ba.GISASSimulation(beam, get_sample(), detector)
     return simulation
diff --git a/Examples/Python/sim03_Structures/Interference2DRotatedSquareLattice.py b/Examples/Python/sim03_Structures/Interference2DRotatedSquareLattice.py
index bc6f76a91bf6e414b6b8230ecadba63dda5245bc..2b1da4c2d661ff728dfd2935238c9171ad91abe6 100644
--- a/Examples/Python/sim03_Structures/Interference2DRotatedSquareLattice.py
+++ b/Examples/Python/sim03_Structures/Interference2DRotatedSquareLattice.py
@@ -53,8 +53,9 @@ def get_sample():
 
 def get_simulation():
     beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0.0*deg))
-    detector = ba.SphericalDetector(200, -2.0*deg, 2.0*deg, 200, 0.0*deg,
-                                    2.0*deg)
+    nx = 200
+    ny = 200
+    detector = ba.SphericalDetector(nx, -2.0*deg, 2.0*deg, ny, 0.0*deg, 2.0*deg)
 
     simulation = ba.GISASSimulation(beam, get_sample(), detector)
     return simulation
diff --git a/Examples/Python/sim03_Structures/Interference2DSquareFiniteLattice.py b/Examples/Python/sim03_Structures/Interference2DSquareFiniteLattice.py
index 5fee0b8c214dade6e3e00a74ab6f60fd0d58fec9..99a9af46b441b04bd759bedac75df846fb75936d 100644
--- a/Examples/Python/sim03_Structures/Interference2DSquareFiniteLattice.py
+++ b/Examples/Python/sim03_Structures/Interference2DSquareFiniteLattice.py
@@ -51,8 +51,9 @@ def get_sample():
 
 def get_simulation():
     beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0.0*deg))
-    detector = ba.SphericalDetector(200, -2.0*deg, 2.0*deg, 200, 0.0*deg,
-                                    2.0*deg)
+    nx = 200
+    ny = 200
+    detector = ba.SphericalDetector(nx, -2.0*deg, 2.0*deg, ny, 0.0*deg, 2.0*deg)
 
     simulation = ba.GISASSimulation(beam, get_sample(), detector)
     return simulation
diff --git a/Examples/Python/sim03_Structures/Interference2DSquareLattice.py b/Examples/Python/sim03_Structures/Interference2DSquareLattice.py
index 8ff54b2eb00713be38cd6d49b2e1b550b8bfe815..e7968d38fde37fbabf5b2cb8d9e68f073be7f20d 100644
--- a/Examples/Python/sim03_Structures/Interference2DSquareLattice.py
+++ b/Examples/Python/sim03_Structures/Interference2DSquareLattice.py
@@ -52,8 +52,9 @@ def get_sample():
 
 def get_simulation():
     beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0.0*deg))
-    detector = ba.SphericalDetector(200, -2.0*deg, 2.0*deg, 200, 0.0*deg,
-                                    2.0*deg)
+    nx = 200
+    ny = 200
+    detector = ba.SphericalDetector(nx, -2.0*deg, 2.0*deg, ny, 0.0*deg, 2.0*deg)
 
     simulation = ba.GISASSimulation(beam, get_sample(), detector)
     return simulation
diff --git a/Examples/Python/sim03_Structures/RectangularGrating.py b/Examples/Python/sim03_Structures/RectangularGrating.py
index d1f6722bd3726d45785c56c9460f71842ee09d26..b720c9981dbfdd86dfd67314475bf804fccdde90 100644
--- a/Examples/Python/sim03_Structures/RectangularGrating.py
+++ b/Examples/Python/sim03_Structures/RectangularGrating.py
@@ -54,8 +54,9 @@ def get_sample(lattice_rotation_angle=0.0*deg):
 
 def get_simulation():
     beam = ba.Beam(100000000.0, 0.134*nm, ba.Direction(0.4*deg, 0.0*deg))
-    detector = ba.SphericalDetector(200, -0.5*deg, 0.5*deg, 200, 0.0*deg,
-                                    0.6*deg)
+    nx = 200
+    ny = 200
+    detector = ba.SphericalDetector(nx, -0.5*deg, 0.5*deg, ny, 0.0*deg, 0.6*deg)
 
     simulation = ba.GISASSimulation(beam, get_sample(), detector)
     simulation.getOptions().setMonteCarloIntegration(True, 100)
diff --git a/Examples/Python/sim03_Structures/SpheresAtHexLattice.py b/Examples/Python/sim03_Structures/SpheresAtHexLattice.py
index 8318bd33c930ba2ea8fa30cd976e8cf79c9c166f..cfff1d0eefef5a98e2e95b6f4629b64b43c88be1 100644
--- a/Examples/Python/sim03_Structures/SpheresAtHexLattice.py
+++ b/Examples/Python/sim03_Structures/SpheresAtHexLattice.py
@@ -53,8 +53,9 @@ def get_sample():
 
 def get_simulation():
     beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0.0*deg))
-    detector = ba.SphericalDetector(200, -1.0*deg, 1.0*deg, 200, 0.0*deg,
-                                    1.0*deg)
+    nx = 200
+    ny = 200
+    detector = ba.SphericalDetector(nx, -1.0*deg, 1.0*deg, ny, 0.0*deg, 1.0*deg)
 
     simulation = ba.GISASSimulation(beam, get_sample(), detector)
     return simulation
diff --git a/Examples/Python/sim03_Structures/TriangularRipple.py b/Examples/Python/sim03_Structures/TriangularRipple.py
index d89e7ecae0ffadf827dc37d391e557d314803fd6..4082acffcbb507268762d67d7fa7980939360a81 100644
--- a/Examples/Python/sim03_Structures/TriangularRipple.py
+++ b/Examples/Python/sim03_Structures/TriangularRipple.py
@@ -54,8 +54,9 @@ def get_sample():
 
 def get_simulation():
     beam = ba.Beam(1.0, 0.16*nm, ba.Direction(0.3*deg, 0.0*deg))
-    detector = ba.SphericalDetector(200, -1.5*deg, 1.5*deg, 200, 0.0*deg,
-                                    2.5*deg)
+    nx = 200
+    ny = 200
+    detector = ba.SphericalDetector(nx, -1.5*deg, 1.5*deg, ny, 0.0*deg, 2.5*deg)
 
     simulation = ba.GISASSimulation(beam, get_sample(), detector)
     return simulation
diff --git a/Examples/Python/sim04_Multilayers/BuriedParticles.py b/Examples/Python/sim04_Multilayers/BuriedParticles.py
index 5e847140bf257b175c9217fa2ce2e6aa37cf2a41..db574d201f13144ac46ebab2715c3575c6283af8 100644
--- a/Examples/Python/sim04_Multilayers/BuriedParticles.py
+++ b/Examples/Python/sim04_Multilayers/BuriedParticles.py
@@ -50,7 +50,8 @@ def get_sample():
 
 def get_simulation():
     beam = ba.Beam(1.0, 0.15*nm, ba.Direction(0.15*deg, 0.0*deg))
-    detector = ba.SphericalDetector(200, 2.0*deg, 0.0*deg, 1.0*deg)
+    nbin = 200
+    detector = ba.SphericalDetector(nbin, 2.0*deg, 0.0*deg, 1.0*deg)
 
     simulation = ba.GISASSimulation(beam, get_sample(), detector)
     return simulation
diff --git a/Examples/Python/sim04_Multilayers/CorrelatedRoughness.py b/Examples/Python/sim04_Multilayers/CorrelatedRoughness.py
index 4e8c4d0f1e13f02c658908981cbb2323e45463a8..f968871ae5b3ff1fc5792df6b6679ec0641bc6ad 100644
--- a/Examples/Python/sim04_Multilayers/CorrelatedRoughness.py
+++ b/Examples/Python/sim04_Multilayers/CorrelatedRoughness.py
@@ -47,7 +47,8 @@ def get_sample():
 
 def get_simulation():
     beam = ba.Beam(500000000000.0, 0.1*nm, ba.Direction(0.2*deg, 0.0*deg))
-    detector = ba.SphericalDetector(200, 1.0*deg, 0.0*deg, 0.5*deg)
+    nbin = 200
+    detector = ba.SphericalDetector(nbin, 1.0*deg, 0.0*deg, 0.5*deg)
 
     simulation = ba.GISASSimulation(beam, get_sample(), detector)
     return simulation
diff --git a/Examples/Python/sim04_Multilayers/CylindersInAverageLayer.py b/Examples/Python/sim04_Multilayers/CylindersInAverageLayer.py
index e8c31fe3efc91a4d7e35c56af67a9b8c92a20346..dcbca06bfa726862b80c00ce790004f56d8deb34 100644
--- a/Examples/Python/sim04_Multilayers/CylindersInAverageLayer.py
+++ b/Examples/Python/sim04_Multilayers/CylindersInAverageLayer.py
@@ -44,8 +44,9 @@ def get_sample(cyl_height=5*nm):
 
 def get_simulation():
     beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0.0*deg))
-    detector = ba.SphericalDetector(100, -2.0*deg, 2.0*deg, 100, 0.0*deg,
-                                    2.0*deg)
+    nx = 100
+    ny = 100
+    detector = ba.SphericalDetector(nx, -2.0*deg, 2.0*deg, ny, 0.0*deg, 2.0*deg)
 
     simulation = ba.GISASSimulation(beam, get_sample(), detector)
     simulation.getOptions().setUseAvgMaterials(True)
diff --git a/Examples/Python/sim04_Multilayers/HalfSpheresInAverageTopLayer.py b/Examples/Python/sim04_Multilayers/HalfSpheresInAverageTopLayer.py
index eb9e7a9624d4d79e3c5c675fda5bfa09dd21365b..5c5544d3d3a8ef7dd4d708d0d173f1d318f184db 100644
--- a/Examples/Python/sim04_Multilayers/HalfSpheresInAverageTopLayer.py
+++ b/Examples/Python/sim04_Multilayers/HalfSpheresInAverageTopLayer.py
@@ -54,8 +54,9 @@ def get_sample():
 
 def get_simulation():
     beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0.0*deg))
-    detector = ba.SphericalDetector(100, -2.0*deg, 2.0*deg, 100, 0.0*deg,
-                                    2.0*deg)
+    nx = 100
+    ny = 100
+    detector = ba.SphericalDetector(nx, -2.0*deg, 2.0*deg, ny, 0.0*deg, 2.0*deg)
 
     simulation = ba.GISASSimulation(beam, get_sample(), detector)
     simulation.getOptions().setUseAvgMaterials(True)
diff --git a/Examples/Python/sim05_Magnetism/MagneticSpheres.py b/Examples/Python/sim05_Magnetism/MagneticSpheres.py
index 8702457988a58bead58d7664846c10e9e29a810d..6d1e01bbaca188f25b3c16db0e28a4293dacc4c5 100644
--- a/Examples/Python/sim05_Magnetism/MagneticSpheres.py
+++ b/Examples/Python/sim05_Magnetism/MagneticSpheres.py
@@ -49,7 +49,8 @@ def get_simulation():
     beam = ba.Beam(1e+12, 0.1*nm, ba.Direction(0.5*deg, 0.0*deg))
     beam_polarization = kvector_t(0.0, 0.0, 1.0)
     beam.setPolarization(beam_polarization)
-    detector = ba.SphericalDetector(200, 6.0*deg, 0.0*deg, 3.0*deg)
+    nbin = 200
+    detector = ba.SphericalDetector(nbin, 6.0*deg, 0.0*deg, 3.0*deg)
 
     simulation = ba.GISASSimulation(beam, get_sample(), detector)
     analyzer_direction = kvector_t(0.0, 0.0, -1.0)
diff --git a/Examples/Python/sim11_Device/BeamDivergence.py b/Examples/Python/sim11_Device/BeamDivergence.py
index 619354ded4bb0b51fa733d7825a82b39dd0f0ed4..088a9ab3e45c52bca19022ca76c3090183c25240 100644
--- a/Examples/Python/sim11_Device/BeamDivergence.py
+++ b/Examples/Python/sim11_Device/BeamDivergence.py
@@ -43,7 +43,8 @@ def get_sample():
 
 def get_simulation():
     beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0.0*deg))
-    detector = ba.SphericalDetector(100, 2.0*deg, 1.0*deg, 1.0*deg)
+    nbin = 100
+    detector = ba.SphericalDetector(nbin, 2.0*deg, 1.0*deg, 1.0*deg)
 
     simulation = ba.GISASSimulation(beam, get_sample(), detector)
     distr_1 = ba.DistributionLogNormal(0.1*nm, 0.1)
diff --git a/Examples/Python/sim11_Device/ConstantBackground.py b/Examples/Python/sim11_Device/ConstantBackground.py
index 3b327dc23c01144dabdc5c70133ccd299d91fbcf..0ca4ccd72eb3085323578b0bbfc5179ebc12d43e 100644
--- a/Examples/Python/sim11_Device/ConstantBackground.py
+++ b/Examples/Python/sim11_Device/ConstantBackground.py
@@ -43,7 +43,8 @@ def get_sample():
 
 def get_simulation():
     beam = ba.Beam(1000000.0, 0.1*nm, ba.Direction(0.2*deg, 0.0*deg))
-    detector = ba.SphericalDetector(100, 2.0*deg, 1.0*deg, 1.0*deg)
+    nbin = 100
+    detector = ba.SphericalDetector(nbin, 2.0*deg, 1.0*deg, 1.0*deg)
 
     simulation = ba.GISASSimulation(beam, get_sample(), detector)
     background = ba.ConstantBackground(1.0e+03)
diff --git a/Examples/Python/sim11_Device/DetectorResolutionFunction.py b/Examples/Python/sim11_Device/DetectorResolutionFunction.py
index 6db37134890b974c611230cffa4c8c5b239f9f2b..739ca5512b4303f4798ba39309705904001023b0 100644
--- a/Examples/Python/sim11_Device/DetectorResolutionFunction.py
+++ b/Examples/Python/sim11_Device/DetectorResolutionFunction.py
@@ -43,7 +43,8 @@ def get_sample():
 
 def get_simulation():
     beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0.0*deg))
-    detector = ba.SphericalDetector(100, 2.0*deg, 1.0*deg, 1.0*deg)
+    nbin = 100
+    detector = ba.SphericalDetector(nbin, 2.0*deg, 1.0*deg, 1.0*deg)
 
     simulation = ba.GISASSimulation(beam, get_sample(), detector)
     simulation.setDetectorResolutionFunction(
diff --git a/Examples/Python/sim22_OffSpecular/BoxesWithSpecularPeak.py b/Examples/Python/sim22_OffSpecular/BoxesWithSpecularPeak.py
index ca4bda70e1cec9492d6ad1dc5956fc64665f76ea..6845d03748d0ce08a107df721957e1438bfca0ff 100644
--- a/Examples/Python/sim22_OffSpecular/BoxesWithSpecularPeak.py
+++ b/Examples/Python/sim22_OffSpecular/BoxesWithSpecularPeak.py
@@ -52,8 +52,9 @@ def get_sample():
 
 def get_simulation():
     beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0.0*deg))
-    detector = ba.SphericalDetector(101, -2.0*deg, 2.0*deg, 101, 0.0*deg,
-                                    2.0*deg)
+    nx = 101
+    ny = 101
+    detector = ba.SphericalDetector(nx, -2.0*deg, 2.0*deg, ny, 0.0*deg, 2.0*deg)
 
     simulation = ba.GISASSimulation(beam, get_sample(), detector)
     simulation.getOptions().setUseAvgMaterials(True)
diff --git a/Tests/Functional/Python/PyExamples/CMakeLists.txt b/Tests/Functional/Python/PyExamples/CMakeLists.txt
index e0e230020183ce8075e1c9d2d53e1b774c148036..7361798b9260597276ec72a32fc0bb6a51da6d5d 100644
--- a/Tests/Functional/Python/PyExamples/CMakeLists.txt
+++ b/Tests/Functional/Python/PyExamples/CMakeLists.txt
@@ -18,7 +18,7 @@ endif()
 file(GLOB fit_examples ${PY_EXAMPLES_DIR}/fit55_Specular/FitSpecularBasics.py)
 set(examples ${sim_examples} ${fit_examples})
 
-set(test_script ${CMAKE_CURRENT_SOURCE_DIR}/check_functionality.py)
+set(test_script ${TOOL_DIR}/code-tools/batch-plot.py)
 
 foreach(example_path ${examples})
     get_filename_component(example_name ${example_path} NAME_WE)
diff --git a/Wrap/Python/plot_utils.py b/Wrap/Python/plot_utils.py
index b1d0eb674727d0447293500f1e0c98cb8252ce5e..662eb5506243f4322f317b0ed3bd2461fb188f6a 100644
--- a/Wrap/Python/plot_utils.py
+++ b/Wrap/Python/plot_utils.py
@@ -262,5 +262,5 @@ def plot_simulation_result(result,
                       title=title,
                       **kwargs)
     plt.tight_layout()
-    if not postpone_show:
+    if not (postpone_show):
         plt.show()
diff --git a/cmake/BornAgain/Directories.cmake b/cmake/BornAgain/Directories.cmake
index bc51aee1ac7b5e6402f5d24a561f18837b737bec..03eb4f793603304ead0e2e6b71d7e27107af2b26 100644
--- a/cmake/BornAgain/Directories.cmake
+++ b/cmake/BornAgain/Directories.cmake
@@ -2,6 +2,7 @@
 # source directories
 # -----------------------------------------------------------------------------
 
+set(TOOL_DIR ${CMAKE_SOURCE_DIR}/devtools)
 set(WRAP_DIR ${CMAKE_SOURCE_DIR}/Wrap)
 set(SWIG_DIR ${WRAP_DIR}/Swig)
 set(PY_EXAMPLES_DIR ${CMAKE_SOURCE_DIR}/Examples/Python)
diff --git a/cmake/BornAgain/LineLength.cmake b/cmake/BornAgain/LineLength.cmake
index 311637cedbd93d009f65c27dcf393e8ff2228970..c5025e90e94ab60ca713668e509dce0b285c89e2 100644
--- a/cmake/BornAgain/LineLength.cmake
+++ b/cmake/BornAgain/LineLength.cmake
@@ -4,7 +4,7 @@ set(WEB_LEN_LIM 85) # maximum line length of code for display in web docs
 if(NOT MSVC)
 
     set(LINECOUNT
-        ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/devtools/line-count/check-line-length.py)
+        ${Python3_EXECUTABLE} ${TOOL_DIR}/line-count/check-line-length.py)
 
     foreach(dir ${AllComponents})
         file(GLOB_RECURSE src1 ${dir}/*.cpp)
diff --git a/Tests/Functional/Python/PyExamples/check_functionality.py b/devtools/code-tools/batch-plot.py
old mode 100644
new mode 100755
similarity index 65%
rename from Tests/Functional/Python/PyExamples/check_functionality.py
rename to devtools/code-tools/batch-plot.py
index cdc65fc16a2adf9cc70d5be4f84e2f23c40ad145..352810e4370cad8c9a078314349553c1d18bd010
--- a/Tests/Functional/Python/PyExamples/check_functionality.py
+++ b/devtools/code-tools/batch-plot.py
@@ -1,8 +1,10 @@
+#!/usr/bin/env python3
 """
-Checks functionality of BornAgain Python example by running it in 'embedded' way.
+Run plotting code in batch mode: generate figure, but don't plot to terminal.
 
-The check passes successfully if the example runs without exceptions thrown and
-generates non-zero-size intensity image.
+This script is used in BornAgain:
+- with option -s in PyExamples tests, to check functionality of Python examples;
+- with option -l to remake full-size images.
 """
 
 import matplotlib, os, re, sys
@@ -24,17 +26,36 @@ def exec_full(script, filename):
     sys.argv = []
     exec(compile(script, filename, 'exec'), global_namespace)
 
+def reduce_nbin(t):
+    """
+    Overwrites script lines that set nbin, nx, ny
+    """
+    pat = re.compile(r'(^\s+(nbin|nx|ny) = )(\d+)$')
+    ret = []
+    for l in t.split('\n'):
+        m = re.match(pat, l)
+        if m:
+            oldsize = int(m.group(3))
+            newsize = max(7, oldsize//20)
+            lout = re.sub(pat, m.group(1)+f'{newsize}', l)
+        else:
+            lout = l
+        ret.append(lout)
+    return '\n'.join(ret)
+
 
 def run_example(filename, output_dir):
     """
     Tries to run python example and produce a *.png image
     """
+    # Read script from file.
     if not os.path.exists(filename):
         raise Exception("Example script '" + filename + "' not found")
     print("Input script: " + filename, flush=True)
     with open(filename, 'r') as file:
         script = file.read()
 
+    # Detect or impose figure size.
     m = re.search(r'plt\.figure\(.+?figsize=\((.+?),(.+?)\)', script)
     if m: # set figure size as in script
         figsize = (float(m.group(1)), float(m.group(2)))
@@ -42,9 +63,15 @@ def run_example(filename, output_dir):
         figsize = (640/72, 480/72)
     fig = plt.figure(figsize=(figsize[0], figsize[1]))
 
+    # In -s mode, reduce detector size.
+    if True:
+        script = reduce_nbin(script)
+
+    # Run modified script.
     exec_full(script, filename)
     print("Input script completed.", flush=True)
 
+    # Generate output figure.
     plot_file_name = os.path.join(
         output_dir,
         os.path.splitext(os.path.basename(filename))[0] + ".png")
@@ -52,6 +79,7 @@ def run_example(filename, output_dir):
     plt.savefig(plot_file_name, bbox_inches='tight')
     plt.close(fig)
 
+    # Check obtained figure.
     imgSize = os.path.getsize(plot_file_name)
     if imgSize == 0:
         raise Exception("Image file is empty")