diff --git a/rawEx/CMakeLists.txt b/rawEx/CMakeLists.txt
index 4e7c32a041e42d9225223d33e954d2e281f300f9..e1cfe91902f267dbd5b896badc2c9c26d56ba221 100644
--- a/rawEx/CMakeLists.txt
+++ b/rawEx/CMakeLists.txt
@@ -9,26 +9,26 @@ foreach(ex ${examples})
     cmake_path(GET ex FILENAME ex_name )
     cmake_path(GET ex PARENT_PATH in_path)
 
-    # configure public version
+    # configure the public version of examples
     string(REPLACE ${EXAMPLES_SRC_DIR} ${EXAMPLES_PUBL_DIR} out_path ${in_path})
     file(MAKE_DIRECTORY ${out_path})
     set(ex_out ${out_path}/${ex_name})
     add_custom_command(
         OUTPUT ${ex_out}
-        COMMAND erb -T - ${CMAKE_CURRENT_SOURCE_DIR}/longmode.erb ${ex} > ${ex_out}
+        COMMAND erb -T - ${CMAKE_CURRENT_SOURCE_DIR}/publicmode.erb ${ex} > ${ex_out}
         COMMAND chmod a+x ${ex_out}
         DEPENDS ${ex}
     )
     list(APPEND outputs ${ex_out})
     # message(STATUS "ADD ${ex_out}")
 
-    # configure testable version
+    # configure testable version of examples
     string(REPLACE ${EXAMPLES_SRC_DIR} ${EXAMPLES_TEST_DIR} out_path ${in_path})
     file(MAKE_DIRECTORY ${out_path})
     set(ex_out ${out_path}/${ex_name})
     add_custom_command(
         OUTPUT ${ex_out}
-        COMMAND erb -T - ${CMAKE_CURRENT_SOURCE_DIR}/shortmode.erb ${ex} > ${ex_out}
+        COMMAND erb -T - ${CMAKE_CURRENT_SOURCE_DIR}/testmode.erb ${ex} > ${ex_out}
         COMMAND chmod a+x ${ex_out}
         DEPENDS ${ex}
     )
diff --git a/rawEx/README.md b/rawEx/README.md
index 42f79465b71f502c7483ed4b56691210157bf0bf..28ed93f81d369c0186952a6b1b3b97571c7e4b2c 100644
--- a/rawEx/README.md
+++ b/rawEx/README.md
@@ -10,6 +10,6 @@ testing, is in directory auto/MiniExamples.
 These versions are generated at compile time by command 'make'.
 
 The source scripts in the present directory contain code
-snippets like "<%= sm ? 11 : 200 %>". They contain ruby code,
+snippets like "<%= test_mode ? 11 : 200 %>". They contain ruby code,
 which is executed by the embedded ruby interpreter erb,
 as programmed in CMakeLists.txt.
diff --git a/rawEx/bayesian/likelihood_sampling.py b/rawEx/bayesian/likelihood_sampling.py
index cb82203951ee6279ba9f3c68690b181abd5516d0..4b8e82ccd89f553511a699e0a05079593e9c6474 100755
--- a/rawEx/bayesian/likelihood_sampling.py
+++ b/rawEx/bayesian/likelihood_sampling.py
@@ -95,13 +95,13 @@ if __name__ == '__main__':
     sampler = emcee.EnsembleSampler(nwalkers,
                                     ndim,
                                     log_likelihood)
-    sampler.run_mcmc(pos, <%= sm ? 1 : 1000 %>, progress=True)
+    sampler.run_mcmc(pos, <%= test_mode ? 1 : 1000 %>, progress=True)
 
     # Plot and show corner plot of samples
     flat_samples = sampler.get_chain(flat=True)
     corner.corner(flat_samples,
                   labels=['Ni-thickness/nm', 'Ti-thickness/nm'])
-    <%- if sm -%>
+    <%- if test_mode -%>
     <%- else -%>
     plt.show()
     <%- end -%>
@@ -115,7 +115,7 @@ if __name__ == '__main__':
     plt.xlabel('$\\alpha$/rad')
     plt.ylabel('$R$')
     plt.yscale('log')
-    <%- if sm -%>
+    <%- if test_mode -%>
     plt.close()
     <%- else -%>
     plt.show()
diff --git a/rawEx/ff/BarLorentz.py b/rawEx/ff/BarLorentz.py
index 32d244932482bc258cc932f771ed1c06e0c08099..1e0d6ec611043bebb8c238dbc1cb6f1079222db2 100755
--- a/rawEx/ff/BarLorentz.py
+++ b/rawEx/ff/BarLorentz.py
@@ -14,7 +14,7 @@ def get_sample(omega):
 
 
 def get_simulation(sample):
-    n = <%= sm ? 11 : 201 %>
+    n = <%= test_mode ? 11 : 201 %>
     return std_simulations.sas(sample, n)
 
 
@@ -28,7 +28,7 @@ if __name__ == '__main__':
         result.setTitle(title)
         results.append(result)
 
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.make_plot_row(results, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/ff/Bipyramid4.py b/rawEx/ff/Bipyramid4.py
index 4320e5a8b43cae806b4fa332b2b96d1f8c7e888f..5c017c83a3790f54cdafe11d843d68e163efddf0 100755
--- a/rawEx/ff/Bipyramid4.py
+++ b/rawEx/ff/Bipyramid4.py
@@ -14,7 +14,7 @@ def get_sample(omega):
 
 
 def get_simulation(sample):
-    n = <%= sm ? 11 : 201 %>
+    n = <%= test_mode ? 11 : 201 %>
     return std_simulations.sas(sample, n)
 
 
@@ -28,7 +28,7 @@ if __name__ == '__main__':
         result.setTitle(title)
         results.append(result)
 
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.make_plot_row(results, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/ff/Box.py b/rawEx/ff/Box.py
index d0dc92661b4db8c688264c6d193bf3b98d801fac..ea748739cd656d3f41f0b2864cdaec29727c4fbf 100755
--- a/rawEx/ff/Box.py
+++ b/rawEx/ff/Box.py
@@ -14,7 +14,7 @@ def get_sample(omega):
 
 
 def get_simulation(sample):
-    n = <%= sm ? 11 : 201 %>
+    n = <%= test_mode ? 11 : 201 %>
     return std_simulations.sas(sample, n)
 
 
@@ -28,7 +28,7 @@ if __name__ == '__main__':
         result.setTitle(title)
         results.append(result)
 
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.make_plot_row(results, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/ff/CantellatedCube.py b/rawEx/ff/CantellatedCube.py
index d1223ced51f968baaca6b8241d3a210469997fef..49c21bb64bcc4cf4cb5f26d90941621f7e2361ec 100755
--- a/rawEx/ff/CantellatedCube.py
+++ b/rawEx/ff/CantellatedCube.py
@@ -14,7 +14,7 @@ def get_sample(omega):
 
 
 def get_simulation(sample):
-    n = <%= sm ? 11 : 201 %>
+    n = <%= test_mode ? 11 : 201 %>
     return std_simulations.sas(sample, n)
 
 
@@ -28,7 +28,7 @@ if __name__ == '__main__':
         result.setTitle(title)
         results.append(result)
 
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.make_plot_row(results, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/ff/Cone.py b/rawEx/ff/Cone.py
index 95c2088668d8e6aa2200cd113bd17a331fb63f1e..32b08a3c0400e1e21fa1cb7c7a35d0f6081f4c36 100755
--- a/rawEx/ff/Cone.py
+++ b/rawEx/ff/Cone.py
@@ -14,7 +14,7 @@ def get_sample(omega):
 
 
 def get_simulation(sample):
-    n = <%= sm ? 11 : 201 %>
+    n = <%= test_mode ? 11 : 201 %>
     return std_simulations.sas(sample, n)
 
 
@@ -28,7 +28,7 @@ if __name__ == '__main__':
         result.setTitle(title)
         results.append(result)
 
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.make_plot_row(results, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/ff/CosineRippleBox.py b/rawEx/ff/CosineRippleBox.py
index 2830df2a94caa40e337e0242eb1535727bda59a5..d1cb5841c16181ba1fd829d0fdf655dc03361dc8 100755
--- a/rawEx/ff/CosineRippleBox.py
+++ b/rawEx/ff/CosineRippleBox.py
@@ -14,7 +14,7 @@ def get_sample(omega):
 
 
 def get_simulation(sample):
-    n = <%= sm ? 11 : 201 %>
+    n = <%= test_mode ? 11 : 201 %>
     return std_simulations.sas(sample, n)
 
 
@@ -28,7 +28,7 @@ if __name__ == '__main__':
         result.setTitle(title)
         results.append(result)
 
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.make_plot_row(results, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/ff/Cylinder.py b/rawEx/ff/Cylinder.py
index 5752849ced0190488e81541d1cfb77aaf8f58552..e7cf6271051e3983a87decd33001c3c91c6da56e 100755
--- a/rawEx/ff/Cylinder.py
+++ b/rawEx/ff/Cylinder.py
@@ -14,7 +14,7 @@ def get_sample(omega):
 
 
 def get_simulation(sample):
-    n = <%= sm ? 11 : 201 %>
+    n = <%= test_mode ? 11 : 201 %>
     return std_simulations.sas(sample, n)
 
 
@@ -28,7 +28,7 @@ if __name__ == '__main__':
         result.setTitle(title)
         results.append(result)
 
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.make_plot_row(results, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/ff/Dodecahedron.py b/rawEx/ff/Dodecahedron.py
index 845baa8213aae4b7af73e9799019d0932bd1baac..d27836bc721d3c70f8277d15c70e0849d4e80bc2 100755
--- a/rawEx/ff/Dodecahedron.py
+++ b/rawEx/ff/Dodecahedron.py
@@ -14,7 +14,7 @@ def get_sample(omega):
 
 
 def get_simulation(sample):
-    n = <%= sm ? 11 : 201 %>
+    n = <%= test_mode ? 11 : 201 %>
     return std_simulations.sas(sample, n)
 
 
@@ -29,7 +29,7 @@ if __name__ == '__main__':
         result.setTitle(titles[i])
         results.append(result)
 
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.make_plot_row(results, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/ff/EllipsoidalCylinder.py b/rawEx/ff/EllipsoidalCylinder.py
index 0c7023ce00045c54b324ffa52c8f717cf9b745ee..eb9e929552ade7be1cfd00138b632d1c164b6ccb 100755
--- a/rawEx/ff/EllipsoidalCylinder.py
+++ b/rawEx/ff/EllipsoidalCylinder.py
@@ -14,7 +14,7 @@ def get_sample(omega):
 
 
 def get_simulation(sample):
-    n = <%= sm ? 11 : 201 %>
+    n = <%= test_mode ? 11 : 201 %>
     return std_simulations.sas(sample, n)
 
 
@@ -28,7 +28,7 @@ if __name__ == '__main__':
         result.setTitle(title)
         results.append(result)
 
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.make_plot_row(results, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/ff/HemiEllipsoid.py b/rawEx/ff/HemiEllipsoid.py
index 7b0e4c70dc1bbdc82cd7556b733b75030953a5e9..d090aa09cb02d89b236d082ba04cfb0418508a9d 100755
--- a/rawEx/ff/HemiEllipsoid.py
+++ b/rawEx/ff/HemiEllipsoid.py
@@ -14,7 +14,7 @@ def get_sample(omega):
 
 
 def get_simulation(sample):
-    n = <%= sm ? 11 : 201 %>
+    n = <%= test_mode ? 11 : 201 %>
     return std_simulations.sas(sample, n)
 
 
@@ -28,7 +28,7 @@ if __name__ == '__main__':
         result.setTitle(title)
         results.append(result)
 
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.make_plot_row(results, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/ff/HorizontalCylinder.py b/rawEx/ff/HorizontalCylinder.py
index ef687bb12f0397aae278c79b5752685ed8e0fde6..5bcb225a8313614cc1b4369df69dd0603985ec77 100755
--- a/rawEx/ff/HorizontalCylinder.py
+++ b/rawEx/ff/HorizontalCylinder.py
@@ -14,7 +14,7 @@ def get_sample(omega):
 
 
 def get_simulation(sample):
-    n = <%= sm ? 11 : 201 %>
+    n = <%= test_mode ? 11 : 201 %>
     return std_simulations.sas(sample, n)
 
 
@@ -28,7 +28,7 @@ if __name__ == '__main__':
         result.setTitle(title)
         results.append(result)
 
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.make_plot_row(results, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/ff/Icosahedron.py b/rawEx/ff/Icosahedron.py
index 202777dd64ac6485142f4c1947de03ee0f960f31..c9dad7066d268347bda01ecc09b40e70f31b8d81 100755
--- a/rawEx/ff/Icosahedron.py
+++ b/rawEx/ff/Icosahedron.py
@@ -14,7 +14,7 @@ def get_sample(omega):
 
 
 def get_simulation(sample):
-    n = <%= sm ? 11 : 201 %>
+    n = <%= test_mode ? 11 : 201 %>
     return std_simulations.sas(sample, n)
 
 
@@ -29,7 +29,7 @@ if __name__ == '__main__':
         result.setTitle(titles[i])
         results.append(result)
 
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.make_plot_row(results, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/ff/PlatonicOctahedron.py b/rawEx/ff/PlatonicOctahedron.py
index c554904ff5e995960adf7a9efe7f91a0f0bd0a31..16d9a87719a3549e8db0f0e592c713878b9e2f7c 100755
--- a/rawEx/ff/PlatonicOctahedron.py
+++ b/rawEx/ff/PlatonicOctahedron.py
@@ -14,7 +14,7 @@ def get_sample(omega):
 
 
 def get_simulation(sample):
-    n = <%= sm ? 11 : 201 %>
+    n = <%= test_mode ? 11 : 201 %>
     return std_simulations.sas(sample, n)
 
 
@@ -29,7 +29,7 @@ if __name__ == '__main__':
         result.setTitle(titles[i])
         results.append(result)
 
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.make_plot_row(results, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/ff/PlatonicTetrahedron.py b/rawEx/ff/PlatonicTetrahedron.py
index acbee5ddc57eaf1e941dadd31dd0288eba619754..e265b820a5fdd84dd5eac49628fc705fe39cb0c3 100755
--- a/rawEx/ff/PlatonicTetrahedron.py
+++ b/rawEx/ff/PlatonicTetrahedron.py
@@ -14,7 +14,7 @@ def get_sample(omega):
 
 
 def get_simulation(sample):
-    n = <%= sm ? 11 : 201 %>
+    n = <%= test_mode ? 11 : 201 %>
     return std_simulations.sas(sample, n)
 
 
@@ -29,7 +29,7 @@ if __name__ == '__main__':
         result.setTitle(titles[i])
         results.append(result)
 
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.make_plot_row(results, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/ff/Prism3.py b/rawEx/ff/Prism3.py
index 71a47042282f172d824d841f307bae286320c8d9..60921873b5169c127d6688da6669550383085f81 100755
--- a/rawEx/ff/Prism3.py
+++ b/rawEx/ff/Prism3.py
@@ -14,7 +14,7 @@ def get_sample(omega):
 
 
 def get_simulation(sample):
-    n = <%= sm ? 11 : 201 %>
+    n = <%= test_mode ? 11 : 201 %>
     return std_simulations.sas(sample, n)
 
 
@@ -28,7 +28,7 @@ if __name__ == '__main__':
         result.setTitle(title)
         results.append(result)
 
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.make_plot_row(results, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/ff/Prism6.py b/rawEx/ff/Prism6.py
index 1dc5adeb0fe026199d6386b61c90a738dabf0c95..0061457f4cf39f2fccb9e0a0e767f30dc768f363 100755
--- a/rawEx/ff/Prism6.py
+++ b/rawEx/ff/Prism6.py
@@ -14,7 +14,7 @@ def get_sample(omega):
 
 
 def get_simulation(sample):
-    n = <%= sm ? 11 : 201 %>
+    n = <%= test_mode ? 11 : 201 %>
     return std_simulations.sas(sample, n)
 
 
@@ -28,7 +28,7 @@ if __name__ == '__main__':
         result.setTitle(title)
         results.append(result)
 
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.make_plot_row(results, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/ff/Pyramid2.py b/rawEx/ff/Pyramid2.py
index 02f86d04bd873f2710d7a5c9a541a09985b5e2c0..272447dd4d6345fa3d62bf7c88e98c487fcc28cb 100755
--- a/rawEx/ff/Pyramid2.py
+++ b/rawEx/ff/Pyramid2.py
@@ -14,7 +14,7 @@ def get_sample(omega):
 
 
 def get_simulation(sample):
-    n = <%= sm ? 11 : 201 %>
+    n = <%= test_mode ? 11 : 201 %>
     return std_simulations.sas(sample, n)
 
 
@@ -28,7 +28,7 @@ if __name__ == '__main__':
         result.setTitle(title)
         results.append(result)
 
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.make_plot_row(results, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/ff/Pyramid3.py b/rawEx/ff/Pyramid3.py
index a9fec761f69d6f495bdb13bfaa21e4b1fe1d2f76..53320cba4c6b9f4bfb8138a9dfc275f865d24baa 100755
--- a/rawEx/ff/Pyramid3.py
+++ b/rawEx/ff/Pyramid3.py
@@ -14,7 +14,7 @@ def get_sample(omega):
 
 
 def get_simulation(sample):
-    n = <%= sm ? 11 : 201 %>
+    n = <%= test_mode ? 11 : 201 %>
     return std_simulations.sas(sample, n)
 
 
@@ -28,7 +28,7 @@ if __name__ == '__main__':
         result.setTitle(title)
         results.append(result)
 
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.make_plot_row(results, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/ff/Pyramid4.py b/rawEx/ff/Pyramid4.py
index a87b56c3761cffe751d368aced9133bb37949e95..8fcf9adc9a0418452cf2bfe4c0358fdb194b39e1 100755
--- a/rawEx/ff/Pyramid4.py
+++ b/rawEx/ff/Pyramid4.py
@@ -14,7 +14,7 @@ def get_sample(omega):
 
 
 def get_simulation(sample):
-    n = <%= sm ? 11 : 201 %>
+    n = <%= test_mode ? 11 : 201 %>
     return std_simulations.sas(sample, n)
 
 
@@ -28,7 +28,7 @@ if __name__ == '__main__':
         result.setTitle(title)
         results.append(result)
 
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.make_plot_row(results, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/ff/Pyramid6.py b/rawEx/ff/Pyramid6.py
index 085d403519b61a9cb268e8d296a7ee08d544fe99..d9f786353e72bab625290b7f4b6d71661172c0ea 100755
--- a/rawEx/ff/Pyramid6.py
+++ b/rawEx/ff/Pyramid6.py
@@ -14,7 +14,7 @@ def get_sample(omega):
 
 
 def get_simulation(sample):
-    n = <%= sm ? 11 : 201 %>
+    n = <%= test_mode ? 11 : 201 %>
     return std_simulations.sas(sample, n)
 
 
@@ -28,7 +28,7 @@ if __name__ == '__main__':
         result.setTitle(title)
         results.append(result)
 
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.make_plot_row(results, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/ff/SawtoothRippleBox.py b/rawEx/ff/SawtoothRippleBox.py
index 5f43b8a0bafed9fece71deaf8a411a99916966ec..a2c6a0e7e8390db098f23052088f94e6654855cd 100755
--- a/rawEx/ff/SawtoothRippleBox.py
+++ b/rawEx/ff/SawtoothRippleBox.py
@@ -14,7 +14,7 @@ def get_sample(omega):
 
 
 def get_simulation(sample):
-    n = <%= sm ? 11 : 201 %>
+    n = <%= test_mode ? 11 : 201 %>
     return std_simulations.sas(sample, n)
 
 
@@ -28,7 +28,7 @@ if __name__ == '__main__':
         result.setTitle(title)
         results.append(result)
 
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.make_plot_row(results, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/ff/Sphere.py b/rawEx/ff/Sphere.py
index 0b25801782583df0a1d056a57b1e8228531a87c2..9cd4823f3b7695ed79b1ee885028e8be3403fce8 100755
--- a/rawEx/ff/Sphere.py
+++ b/rawEx/ff/Sphere.py
@@ -13,7 +13,7 @@ def get_sample():
 
 
 def get_simulation(sample):
-    n = <%= sm ? 11 : 201 %>
+    n = <%= test_mode ? 11 : 201 %>
     return std_simulations.sas(sample, n)
 
 
@@ -21,7 +21,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/ff/Spheroid.py b/rawEx/ff/Spheroid.py
index 98aa57816d17bea46f25499d5d549973540b9318..8a3bd444ec07cf42c86b212a27bb2f1fd5555c1a 100755
--- a/rawEx/ff/Spheroid.py
+++ b/rawEx/ff/Spheroid.py
@@ -14,7 +14,7 @@ def get_sample(omega):
 
 
 def get_simulation(sample):
-    n = <%= sm ? 11 : 201 %>
+    n = <%= test_mode ? 11 : 201 %>
     return std_simulations.sas(sample, n)
 
 
@@ -28,7 +28,7 @@ if __name__ == '__main__':
         result.setTitle(title)
         results.append(result)
 
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.make_plot_row(results, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/ff/TruncatedCube.py b/rawEx/ff/TruncatedCube.py
index c9904c74db5ad72a3153591dc5098081c361df30..f8946d79e9a2f1c5285669e9e401f6105fcf0738 100755
--- a/rawEx/ff/TruncatedCube.py
+++ b/rawEx/ff/TruncatedCube.py
@@ -14,7 +14,7 @@ def get_sample(omega):
 
 
 def get_simulation(sample):
-    n = <%= sm ? 11 : 201 %>
+    n = <%= test_mode ? 11 : 201 %>
     return std_simulations.sas(sample, n)
 
 
@@ -28,7 +28,7 @@ if __name__ == '__main__':
         result.setTitle(title)
         results.append(result)
 
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.make_plot_row(results, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/ff/TruncatedSphere.py b/rawEx/ff/TruncatedSphere.py
index 8b49deb8cc0419a3ec928407679f70e7ff22d0d1..4ec2fcd5d4317af15860a5cdd3a11f4976cdca19 100755
--- a/rawEx/ff/TruncatedSphere.py
+++ b/rawEx/ff/TruncatedSphere.py
@@ -14,7 +14,7 @@ def get_sample(omega):
 
 
 def get_simulation(sample):
-    n = <%= sm ? 11 : 201 %>
+    n = <%= test_mode ? 11 : 201 %>
     return std_simulations.sas(sample, n)
 
 
@@ -28,7 +28,7 @@ if __name__ == '__main__':
         result.setTitle(title)
         results.append(result)
 
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.make_plot_row(results, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/ff/TruncatedSpheroid.py b/rawEx/ff/TruncatedSpheroid.py
index 540dd512359815ccb5feaf1451181e4460e4fd1f..cc9fc5de8705be71191571a2e730fd8250f5ac36 100755
--- a/rawEx/ff/TruncatedSpheroid.py
+++ b/rawEx/ff/TruncatedSpheroid.py
@@ -14,7 +14,7 @@ def get_sample(omega):
 
 
 def get_simulation(sample):
-    n = <%= sm ? 11 : 201 %>
+    n = <%= test_mode ? 11 : 201 %>
     return std_simulations.sas(sample, n)
 
 
@@ -29,7 +29,7 @@ if __name__ == '__main__':
         results.append(result)
 
 
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.make_plot_row(results, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/fit/scatter2d/consecutive_fitting.py b/rawEx/fit/scatter2d/consecutive_fitting.py
index 3cc653fdeb7c2441588f6ed5a834b7e96c1eb020..821b6344943b905b7e513effee3319c28494d2f6 100755
--- a/rawEx/fit/scatter2d/consecutive_fitting.py
+++ b/rawEx/fit/scatter2d/consecutive_fitting.py
@@ -72,7 +72,7 @@ def run_fitting():
     fit_objective.initPrint(30)
     observer = ba_fitmonitor.PlotterGISAS()
 
-    <%- if sm -%>
+    <%- if test_mode -%>
     plt.close() # hide plot
     <%- else -%>
     fit_objective.initPlot(30, observer)
@@ -92,7 +92,7 @@ def run_fitting():
     """
     minimizer = ba.Minimizer()
     minimizer.setMinimizer("Genetic", "",
-                           "<%= sm ? "MaxIterations=1;PopSize=10" :
+                           "<%= test_mode ? "MaxIterations=1;PopSize=10" :
                            "MaxIterations=3;PopSize=500" %>")
     result = minimizer.minimize(fit_objective.evaluate, P)
     fit_objective.finalize(result)
@@ -104,7 +104,7 @@ def run_fitting():
     and then continues until fit converges.
     """
     minimizer.setMinimizer("Minuit2", "Migrad",
-                           "MaxFunctionCalls=<%= sm ? 10 : 0 %>")
+                           "MaxFunctionCalls=<%= test_mode ? 10 : 0 %>")
     result = minimizer.minimize(fit_objective.evaluate, best_P_so_far)
 
     fit_objective.finalize(result)
diff --git a/rawEx/fit/scatter2d/expfit_galaxi.py b/rawEx/fit/scatter2d/expfit_galaxi.py
index 2e21889d27227eb5a6f223700e657a409c2da7e5..bf6f1e4e45ab00504522d6093ae97e0d638a2cb5 100755
--- a/rawEx/fit/scatter2d/expfit_galaxi.py
+++ b/rawEx/fit/scatter2d/expfit_galaxi.py
@@ -130,7 +130,7 @@ def run_fitting():
     fit_objective.addFitPair(create_simulation, data, 1)
     fit_objective.initPrint(10)
     observer = ba_fitmonitor.PlotterGISAS()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plt.close() # hide plot
     <%- end -%>
 
@@ -142,7 +142,7 @@ def run_fitting():
     P.add("distance", 27.*nm, min=20, max=70)
 
     minimizer = ba.Minimizer()
-    <%- if sm -%>
+    <%- if test_mode -%>
     minimizer.setMinimizer("Minuit2", "Migrad", "MaxFunctionCalls=2")
     <%- end -%>
     result = minimizer.minimize(fit_objective.evaluate, P)
diff --git a/rawEx/fit/scatter2d/find_background.py b/rawEx/fit/scatter2d/find_background.py
index 8a35c0268acd67e4faebdd712dfea67ae3ecd926..b09faf71d271d467ee0ed739aa67667dd0727c71 100755
--- a/rawEx/fit/scatter2d/find_background.py
+++ b/rawEx/fit/scatter2d/find_background.py
@@ -53,7 +53,7 @@ if __name__ == '__main__':
 
     fit_objective.initPrint(10)
     observer = ba_fitmonitor.PlotterGISAS()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plt.close() # hide plot
     <%- else -%>
     fit_objective.initPlot(10, observer)
@@ -64,7 +64,7 @@ if __name__ == '__main__':
     P.add("background", 200, min=100, max=2000, step=100)
 
     minimizer = ba.Minimizer()
-    minimizer.setMinimizer("Minuit2", "Migrad", "MaxFunctionCalls=<%= sm ? 10 : 0 %>")
+    minimizer.setMinimizer("Minuit2", "Migrad", "MaxFunctionCalls=<%= test_mode ? 10 : 0 %>")
     result = minimizer.minimize(fit_objective.evaluate, P)
     fit_objective.finalize(result)
 
diff --git a/rawEx/fit/scatter2d/fit2d.py b/rawEx/fit/scatter2d/fit2d.py
index acded76be3706868fa497d13524d3d29099e3648..a5bda7efab527d91a10a8e87cf22fe9da3d0f1e2 100755
--- a/rawEx/fit/scatter2d/fit2d.py
+++ b/rawEx/fit/scatter2d/fit2d.py
@@ -20,7 +20,7 @@ def get_simulation(P):
     sample = ba.MultiLayer()
     sample.addLayer(layer)
 
-    n = <%= sm ? 11 : 100 %>
+    n = <%= test_mode ? 11 : 100 %>
     beam = ba.Beam(1, 0.1*nm, 0.2*deg)
     detector = ba.SphericalDetector(n, -1*deg, 1*deg, n, 0., 2*deg)
     simulation = ba.ScatteringSimulation(beam, sample, detector)
diff --git a/rawEx/fit/scatter2d/fit_along_slices.py b/rawEx/fit/scatter2d/fit_along_slices.py
index a2cbcf369fb27ec8decc1653d99a70469464037e..c2d4a3ab218dd727e9ec78f813d2405af0efd445 100755
--- a/rawEx/fit/scatter2d/fit_along_slices.py
+++ b/rawEx/fit/scatter2d/fit_along_slices.py
@@ -162,7 +162,7 @@ def run_fitting():
 
     # creating custom observer which will draw fit progress
     plotter = PlotObserver()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plt.close() # hide plot
     <%- else -%>
     fit_objective.initPlot(10, plotter)
diff --git a/rawEx/fit/scatter2d/fit_gisas.py b/rawEx/fit/scatter2d/fit_gisas.py
index e92967d3a6a8cdf9d770d26115b2ed6247c9114c..0b3bb8d79a3b6b51e255961510a05fb1d5bfa364 100755
--- a/rawEx/fit/scatter2d/fit_gisas.py
+++ b/rawEx/fit/scatter2d/fit_gisas.py
@@ -23,14 +23,14 @@ if __name__ == '__main__':
 
     fit_objective.initPrint(10)  # Print on every 10th iteration.
     observer = ba_fitmonitor.PlotterGISAS()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plt.close() # hide plot
     <%- else -%>
     fit_objective.initPlot(10, observer) # Plot every 10th, slow!
     <%- end -%>
 
     minimizer = ba.Minimizer()
-    minimizer.setMinimizer("Minuit2", "Migrad", "MaxFunctionCalls=<%= sm ? 10 : 0 %>")
+    minimizer.setMinimizer("Minuit2", "Migrad", "MaxFunctionCalls=<%= test_mode ? 10 : 0 %>")
     P = model.start_parameters_1()
     result = minimizer.minimize(fit_objective.evaluate, P)
 
diff --git a/rawEx/fit/scatter2d/fit_with_masks.py b/rawEx/fit/scatter2d/fit_with_masks.py
index 5d9f5f08a24b889752112bc80d2131fc5816b8a9..24333ebe3b06b6a806627f637cd89210779430b5 100755
--- a/rawEx/fit/scatter2d/fit_with_masks.py
+++ b/rawEx/fit/scatter2d/fit_with_masks.py
@@ -62,7 +62,7 @@ if __name__ == '__main__':
     fit_objective.addFitPair(get_masked_simulation, data, 1)
     fit_objective.initPrint(10)
     observer = ba_fitmonitor.PlotterGISAS()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plt.close() # hide plot
     <%- else -%>
     fit_objective.initPlot(10, observer)
diff --git a/rawEx/fit/scatter2d/lmfit_with_plotting.py b/rawEx/fit/scatter2d/lmfit_with_plotting.py
index 9400cc98c11897e42ad00ecd5569dffeef690dea..273629a4b4468deae712e6553f5dc43eed1833ec 100755
--- a/rawEx/fit/scatter2d/lmfit_with_plotting.py
+++ b/rawEx/fit/scatter2d/lmfit_with_plotting.py
@@ -34,7 +34,7 @@ if __name__ == '__main__':
     P = lmfit.Parameters()
     P.add('radius', value=7*nm, min=5*nm, max=8*nm)
     P.add('length', value=10*nm, min=8*nm, max=14*nm)
-    <%- if sm -%>
+    <%- if test_mode -%>
     result = lmfit.minimize(fit_objective.evaluate_residuals, P)
     <%- else -%>
     plotter = LMFITPlotter(fit_objective)
diff --git a/rawEx/fit/scatter2d/minimizer_settings.py b/rawEx/fit/scatter2d/minimizer_settings.py
index 8c67b6e3c77b34bdf4cd4ec20aeb3b4dfda1d87a..df4845ccb09e79e07f4f537ebe0513ce5739d6d8 100755
--- a/rawEx/fit/scatter2d/minimizer_settings.py
+++ b/rawEx/fit/scatter2d/minimizer_settings.py
@@ -94,7 +94,7 @@ def run_fitting():
 
     minimizer = ba.Minimizer()
 
-    <%- if sm -%>
+    <%- if test_mode -%>
     minimizer.setMinimizer("Minuit2", "Migrad", "MaxFunctionCalls=5") # fast test
     <%- end -%>
 
diff --git a/rawEx/fit/scatter2d/model1_cylinders.py b/rawEx/fit/scatter2d/model1_cylinders.py
index 644fc4765f043e2ca7d86b70d26abcbff390fe51..72db5d2bb4e8cf24a51ec38d192f01a6021f08d1 100644
--- a/rawEx/fit/scatter2d/model1_cylinders.py
+++ b/rawEx/fit/scatter2d/model1_cylinders.py
@@ -34,7 +34,7 @@ def get_simulation(P):
     """
     Create and return GISAXS simulation with beam and detector defined
     """
-    n = <%= sm ? 11 : 100 %>
+    n = <%= test_mode ? 11 : 100 %>
     beam = ba.Beam(1e8, 0.1*nm, 0.2*deg)
     sample = get_sample(P)
     detector = ba.SphericalDetector(n, -1*deg, 1*deg, n, 0, 2*deg)
diff --git a/rawEx/fit/scatter2d/model2_hexlattice.py b/rawEx/fit/scatter2d/model2_hexlattice.py
index 280d3014e4bb2a7610d5aa2fab2bee37bfd2feae..8e827d1b9a3699027798423e6971e3beec99f220 100644
--- a/rawEx/fit/scatter2d/model2_hexlattice.py
+++ b/rawEx/fit/scatter2d/model2_hexlattice.py
@@ -39,7 +39,7 @@ def get_simulation(P):
     """
     Create and return GISAXS simulation with beam and detector defined
     """
-    n = <%= sm ? 11 : 100 %>
+    n = <%= test_mode ? 11 : 100 %>
     beam = ba.Beam(1e8, 0.1*nm, 0.2*deg)
     detector = ba.SphericalDetector(n, -1*deg, 1*deg, n, 0, 2*deg)
     sample = get_sample(P)
diff --git a/rawEx/fit/scatter2d/multiple_datasets.py b/rawEx/fit/scatter2d/multiple_datasets.py
index 5c6d92e53338882c4c09ea1601e8b089d502e434..cfbf2a2c6cf3763a7aa19d894616217bc567dec5 100755
--- a/rawEx/fit/scatter2d/multiple_datasets.py
+++ b/rawEx/fit/scatter2d/multiple_datasets.py
@@ -44,7 +44,7 @@ def get_simulation(P):
     incident_angle = P["incident_angle"]
 
     beam = ba.Beam(1e8, 0.1*nm, incident_angle)
-    n = <%= sm ? 11 : 100 %>
+    n = <%= test_mode ? 11 : 100 %>
     detector = ba.SphericalDetector(n, -1.5*deg, 1.5*deg, n, 0, 2*deg)
     return ba.ScatteringSimulation(beam, get_sample(P), detector)
 
@@ -192,7 +192,7 @@ def run_fitting():
 
     # creating custom observer which will draw fit progress
     plotter = PlotObserver()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plt.close() # hide plot
     <%- else -%>
     fit_objective.initPlot(10, plotter.update)
diff --git a/rawEx/fit/specular/Honeycomb_fit.py b/rawEx/fit/specular/Honeycomb_fit.py
index 42128d9489e63e20bb4bf602e825bd96445df17d..5586bdc6e811d7531d62231cfe85d562703c730e 100755
--- a/rawEx/fit/specular/Honeycomb_fit.py
+++ b/rawEx/fit/specular/Honeycomb_fit.py
@@ -127,7 +127,7 @@ def plot(q, rs, data, shifts, labels):
 
     plt.xlabel(r"$q\; $(nm$^{-1}$)")
     plt.ylabel("$R$")
-    <%- if sm -%>
+    <%- if test_mode -%>
     <%- else -%>
     plt.tight_layout()
     <%- end -%>
@@ -150,7 +150,7 @@ def plot_sld_profile(P):
     plt.ylabel(r"$\delta(z) \cdot 10^6$")
 
     plt.legend()
-    <%- if sm -%>
+    <%- if test_mode -%>
     <%- else -%>
     plt.tight_layout()
     <%- end -%>
@@ -251,7 +251,7 @@ if __name__ == '__main__':
     result = scipy.optimize.differential_evolution(
         objective_function,
         bounds,
-        <%- if sm -%>
+        <%- if test_mode -%>
         maxiter=2,
         popsize=2,
         <%- else -%>
@@ -262,7 +262,7 @@ if __name__ == '__main__':
         mutation=(0.5, 1.5),
         seed=0,
         disp=True,
-        <%- if sm -%>
+        <%- if test_mode -%>
         polish=False
         <%- else -%>
         polish=True
@@ -283,7 +283,7 @@ if __name__ == '__main__':
          ["300K $+$", "300K $-$", "150K $+$", "150K $-$"])
     plot_sld_profile(P)
 
-    <%- if sm -%>
+    <%- if test_mode -%>
     <%- else -%>
     plt.show()
     <%- end -%>
diff --git a/rawEx/fit/specular/PolarizedSpinAsymmetry.py b/rawEx/fit/specular/PolarizedSpinAsymmetry.py
index 8ef1895aafc8fcf0d25dc2ff49f489c6a7efd2b2..68ac46a3b8242c80cc1654ee01575be847645a51 100755
--- a/rawEx/fit/specular/PolarizedSpinAsymmetry.py
+++ b/rawEx/fit/specular/PolarizedSpinAsymmetry.py
@@ -140,7 +140,7 @@ def plotData(qs, rs, exps, labels, colors):
     plt.ylabel("$R$")
 
     plt.tight_layout()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plt.close()
     <%- end -%>
 
@@ -175,7 +175,7 @@ def plotSpinAsymmetry(data_pp, data_mm, q, r_pp, r_mm):
     plt.ylabel("Spin asymmetry")
 
     plt.tight_layout()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plt.close() # hide plot
     <%- end -%>
 
@@ -229,7 +229,7 @@ if __name__ == '__main__':
              ["$++$", "$--$"], [['orange','red'], ['green','blue']])
 
     plotSpinAsymmetry(expdata_pp, expdata_mm, qzs, r_pp, r_mm)
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.export(**plotargs)
     <%- else -%>
diff --git a/rawEx/fit/specular/PolarizedSpinAsymmetryFit.py b/rawEx/fit/specular/PolarizedSpinAsymmetryFit.py
index 941911455dbced02c49dd7a9e93d95b3bcf07967..b68a1d9ee1d8c2c9eb7c8cd5e12d19d80521049e 100755
--- a/rawEx/fit/specular/PolarizedSpinAsymmetryFit.py
+++ b/rawEx/fit/specular/PolarizedSpinAsymmetryFit.py
@@ -119,13 +119,13 @@ if __name__ == '__main__':
 
     psa.plotData([q_pp, q_mm], [r_pp, r_mm], [data_pp, data_mm],
              [legend_pp, legend_mm], [color_pp, color_mm])
-    <%- if sm -%>
+    <%- if test_mode -%>
     <%- else -%>
     plt.draw()
     <%- end -%>
 
     psa.plotSpinAsymmetry(data_pp, data_mm, qzs, r_pp, r_mm)
-    <%- if sm -%>
+    <%- if test_mode -%>
     <%- else -%>
     plt.draw()
     plt.show()
diff --git a/rawEx/fit/specular/Pt_layer_fit.py b/rawEx/fit/specular/Pt_layer_fit.py
index c82dcacaeed7b3dd0b527fa849bfa503e0151836..de0abd763799fee28dbf3b8abd3dede5edfc68d5 100755
--- a/rawEx/fit/specular/Pt_layer_fit.py
+++ b/rawEx/fit/specular/Pt_layer_fit.py
@@ -94,7 +94,7 @@ def plot(q, r, data, P):
             y += 0.05
 
     plt.tight_layout()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plt.close() # hide plot
     <%- end -%>
 
diff --git a/rawEx/fit/specular/TREFF_Ni_film.py b/rawEx/fit/specular/TREFF_Ni_film.py
index bb027daa880445ba03e7351b491d9cc626542ca2..6c6091e2518ff0b49441110217d3a2087ecd2bea 100755
--- a/rawEx/fit/specular/TREFF_Ni_film.py
+++ b/rawEx/fit/specular/TREFF_Ni_film.py
@@ -78,7 +78,7 @@ if __name__ == '__main__':
 
     fit_objective.initPrint(50)
 
-    <%- if sm -%>
+    <%- if test_mode -%>
     <%- else -%>
     plot_observer = ba_fitmonitor.PlotterSpecular(pause=0.001)
     fit_objective.initPlot(50, plot_observer)
@@ -88,7 +88,7 @@ if __name__ == '__main__':
 
     # Main minimization
     minimizer.setMinimizer("Genetic", "",
-                           <%- if sm -%>
+                           <%- if test_mode -%>
                            "MaxIterations=1;PopSize=10"
                            <%- else -%>
                            "MaxIterations=5;PopSize=300"
@@ -100,11 +100,11 @@ if __name__ == '__main__':
     # Polish results with another minimizer
     best_P_so_far = result.parameters()
     minimizer.setMinimizer("Minuit2", "Migrad",
-                            "MaxFunctionCalls=<%= sm ? 10 : 0 %>")
+                            "MaxFunctionCalls=<%= test_mode ? 10 : 0 %>")
     result = minimizer.minimize(fit_objective.evaluate, best_P_so_far)
     fit_objective.finalize(result)
 
-    <%- if sm -%>
+    <%- if test_mode -%>
     <%- else -%>
     plot_observer.show()
     <%- end -%>
diff --git a/rawEx/fq/Sphere.py b/rawEx/fq/Sphere.py
index 3f61d3b5bf6606cd7701fbcf4566faa403ffedb9..06d6afbf71f2b69f755184708940721f73f30615 100755
--- a/rawEx/fq/Sphere.py
+++ b/rawEx/fq/Sphere.py
@@ -13,7 +13,7 @@ if __name__ == '__main__':
     qmax = 32
 
     v = ff.volume()
-    n = <%= sm ? 11 : 1000 %>
+    n = <%= test_mode ? 11 : 1000 %>
     x = [qmax*i/(n - 1) for i in range(n)]
     y = [ff.formfactor(C3(q, 0, 0)).real/v for q in x]
     ym = [-f for f in y]
@@ -29,7 +29,7 @@ if __name__ == '__main__':
     plt.ylabel("$|F(q)|$", fontsize=label_fontsize)
 
     plt.tight_layout()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.export(**plotargs)
     <%- else -%>
diff --git a/rawEx/longmode.erb b/rawEx/longmode.erb
deleted file mode 100644
index 5ad0e02fee3b882baf268171948dcd352132675e..0000000000000000000000000000000000000000
--- a/rawEx/longmode.erb
+++ /dev/null
@@ -1 +0,0 @@
-<% sm = false; -%>
\ No newline at end of file
diff --git a/rawEx/offspec/Offspec1.py b/rawEx/offspec/Offspec1.py
index 6049db86e92c73caff28dd4f92aab74dbdf93b60..809f04e3d0bca71fee66ce2988cc2d354d637133 100755
--- a/rawEx/offspec/Offspec1.py
+++ b/rawEx/offspec/Offspec1.py
@@ -45,7 +45,7 @@ def get_sample():
 
 
 def get_simulation(sample):
-    nscan = <%= sm ? 50 : 200 %>
+    nscan = <%= test_mode ? 50 : 200 %>
     ny = 50
     scan = ba.AlphaScan(nscan, 0.1*deg, 10*deg)
     scan.setIntensity(1e9)
@@ -59,7 +59,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/offspec/OffspecLambda.py b/rawEx/offspec/OffspecLambda.py
index 3f002ea1a70ca5c367212bdb4781f930d461557b..3309761f03ab9132f8ce88395658fec145e0fb94 100755
--- a/rawEx/offspec/OffspecLambda.py
+++ b/rawEx/offspec/OffspecLambda.py
@@ -45,8 +45,8 @@ def get_sample():
 
 
 def get_simulation(sample):
-    nla = <%= sm ? 26 : 573 %>
-    naf = <%= sm ? 31 : 200 %>
+    nla = <%= test_mode ? 26 : 573 %>
+    naf = <%= test_mode ? 31 : 200 %>
     ny = 50
     scan = ba.LambdaScan(nla, 1*nm/nla, 1*nm)
     scan.setInclination(1.5 * deg)
@@ -59,7 +59,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     plotargs['intensity_min'] = 1
     plotargs['aspect'] = 'auto'
diff --git a/rawEx/offspec/OffspecResolved.py b/rawEx/offspec/OffspecResolved.py
index 271ff5dfbd813166d0d594f70ea245860a5cbdaa..0dc3c2682c9930f51acd517c0f7dbdd07c71c84d 100755
--- a/rawEx/offspec/OffspecResolved.py
+++ b/rawEx/offspec/OffspecResolved.py
@@ -55,7 +55,7 @@ if __name__ == '__main__':
     result = simulate(sample)
     sum = result.npArray().sum()
     print(f'sum = {sum/1e9}')
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/publicmode.erb b/rawEx/publicmode.erb
new file mode 100644
index 0000000000000000000000000000000000000000..1e4cde5f5db33a72e107286669f0af0ade10a8b5
--- /dev/null
+++ b/rawEx/publicmode.erb
@@ -0,0 +1 @@
+<% test_mode = false; -%>
diff --git a/rawEx/scatter2d/ApproximationDA.py b/rawEx/scatter2d/ApproximationDA.py
index 599b7385a9c62f99d40065ba95a0f7f31a632b7e..67306e48cc9f633ca6f9eed3dbb663ac83666147 100755
--- a/rawEx/scatter2d/ApproximationDA.py
+++ b/rawEx/scatter2d/ApproximationDA.py
@@ -53,7 +53,7 @@ def get_sample():
 
 def get_simulation(sample):
     beam = ba.Beam(1e9, 0.1*nm, 0.2*deg)
-    n = <%= sm ? 11 : 200 %>
+    n = <%= test_mode ? 11 : 200 %>
     detector = ba.SphericalDetector(n, 0., 2*deg, n, 0., 2*deg)
     simulation = ba.ScatteringSimulation(beam, sample, detector)
     return simulation
@@ -63,7 +63,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/ApproximationLMA.py b/rawEx/scatter2d/ApproximationLMA.py
index dc0ae808ae723fb677ec9a03bc8653955246ca0c..7a29c6718165f31911140413fcd37b5fefa36f52 100755
--- a/rawEx/scatter2d/ApproximationLMA.py
+++ b/rawEx/scatter2d/ApproximationLMA.py
@@ -60,7 +60,7 @@ def get_sample():
 
 def get_simulation(sample):
     beam = ba.Beam(1e9, 0.1*nm, 0.2*deg)
-    n = <%= sm ? 11 : 200 %>
+    n = <%= test_mode ? 11 : 200 %>
     detector = ba.SphericalDetector(n, 0., 2*deg, n, 0., 2*deg)
     simulation = ba.ScatteringSimulation(beam, sample, detector)
     return simulation
@@ -70,7 +70,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/ApproximationSSCA.py b/rawEx/scatter2d/ApproximationSSCA.py
index 746cb89407906aeb2ed037e87323b058a80b7bd0..8a581526d1b5001871139422d9cb44f50bbbb9f3 100755
--- a/rawEx/scatter2d/ApproximationSSCA.py
+++ b/rawEx/scatter2d/ApproximationSSCA.py
@@ -53,7 +53,7 @@ def get_sample():
 
 def get_simulation(sample):
     beam = ba.Beam(1e9, 0.1*nm, 0.2*deg)
-    n = <%= sm ? 11 : 200 %>
+    n = <%= test_mode ? 11 : 200 %>
     detector = ba.SphericalDetector(n, 0., 2*deg, n, 0., 2*deg)
     simulation = ba.ScatteringSimulation(beam, sample, detector)
     return simulation
@@ -63,7 +63,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/AxesInDifferentUnits.py b/rawEx/scatter2d/AxesInDifferentUnits.py
index c825e45b011e5b5e51389301ba599fec777636f0..3cef2f6d8088d06e60dfd65ee5e163fa065698b7 100755
--- a/rawEx/scatter2d/AxesInDifferentUnits.py
+++ b/rawEx/scatter2d/AxesInDifferentUnits.py
@@ -59,7 +59,7 @@ def transformed_plot(i, result, title):
 
 if __name__ == '__main__':
     beam = ba.Beam(1e9, 1*angstrom, 0.5*deg)
-    n = <%= sm ? 11 : 500 %>
+    n = <%= test_mode ? 11 : 500 %>
     width = 170  # nm
     detector = ba.FlatDetector(n, n, width, width, beam, ba.FlatDetector.R, 2000.)
     simulation = ba.ScatteringSimulation(beam, get_sample(), detector)
@@ -83,7 +83,7 @@ if __name__ == '__main__':
         hspace=0.35,
         wspace=0.,
     )
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.export(**plotargs)
     <%- else -%>
diff --git a/rawEx/scatter2d/BeamDivergence.py b/rawEx/scatter2d/BeamDivergence.py
index 249c9ee5a2555e6790c93114a6a31b5da9836778..c189a6208f255c7962ec9a69c7c2f27fa62fe3ff 100755
--- a/rawEx/scatter2d/BeamDivergence.py
+++ b/rawEx/scatter2d/BeamDivergence.py
@@ -14,7 +14,7 @@ def get_sample():
 
 def get_simulation(sample):
     beam = ba.Beam(1e9, 0.1*nm, 0.2*deg)
-    n = <%= sm ? 11 : 100 %>
+    n = <%= test_mode ? 11 : 100 %>
     detector = ba.SphericalDetector(n, 0., 2*deg, n, 0., 2*deg)
     simulation = ba.ScatteringSimulation(beam, sample, detector)
     distr_1 = ba.DistributionLogNormal(0.1*nm, 0.1, 5, 2)
@@ -33,7 +33,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/BiMaterialCylinders.py b/rawEx/scatter2d/BiMaterialCylinders.py
index 875e34e02907abe0e443cfc1917d395105cecab1..d5212242abda18c8ce340cc1779c22e2267c2ebb 100755
--- a/rawEx/scatter2d/BiMaterialCylinders.py
+++ b/rawEx/scatter2d/BiMaterialCylinders.py
@@ -57,7 +57,7 @@ def get_sample():
 
 def get_simulation(sample):
     beam = ba.Beam(1e9, 0.1*nm, 0.2*deg)
-    n = <%= sm ? 11 : 100 %>
+    n = <%= test_mode ? 11 : 100 %>
     detector = ba.SphericalDetector(n, -1*deg, 1*deg, n, 0., 2*deg)
     simulation = ba.ScatteringSimulation(beam, sample, detector)
     return simulation
@@ -67,7 +67,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/BoxesWithSpecularPeak.py b/rawEx/scatter2d/BoxesWithSpecularPeak.py
index 5d939557ea0c159e1749ed21111e7111beb69223..ac8d64b38a8be61a22d1f5f268b9ce63cde3e38e 100755
--- a/rawEx/scatter2d/BoxesWithSpecularPeak.py
+++ b/rawEx/scatter2d/BoxesWithSpecularPeak.py
@@ -48,7 +48,7 @@ def get_sample():
 
 def get_simulation(sample):
     beam = ba.Beam(1e9, 0.1*nm, 0.2*deg)
-    n = <%= sm ? 11 : 101 %>
+    n = <%= test_mode ? 11 : 101 %>
     detector = ba.SphericalDetector(n, -2*deg, 2*deg, n, 0, 2*deg)
     simulation = ba.ScatteringSimulation(beam, sample, detector)
     simulation.options().setUseAvgMaterials(True)
@@ -60,7 +60,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/BroadSpecular.py b/rawEx/scatter2d/BroadSpecular.py
index 3bd78caf70c6d01720a50ee10a290d91f05f1479..3317248e57454c007bd97444f7056f7023ed4675 100755
--- a/rawEx/scatter2d/BroadSpecular.py
+++ b/rawEx/scatter2d/BroadSpecular.py
@@ -23,7 +23,7 @@ def get_sample():
 
 def get_simulation(sample):
     beam = ba.Beam(1e9, 0.1*nm, 0.5*deg)
-    n = <%= sm ? 11 : 200 %>
+    n = <%= test_mode ? 11 : 200 %>
     detector = ba.SphericalDetector(n, -0.5*deg, 0.5*deg, n, 0., 1*deg)
     detector.setResolutionFunction(
         ba.ResolutionFunction2DGaussian(0.04*deg, 0.03*deg))
@@ -37,7 +37,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/ConstantBackground.py b/rawEx/scatter2d/ConstantBackground.py
index d266bf59354d0c52b4fe4def2574379f5a15c854..07ca280d1792c05be870653adec92510ace11ddc 100755
--- a/rawEx/scatter2d/ConstantBackground.py
+++ b/rawEx/scatter2d/ConstantBackground.py
@@ -14,7 +14,7 @@ def get_sample():
 
 def get_simulation(sample):
     beam = ba.Beam(1e6, 0.1*nm, 0.2*deg)
-    n = <%= sm ? 11 : 100 %>
+    n = <%= test_mode ? 11 : 100 %>
     detector = ba.SphericalDetector(n, 0., 2*deg, n, 0., 2*deg)
     simulation = ba.ScatteringSimulation(beam, sample, detector)
     background = ba.ConstantBackground(1e3)
@@ -26,7 +26,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/CoreShellNanoparticles.py b/rawEx/scatter2d/CoreShellNanoparticles.py
index 87eaed9ae201c9a694736a7630e943bd9af6a9ff..ceca9bebb17063249f1ab61e1a0d0b1ea2fc215c 100755
--- a/rawEx/scatter2d/CoreShellNanoparticles.py
+++ b/rawEx/scatter2d/CoreShellNanoparticles.py
@@ -30,7 +30,7 @@ def get_sample():
 
 def get_simulation(sample):
     beam = ba.Beam(1e9, 0.1*nm, 0.2*deg)
-    n = <%= sm ? 11 : 200 %>
+    n = <%= test_mode ? 11 : 200 %>
     detector = ba.SphericalDetector(n, -1*deg, 1*deg, n, 0., 2*deg)
     simulation = ba.ScatteringSimulation(beam, sample, detector)
     return simulation
@@ -40,7 +40,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/CoreShellNanoparticles2.py b/rawEx/scatter2d/CoreShellNanoparticles2.py
index d5e266a36a916f13c9de3adf27466264ab96faf0..b63f5cb9360f02824c6089383bb3394c9ed8e38b 100755
--- a/rawEx/scatter2d/CoreShellNanoparticles2.py
+++ b/rawEx/scatter2d/CoreShellNanoparticles2.py
@@ -33,7 +33,7 @@ def get_sample():
 
 def get_simulation(sample):
     beam = ba.Beam(1e9, 0.1*nm, 0.2*deg)
-    n = <%= sm ? 11 : 200 %>
+    n = <%= test_mode ? 11 : 200 %>
     detector = ba.SphericalDetector(n, 0., 2*deg, n, 0., 2*deg)
     simulation = ba.ScatteringSimulation(beam, sample, detector)
     return simulation
@@ -43,7 +43,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/CorrelatedRoughness.py b/rawEx/scatter2d/CorrelatedRoughness.py
index a77ecc2542b4e27c97ab969093f989f3f02f30ed..7bbe1f4dc1b81ca95b23382cd97cf85941d12cf4 100755
--- a/rawEx/scatter2d/CorrelatedRoughness.py
+++ b/rawEx/scatter2d/CorrelatedRoughness.py
@@ -46,7 +46,7 @@ def get_sample():
 
 def get_simulation(sample):
     beam = ba.Beam(5e11, 0.1*nm, 0.2*deg)
-    n = <%= sm ? 11 : 200 %>
+    n = <%= test_mode ? 11 : 200 %>
     detector = ba.SphericalDetector(n, -0.5*deg, 0.5*deg, n, 0., 1*deg)
     simulation = ba.ScatteringSimulation(beam, sample, detector)
     return simulation
@@ -56,7 +56,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/CosineRipplesAtRectLattice.py b/rawEx/scatter2d/CosineRipplesAtRectLattice.py
index cac991481cb593af4ab3b9f2219126ab2200931e..0e40ff202a7e72933598e410de41ccc644426dee 100755
--- a/rawEx/scatter2d/CosineRipplesAtRectLattice.py
+++ b/rawEx/scatter2d/CosineRipplesAtRectLattice.py
@@ -53,7 +53,7 @@ def get_sample():
 
 def get_simulation(sample):
     beam = ba.Beam(1e9, 0.16*nm, 0.3*deg)
-    n = <%= sm ? 11 : 200 %>
+    n = <%= test_mode ? 11 : 200 %>
     detector = ba.SphericalDetector(n, -1.5*deg, 1.5*deg, n, 0, 2.5*deg)
     simulation = ba.ScatteringSimulation(beam, sample, detector)
     return simulation
@@ -63,7 +63,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/CustomFormFactor.py b/rawEx/scatter2d/CustomFormFactor.py
index 6e29a1ab0f0c7afe6943e97873ce05270e25bd10..5580e60668b73f805168ac40c6a24cdc6b82ecfd 100755
--- a/rawEx/scatter2d/CustomFormFactor.py
+++ b/rawEx/scatter2d/CustomFormFactor.py
@@ -76,7 +76,7 @@ def get_sample():
 
 def get_simulation(sample):
     beam = ba.Beam(1e9, 1*angstrom, 0.2*deg)
-    n = <%= sm ? 11 : 100 %>
+    n = <%= test_mode ? 11 : 100 %>
     det = ba.SphericalDetector(n, -1*deg, 1*deg, n, 0, 2*deg)
     simulation = ba.ScatteringSimulation(beam, sample, det)
     simulation.options().setNumberOfThreads(
@@ -88,7 +88,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/Cylinders.py b/rawEx/scatter2d/Cylinders.py
index eb305ac4021b5aeb977cbd480509be019e723b58..13c0b820f61a255c7ded516f41e5cb4df50efc5b 100755
--- a/rawEx/scatter2d/Cylinders.py
+++ b/rawEx/scatter2d/Cylinders.py
@@ -22,7 +22,7 @@ def get_simulation(sample):
     beam = ba.Beam(1e9, wavelength, alpha_i)
 
     # Detector
-    n = <%= sm ? 11 : 200 %>
+    n = <%= test_mode ? 11 : 200 %>
     detector = ba.SphericalDetector(n, -2*deg, 2*deg, n, 0., 3*deg)
 
     return ba.ScatteringSimulation(beam, sample, detector)
@@ -32,7 +32,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/CylindersAndPrisms.py b/rawEx/scatter2d/CylindersAndPrisms.py
index 6f1cc68efa77ae83c3d362a04920ed0b3c9c0dbf..661181adedaccd7b7da543bcea71ca045e40f7c3 100755
--- a/rawEx/scatter2d/CylindersAndPrisms.py
+++ b/rawEx/scatter2d/CylindersAndPrisms.py
@@ -46,7 +46,7 @@ def get_sample():
 
 def get_simulation(sample):
     beam = ba.Beam(1e9, 0.1*nm, 0.2*deg)
-    n = <%= sm ? 11 : 100 %>
+    n = <%= test_mode ? 11 : 100 %>
     detector = ba.SphericalDetector(n, -1*deg, 1*deg, n, 0., 2*deg)
     simulation = ba.ScatteringSimulation(beam, sample, detector)
     return simulation
@@ -56,7 +56,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/CylindersInAverageLayer.py b/rawEx/scatter2d/CylindersInAverageLayer.py
index 46099607e26015c588985455928fd13eec8e42fd..171981ef6b96d1196817de58ac727609bd5d83d4 100755
--- a/rawEx/scatter2d/CylindersInAverageLayer.py
+++ b/rawEx/scatter2d/CylindersInAverageLayer.py
@@ -44,7 +44,7 @@ def get_sample(cyl_height=5*nm):
 
 def get_simulation(sample):
     beam = ba.Beam(1e9, 0.1*nm, 0.2*deg)
-    n = <%= sm ? 11 : 100 %>
+    n = <%= test_mode ? 11 : 100 %>
     detector = ba.SphericalDetector(n, -2*deg, 2*deg, n, 0, 2*deg)
     simulation = ba.ScatteringSimulation(beam, sample, detector)
     simulation.options().setUseAvgMaterials(True)
@@ -55,7 +55,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/CylindersInBA.py b/rawEx/scatter2d/CylindersInBA.py
index 6b01d988a7599259f8929cf194f12a9f2b4312b1..11e1ef9a34634a5549498c82684f73c2c73df957 100755
--- a/rawEx/scatter2d/CylindersInBA.py
+++ b/rawEx/scatter2d/CylindersInBA.py
@@ -41,7 +41,7 @@ def get_sample():
 
 def get_simulation(sample):
     beam = ba.Beam(1e9, 0.1*nm, 0.2*deg)
-    n = <%= sm ? 11 : 200 %>
+    n = <%= test_mode ? 11 : 200 %>
     detector = ba.SphericalDetector(n, -2*deg, 2*deg, n, 0, 3*deg)
     simulation = ba.ScatteringSimulation(beam, sample, detector)
     return simulation
@@ -51,7 +51,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/DodecahedraSAS.py b/rawEx/scatter2d/DodecahedraSAS.py
index 714ad15cac71f3c870e9c9f3742806c415a43474..06b3a1532ed774c577e81c1f4112c224ffcd885f 100755
--- a/rawEx/scatter2d/DodecahedraSAS.py
+++ b/rawEx/scatter2d/DodecahedraSAS.py
@@ -33,7 +33,7 @@ def get_simulation(sample):
     beam = ba.Beam(1e9, 0.4*nm, 0.001*deg)
 
     # Detector opposite to source:
-    n = <%= sm ? 11 : 200 %>  # number of pixels per direction
+    n = <%= test_mode ? 11 : 200 %>  # number of pixels per direction
     detector = ba.SphericalDetector(n, -5*deg, 5*deg, n, -5*deg, 5*deg)
 
     return ba.ScatteringSimulation(beam, sample, detector)
@@ -43,7 +43,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/FindPeaks.py b/rawEx/scatter2d/FindPeaks.py
index ba465af715d4843113f1361b7ac31e257a14d291..0df5ee43aafb40bdf697905e1c943e72b3004367 100755
--- a/rawEx/scatter2d/FindPeaks.py
+++ b/rawEx/scatter2d/FindPeaks.py
@@ -54,7 +54,7 @@ def get_sample(lattice_rotation_angle=0*deg):
 
 def get_simulation(sample):
     beam = ba.Beam(1e8, 1.34*angstrom, 0.4*deg)
-    n = <%= sm ? 11 : 401 %>
+    n = <%= test_mode ? 11 : 401 %>
     detector = ba.SphericalDetector(n, -0.5*deg, 0.5*deg, n, 0, 0.5*deg)
     simulation = ba.ScatteringSimulation(beam, sample, detector)
     simulation.options().setMonteCarloIntegration(True, 100)
@@ -79,7 +79,7 @@ if __name__ == '__main__':
              color='white',
              markersize=10)
 
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/HalfSpheresInAverageTopLayer.py b/rawEx/scatter2d/HalfSpheresInAverageTopLayer.py
index 0107d9cafbcc35b01ce285db75e9ae4796091e8b..2d30442f19beaaa18fe8856e0393e3f32cb1729d 100755
--- a/rawEx/scatter2d/HalfSpheresInAverageTopLayer.py
+++ b/rawEx/scatter2d/HalfSpheresInAverageTopLayer.py
@@ -54,7 +54,7 @@ def get_sample():
 
 def get_simulation(sample):
     beam = ba.Beam(1e9, 0.1*nm, 0.2*deg)
-    n = <%= sm ? 11 : 100 %>
+    n = <%= test_mode ? 11 : 100 %>
     detector = ba.SphericalDetector(n, -2*deg, 2*deg, n, 0, 2*deg)
     simulation = ba.ScatteringSimulation(beam, sample, detector)
     simulation.options().setUseAvgMaterials(True)
@@ -65,7 +65,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/HexagonalLatticesWithBasis.py b/rawEx/scatter2d/HexagonalLatticesWithBasis.py
index 70196f591a43931543250f4bd2aaf9a5f4e38079..ac1c8487dfeccf8cc74c06aedd7f95fa21dd11f0 100755
--- a/rawEx/scatter2d/HexagonalLatticesWithBasis.py
+++ b/rawEx/scatter2d/HexagonalLatticesWithBasis.py
@@ -62,7 +62,7 @@ def get_sample():
 
 def get_simulation(sample):
     beam = ba.Beam(1e9, 0.1*nm, 0.2*deg)
-    n = <%= sm ? 11 : 200 %>
+    n = <%= test_mode ? 11 : 200 %>
     detector = ba.SphericalDetector(n, -1*deg, 1*deg, n, 0, 1*deg)
     simulation = ba.ScatteringSimulation(beam, sample, detector)
     return simulation
@@ -72,7 +72,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/Interference1DLattice.py b/rawEx/scatter2d/Interference1DLattice.py
index a8d3e98339a435b6eedc999f07edf4785071f780..97573a95bbd2ce62218bab7d17cd85b0a0ddb936 100755
--- a/rawEx/scatter2d/Interference1DLattice.py
+++ b/rawEx/scatter2d/Interference1DLattice.py
@@ -54,7 +54,7 @@ def get_sample():
 
 def get_simulation(sample):
     beam = ba.Beam(1e9, 1*angstrom, 0.2*deg)
-    n = <%= sm ? 11 : 100 %>
+    n = <%= test_mode ? 11 : 100 %>
     det = ba.SphericalDetector(n, -1*deg, 1*deg, n, 0, 2*deg)
     simulation = ba.ScatteringSimulation(beam, sample, det)
     simulation.options().setMonteCarloIntegration(True, 100)
@@ -68,7 +68,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/Interference1DRadialParacrystal.py b/rawEx/scatter2d/Interference1DRadialParacrystal.py
index c0036ecb4f6f4bbe0be04fccc925b43a84aa6970..008ffeee58b96924ebbee84e587394f64b00a788 100755
--- a/rawEx/scatter2d/Interference1DRadialParacrystal.py
+++ b/rawEx/scatter2d/Interference1DRadialParacrystal.py
@@ -48,7 +48,7 @@ def get_sample():
 
 def get_simulation(sample):
     beam = ba.Beam(1e9, 0.1*nm, 0.2*deg)
-    n = <%= sm ? 11 : 200 %>
+    n = <%= test_mode ? 11 : 200 %>
     detector = ba.SphericalDetector(n, -2*deg, 2*deg, n, 0, 2*deg)
     simulation = ba.ScatteringSimulation(beam, sample, detector)
     return simulation
@@ -58,7 +58,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/Interference2DCenteredSquareLattice.py b/rawEx/scatter2d/Interference2DCenteredSquareLattice.py
index 7025e3096006364bd4579f80b39b401485e69096..75465e26c4c84c09bbdde7061a97ddf93770eaf9 100755
--- a/rawEx/scatter2d/Interference2DCenteredSquareLattice.py
+++ b/rawEx/scatter2d/Interference2DCenteredSquareLattice.py
@@ -62,7 +62,7 @@ def get_sample():
 
 def get_simulation(sample):
     beam = ba.Beam(1e9, 0.1*nm, 0.2*deg)
-    n = <%= sm ? 11 : 200 %>
+    n = <%= test_mode ? 11 : 200 %>
     detector = ba.SphericalDetector(n, -2*deg, 2*deg, n, 0, 2*deg)
     simulation = ba.ScatteringSimulation(beam, sample, detector)
     return simulation
@@ -72,7 +72,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/Interference2DParacrystal.py b/rawEx/scatter2d/Interference2DParacrystal.py
index 81f51b6f8f64e3120669772342b563205c7abd0d..4594f8edad4b8cd986a71b9f6b1db7ddf79ecf67 100755
--- a/rawEx/scatter2d/Interference2DParacrystal.py
+++ b/rawEx/scatter2d/Interference2DParacrystal.py
@@ -54,7 +54,7 @@ def get_sample():
 
 def get_simulation(sample):
     beam = ba.Beam(1e9, 0.1*nm, 0.2*deg)
-    n = <%= sm ? 11 : 200 %>
+    n = <%= test_mode ? 11 : 200 %>
     detector = ba.SphericalDetector(n, -2*deg, 2*deg, n, 0, 2*deg)
     simulation = ba.ScatteringSimulation(beam, sample, detector)
     return simulation
@@ -64,7 +64,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/Interference2DRotatedSquareLattice.py b/rawEx/scatter2d/Interference2DRotatedSquareLattice.py
index 6d453a9e02ca046d0a5e30c8c17da48bf0342b15..c4d37268e04f73607ddb3250d4154c680118f43d 100755
--- a/rawEx/scatter2d/Interference2DRotatedSquareLattice.py
+++ b/rawEx/scatter2d/Interference2DRotatedSquareLattice.py
@@ -53,7 +53,7 @@ def get_sample():
 
 def get_simulation(sample):
     beam = ba.Beam(1e9, 0.1*nm, 0.2*deg)
-    n = <%= sm ? 11 : 200 %>
+    n = <%= test_mode ? 11 : 200 %>
     detector = ba.SphericalDetector(n, -2*deg, 2*deg, n, 0, 2*deg)
     simulation = ba.ScatteringSimulation(beam, sample, detector)
     return simulation
@@ -63,7 +63,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/Interference2DSquareFiniteLattice.py b/rawEx/scatter2d/Interference2DSquareFiniteLattice.py
index 5d74ca24998b5577e5a2732c36c19f2e0ac20ce5..68b3672b95e815b2290f3c7ef82d0497ffb5118d 100755
--- a/rawEx/scatter2d/Interference2DSquareFiniteLattice.py
+++ b/rawEx/scatter2d/Interference2DSquareFiniteLattice.py
@@ -51,7 +51,7 @@ def get_sample():
 
 def get_simulation(sample):
     beam = ba.Beam(1e9, 0.1*nm, 0.2*deg)
-    n = <%= sm ? 11 : 200 %>
+    n = <%= test_mode ? 11 : 200 %>
     detector = ba.SphericalDetector(n, -2*deg, 2*deg, n, 0, 2*deg)
     simulation = ba.ScatteringSimulation(beam, sample, detector)
     return simulation
@@ -61,7 +61,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/LargeParticlesFormFactor.py b/rawEx/scatter2d/LargeParticlesFormFactor.py
index b7bbb68ae025959f81b019e220a5243beb6eb409..61b6acb2e951f5ea429c8be7645d106a408792e7 100755
--- a/rawEx/scatter2d/LargeParticlesFormFactor.py
+++ b/rawEx/scatter2d/LargeParticlesFormFactor.py
@@ -45,7 +45,7 @@ def get_simulation(sample, integration_flag):
     If integration_flag=True, the simulation will integrate over detector bins.
     """
     beam = ba.Beam(1, 1*angstrom, 0.2*deg)
-    n = <%= sm ? 11 : 201 %>
+    n = <%= test_mode ? 11 : 201 %>
     det = ba.SphericalDetector(n, -1.5*deg, 1.5*deg, n, 0, 3*deg)
     simulation = ba.ScatteringSimulation(beam, sample, det)
     simulation.options().setMonteCarloIntegration(integration_flag, 50)
@@ -101,7 +101,7 @@ def simulate():
 
 if __name__ == '__main__':
     results = simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     plotargs['fontsize'] = 12
     bp.make_plot(results, 2, **plotargs)
diff --git a/rawEx/scatter2d/LatticeOrientationDistribution.py b/rawEx/scatter2d/LatticeOrientationDistribution.py
index fbdec4dbdb6fbc2fda897d041f39149162f1a67f..6c506e53fe6ea8fb4c5d92ab98b26dd77d1ba7c5 100755
--- a/rawEx/scatter2d/LatticeOrientationDistribution.py
+++ b/rawEx/scatter2d/LatticeOrientationDistribution.py
@@ -37,7 +37,7 @@ def get_sample():
 
 def get_simulation(sample):
     beam = ba.Beam(1e9, 0.1*nm, 0.2*deg)
-    n = <%= sm ? 11 : 100 %>
+    n = <%= test_mode ? 11 : 100 %>
     detector = ba.SphericalDetector(n, -1*deg, 1*deg, n, 0, 2*deg)
     simulation = ba.ScatteringSimulation(beam, sample, detector)
     return simulation
@@ -47,7 +47,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/MagneticCylinders1.py b/rawEx/scatter2d/MagneticCylinders1.py
index 296a24386b6d89550a688a77322022214c05edec..52b24fc9484fb1f5ecb3ef79231fdbb7ad2629d7 100755
--- a/rawEx/scatter2d/MagneticCylinders1.py
+++ b/rawEx/scatter2d/MagneticCylinders1.py
@@ -33,7 +33,7 @@ def get_sample():
 
 
 def get_simulation(sample):
-    n = <%= sm ? 11 : 100 %>
+    n = <%= test_mode ? 11 : 100 %>
     beam = ba.Beam(1e2, 0.1*nm, 0.2*deg)
     detector = ba.SphericalDetector(n, 0, 2*deg, n, 0, 2*deg)
     simulation = ba.ScatteringSimulation(beam, sample, detector)
@@ -50,7 +50,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/MagneticCylinders2.py b/rawEx/scatter2d/MagneticCylinders2.py
index 0663a6cea2b471f1f3fb98ca8eb7929c47f1eb9b..47ce4b8fa747d9ab7244024b6b311f63cf7c4a7b 100755
--- a/rawEx/scatter2d/MagneticCylinders2.py
+++ b/rawEx/scatter2d/MagneticCylinders2.py
@@ -33,7 +33,7 @@ def get_sample():
 
 def get_simulation(sample, pol_dir):
     z_up = R3(0, 0, 1)
-    n = <%= sm ? 11 : 100 %>
+    n = <%= test_mode ? 11 : 100 %>
     beam = ba.Beam(1e9, 0.1*nm, 0.2*deg)
     detector = ba.SphericalDetector(n, -1*deg, 1*deg, n, 0, 2*deg)
 
@@ -59,7 +59,7 @@ if __name__ == '__main__':
     results.append(simulate('+-', z_dn))
     results.append(simulate('-+', z_up))
     results.append(simulate('--', z_dn))
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     plotargs['fontsize'] = 12
     bp.make_plot(results, 2, **plotargs)
diff --git a/rawEx/scatter2d/MagneticSpheres.py b/rawEx/scatter2d/MagneticSpheres.py
index 73af5e232951ee38470492b5a6a11d9c9abeb4e9..7d4afa14bbbb6a82cc9b4bbf3fe387a8c0b5c39a 100755
--- a/rawEx/scatter2d/MagneticSpheres.py
+++ b/rawEx/scatter2d/MagneticSpheres.py
@@ -39,7 +39,7 @@ def get_sample():
 
 def get_simulation(sample):
     beam = ba.Beam(1e12, 0.1*nm, 0.5*deg)
-    n = <%= sm ? 11 : 200 %>
+    n = <%= test_mode ? 11 : 200 %>
     detector = ba.SphericalDetector(n, -3*deg, 3*deg, n, 0, 4*deg)
 
     polarizer_vec = R3(0, 0, 1)
@@ -54,7 +54,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/Mesocrystal.py b/rawEx/scatter2d/Mesocrystal.py
index f18b7538e4d41392034df3b94c1278f5eb14a34b..9350686be1cb90b8518ccbc9379f5755d6da5d40 100755
--- a/rawEx/scatter2d/Mesocrystal.py
+++ b/rawEx/scatter2d/Mesocrystal.py
@@ -52,7 +52,7 @@ def get_sample():
 
 def get_simulation(sample):
     beam = ba.Beam(1e9, 0.1*nm, 0.2*deg)
-    n = <%= sm ? 11 : 200 %>
+    n = <%= test_mode ? 11 : 200 %>
     detector = ba.SphericalDetector(n, -2*deg, 2*deg, n, 0, 2*deg)
     simulation = ba.ScatteringSimulation(beam, sample, detector)
     return simulation
@@ -62,7 +62,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/Mesocrystal2.py b/rawEx/scatter2d/Mesocrystal2.py
index 6479bd9fce0f25943234b992e0cba758d4dfb137..6972e901dec8b9a21bc680be6f8ca97e834e9d8b 100755
--- a/rawEx/scatter2d/Mesocrystal2.py
+++ b/rawEx/scatter2d/Mesocrystal2.py
@@ -52,7 +52,7 @@ def get_sample():
 
 def get_simulation(sample):
     beam = ba.Beam(1e9, 0.1*nm, 0.2*deg)
-    n = <%= sm ? 11 : 200 %>
+    n = <%= test_mode ? 11 : 200 %>
     detector = ba.SphericalDetector(n, -2*deg, 2*deg, n, 0, 2*deg)
     simulation = ba.ScatteringSimulation(beam, sample, detector)
     simulation.options().setMesoOptions(True, 2.5)
@@ -63,7 +63,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/Mesocrystal3.py b/rawEx/scatter2d/Mesocrystal3.py
index 4c93f2ad6bc69a3ce7faa2bca96a3cdebad58d13..cb1a9b3d52bdc622a942b0a1e4ad5e130121149b 100755
--- a/rawEx/scatter2d/Mesocrystal3.py
+++ b/rawEx/scatter2d/Mesocrystal3.py
@@ -69,7 +69,7 @@ def get_sample():
 
 def get_simulation(sample):
     beam = ba.Beam(1e9, 0.1*nm, 0.2*deg)
-    n = <%= sm ? 11 : 200 %>
+    n = <%= test_mode ? 11 : 200 %>
     detector = ba.SphericalDetector(n, -2*deg, 2*deg, n, 0, 2*deg)
     simulation = ba.ScatteringSimulation(beam, sample, detector)
     return simulation
@@ -79,7 +79,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/Mesocrystal4.py b/rawEx/scatter2d/Mesocrystal4.py
index dc78309a4f0d4841ad619552403aad11629b9502..c1b7863a7a367677a17824ae421dcc0e72763d96 100755
--- a/rawEx/scatter2d/Mesocrystal4.py
+++ b/rawEx/scatter2d/Mesocrystal4.py
@@ -69,7 +69,7 @@ def get_sample():
 
 def get_simulation(sample):
     beam = ba.Beam(1e9, 0.1*nm, 0.2*deg)
-    n = <%= sm ? 11 : 200 %>
+    n = <%= test_mode ? 11 : 200 %>
     detector = ba.SphericalDetector(n, -2*deg, 2*deg, n, 0, 2*deg)
     simulation = ba.ScatteringSimulation(beam, sample, detector)
     simulation.options().setUseAvgMaterials(True)
@@ -80,7 +80,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/ObsoleteSimN.py b/rawEx/scatter2d/ObsoleteSimN.py
index 514aad3d58f295768027ac68ed4e74cb59220a84..3e857871009dbc155ce7b64b58d2593f143ff8f9 100755
--- a/rawEx/scatter2d/ObsoleteSimN.py
+++ b/rawEx/scatter2d/ObsoleteSimN.py
@@ -32,7 +32,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/ParticleAcrossInterface.py b/rawEx/scatter2d/ParticleAcrossInterface.py
index faeef4d0fc1060b02ad7ef94267bb09c717ff305..2917095fef09891d56a74092412134f8274a76bb 100755
--- a/rawEx/scatter2d/ParticleAcrossInterface.py
+++ b/rawEx/scatter2d/ParticleAcrossInterface.py
@@ -37,7 +37,7 @@ def get_sample():
 
 def get_simulation(sample):
     beam = ba.Beam(1e9, 0.1*nm, 0.2*deg)
-    n = <%= sm ? 11 : 100 %>
+    n = <%= test_mode ? 11 : 100 %>
     detector = ba.SphericalDetector(n, -1*deg, 1*deg, n, 0, 2*deg)
     simulation = ba.ScatteringSimulation(beam, sample, detector)
     return simulation
@@ -47,7 +47,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/PolarizedSANS.py b/rawEx/scatter2d/PolarizedSANS.py
index 52d41a2131afc5ccb7a8a82597a3e0528f8332fb..afe7b358772e3a493aad0fbae968de65a384873b 100755
--- a/rawEx/scatter2d/PolarizedSANS.py
+++ b/rawEx/scatter2d/PolarizedSANS.py
@@ -52,7 +52,7 @@ def get_simulation(sample):
     """
     A polarized SANS simulation
     """
-    n = <%= sm ? 11 : 200 %>
+    n = <%= test_mode ? 11 : 200 %>
 
     # Beam from above (perpendicular to sample):
     beam = ba.Beam(1e9, 0.4*nm, 0.001*deg)
@@ -70,7 +70,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/PolydisperseCylinders.py b/rawEx/scatter2d/PolydisperseCylinders.py
index 7f4af56cfea758291f92083f902ac135682394d9..786859b1bea9d5ed09c729d5bbefe601987a59f4 100755
--- a/rawEx/scatter2d/PolydisperseCylinders.py
+++ b/rawEx/scatter2d/PolydisperseCylinders.py
@@ -31,7 +31,7 @@ def get_sample():
 
 def get_simulation(sample):
     beam = ba.Beam(1e9, 0.1*nm, 0.2*deg)
-    n = <%= sm ? 11 : 200 %>
+    n = <%= test_mode ? 11 : 200 %>
     detector = ba.SphericalDetector(n, -1*deg, 1*deg, n, 0, 2*deg)
     simulation = ba.ScatteringSimulation(beam, sample, detector)
     return simulation
@@ -41,7 +41,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/PositionVariance.py b/rawEx/scatter2d/PositionVariance.py
index 140fcb6f4fcadba3012baa61283f55cdeef10087..3426faa7120831f31c8f18181947b036e34663a0 100755
--- a/rawEx/scatter2d/PositionVariance.py
+++ b/rawEx/scatter2d/PositionVariance.py
@@ -43,7 +43,7 @@ def get_sample(hasVariance, xi):
 
 
 def get_simulation(sample):
-    n = <%= sm ? 11 : 200 %>
+    n = <%= test_mode ? 11 : 200 %>
     beam = ba.Beam(1e8, 0.1*nm, 0.2*deg)
     det = ba.SphericalDetector(n, -2*deg, 2*deg, n, 0, 3*deg)
     return ba.ScatteringSimulation(beam, sample, det)
@@ -78,7 +78,7 @@ if __name__ == '__main__':
 
     plt.subplots_adjust(bottom=0.05, left=0.1)
     plt.colorbar(im, cax=plt.axes([0.93, 0.36, 0.03, 0.21]))
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.export(**plotargs)
     <%- else -%>
diff --git a/rawEx/scatter2d/RectangularGrating.py b/rawEx/scatter2d/RectangularGrating.py
index 66d771a67e06cdde4a9d5ba4532b9a229304f26d..7c8d6b239d1de4ef24354dea68ed4bb6bed018d9 100755
--- a/rawEx/scatter2d/RectangularGrating.py
+++ b/rawEx/scatter2d/RectangularGrating.py
@@ -54,7 +54,7 @@ def get_sample(lattice_rotation_angle=0*deg):
 
 def get_simulation(sample):
     beam = ba.Beam(1e8, 0.134*nm, 0.4*deg)
-    n = <%= sm ? 11 : 200 %>
+    n = <%= test_mode ? 11 : 200 %>
     detector = ba.SphericalDetector(n, -0.5*deg, 0.5*deg, n, 0, 0.5*deg)
     simulation = ba.ScatteringSimulation(beam, sample, detector)
     simulation.options().setMonteCarloIntegration(True, 100)
@@ -65,7 +65,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/Resolution.py b/rawEx/scatter2d/Resolution.py
index 3faed455728804a245a797ff8a427a06b248ed6f..80ee7eeba94fec6d90eb2b20b4d63f2bc952a0c0 100755
--- a/rawEx/scatter2d/Resolution.py
+++ b/rawEx/scatter2d/Resolution.py
@@ -29,8 +29,8 @@ if __name__ == '__main__':
     beam = ba.Beam(1, wavelength, alpha_i)
 
     # Detector
-    nx = <%= sm ?  7 : 142 %>
-    ny = <%= sm ? 11 : 200 %>
+    nx = <%= test_mode ?  7 : 142 %>
+    ny = <%= test_mode ? 11 : 200 %>
     detector = ba.SphericalDetector(nx, -1.5*deg, 1.5*deg, ny, 0, 3*deg)
 
     results = []
@@ -53,7 +53,7 @@ if __name__ == '__main__':
     result = simulation.simulate()
     result.setTitle("resolution 0.2deg, 0.2deg")
     results.append(result)
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.make_plot_row(results, **plotargs)
     bp.export()
diff --git a/rawEx/scatter2d/RotatedPyramids.py b/rawEx/scatter2d/RotatedPyramids.py
index 6c01b921530c0445df8f759d477939b76baca997..534f8a32b2629f2f4972e9643a29a828cd129c7b 100755
--- a/rawEx/scatter2d/RotatedPyramids.py
+++ b/rawEx/scatter2d/RotatedPyramids.py
@@ -44,7 +44,7 @@ def get_sample():
 
 def get_simulation(sample):
     beam = ba.Beam(1e9, 0.1*nm, 0.2*deg)
-    n = <%= sm ? 11 : 200 %>
+    n = <%= test_mode ? 11 : 200 %>
     detector = ba.SphericalDetector(n, -2*deg, 2*deg, n, 0, 2*deg)
     simulation = ba.ScatteringSimulation(beam, sample, detector)
     return simulation
@@ -54,7 +54,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/RoughAndSpecular.py b/rawEx/scatter2d/RoughAndSpecular.py
index 475eb41d6e7200f3ce3b2d75b1b36b5dd91c5ba3..dffc595ead3b4b8f6c009ad06a8ebcc3240d39c1 100755
--- a/rawEx/scatter2d/RoughAndSpecular.py
+++ b/rawEx/scatter2d/RoughAndSpecular.py
@@ -38,7 +38,7 @@ def get_sample():
 
 def get_simulation(sample):
     beam = ba.Beam(1e9, 0.1*nm, 0.4*deg)
-    n = <%= sm ? 11 : 200 %>
+    n = <%= test_mode ? 11 : 200 %>
     detector = ba.SphericalDetector(n, -2*deg, 2*deg, n, -.6*deg, 1.4*deg)
     detector.setResolutionFunction(
         ba.ResolutionFunction2DGaussian(0.02*deg, 0.02*deg))
@@ -52,7 +52,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/SlicedLayer.py b/rawEx/scatter2d/SlicedLayer.py
index 572188019b5882caff5b0d0b74adc73f42c8478e..99cfe09831188d96b9501b4efdc603eb7dfb4ab5 100755
--- a/rawEx/scatter2d/SlicedLayer.py
+++ b/rawEx/scatter2d/SlicedLayer.py
@@ -40,7 +40,7 @@ def get_sample():
 
 def get_simulation(sample):
     beam = ba.Beam(1e9, 0.1*nm, 0.2*deg)
-    n = <%= sm ? 11 : 100 %>
+    n = <%= test_mode ? 11 : 100 %>
     detector = ba.SphericalDetector(n, -2*deg, 2*deg, n, 0, 2*deg)
     simulation = ba.ScatteringSimulation(beam, sample, detector)
     simulation.options().setUseAvgMaterials(True)
@@ -51,7 +51,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/SpheresAtHexLattice.py b/rawEx/scatter2d/SpheresAtHexLattice.py
index 1eb14f21fb91da9c1bbda25f68efe435483667d2..237f4873057b0cf28d4730643d5b9d7e0213c334 100755
--- a/rawEx/scatter2d/SpheresAtHexLattice.py
+++ b/rawEx/scatter2d/SpheresAtHexLattice.py
@@ -53,7 +53,7 @@ def get_sample():
 
 def get_simulation(sample):
     beam = ba.Beam(1e9, 0.1*nm, 0.2*deg)
-    n = <%= sm ? 11 : 200 %>
+    n = <%= test_mode ? 11 : 200 %>
     detector = ba.SphericalDetector(n, -1*deg, 1*deg, n, 0, 1*deg)
     simulation = ba.ScatteringSimulation(beam, sample, detector)
     return simulation
@@ -63,7 +63,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/scatter2d/TriangularRipple.py b/rawEx/scatter2d/TriangularRipple.py
index db447049e43607389a83e8693a576eb19df589d0..8732c19dc1dff5690e192dfb38dbdb2b87a028b6 100755
--- a/rawEx/scatter2d/TriangularRipple.py
+++ b/rawEx/scatter2d/TriangularRipple.py
@@ -53,7 +53,7 @@ def get_sample():
 
 def get_simulation(sample):
     beam = ba.Beam(1e9, 0.16*nm, 0.3*deg)
-    n = <%= sm ? 11 : 200 %>
+    n = <%= test_mode ? 11 : 200 %>
     detector = ba.SphericalDetector(n, -2*deg, 2*deg, n, 0., 3*deg)
     simulation = ba.ScatteringSimulation(beam, sample, detector)
     return simulation
@@ -63,7 +63,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/shortmode.erb b/rawEx/shortmode.erb
deleted file mode 100644
index 040b4b51a4cb1baf438d9c0693d4e2d7b278930e..0000000000000000000000000000000000000000
--- a/rawEx/shortmode.erb
+++ /dev/null
@@ -1 +0,0 @@
-<% sm = true; -%>
\ No newline at end of file
diff --git a/rawEx/specular/AlternatingLayers1.py b/rawEx/specular/AlternatingLayers1.py
index 35351fa263ecec0996ca1759cd2b2a0f6780b8ca..4a6a6697f8baaf431568f710a4beae09cf38796b 100755
--- a/rawEx/specular/AlternatingLayers1.py
+++ b/rawEx/specular/AlternatingLayers1.py
@@ -33,7 +33,7 @@ def get_sample():
 
 
 def get_simulation(sample):
-    n = <%= sm ? 50 : 500 %>
+    n = <%= test_mode ? 50 : 500 %>
     scan = ba.AlphaScan(n, 2*deg/n, 2*deg)
     scan.setWavelength(1.54*angstrom)
     return ba.SpecularSimulation(scan, sample)
@@ -43,7 +43,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/specular/AlternatingLayers2.py b/rawEx/specular/AlternatingLayers2.py
index 0b2e45cb112064bafb3dd9837a0df872afa4e555..6050619a849da68661dfcbc5b91eff7e5071a2bb 100755
--- a/rawEx/specular/AlternatingLayers2.py
+++ b/rawEx/specular/AlternatingLayers2.py
@@ -13,7 +13,7 @@ def get_sample():
 
 
 def get_simulation(sample):
-    n = <%= sm ? 50 : 500 %>
+    n = <%= test_mode ? 50 : 500 %>
     scan = ba.AlphaScan(n, 2*deg/n, 2*deg)
     scan.setWavelength(1.54*angstrom)
     return ba.SpecularSimulation(scan, sample)
@@ -23,7 +23,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/specular/Basic.py b/rawEx/specular/Basic.py
index 17873962b3710eb3164f7d6c1fcc784bdf03e0cb..2a9c5ec066cea195c1c364ed793f8f16b90e2013 100755
--- a/rawEx/specular/Basic.py
+++ b/rawEx/specular/Basic.py
@@ -27,7 +27,7 @@ def get_sample():
 
 def get_simulation(sample):
     "Specular simulation with a qz-defined beam"
-    n = <%= sm ? 50 : 500 %>
+    n = <%= test_mode ? 50 : 500 %>
     qzs = np.linspace(0.01, 1, n)  # qz-values
     scan = ba.QzScan(qzs)
     return ba.SpecularSimulation(scan, sample)
@@ -37,7 +37,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/specular/BeamFullDivergence.py b/rawEx/specular/BeamFullDivergence.py
index 3658940d66014e3c73209f0826c6921f60cfa799..e9a3ffdd29826b6aa964e77b7b0290d7b9fcd58b 100755
--- a/rawEx/specular/BeamFullDivergence.py
+++ b/rawEx/specular/BeamFullDivergence.py
@@ -23,7 +23,7 @@ def get_simulation(sample):
     """
     A specular simulation with beam and detector defined.
     """
-    n = <%= sm ? 50 : 500 %>
+    n = <%= test_mode ? 50 : 500 %>
 
     scan = ba.AlphaScan(n, 2*deg/n, 2*deg)
     scan.setWavelength(wavelength)
@@ -43,7 +43,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/specular/Distributions.py b/rawEx/specular/Distributions.py
index 08d0f93a4d96ad71a3e85cfd53df485d3daa2099..9f121e09f7e9b7c746800efaa7e73c099064016c 100755
--- a/rawEx/specular/Distributions.py
+++ b/rawEx/specular/Distributions.py
@@ -37,7 +37,7 @@ if __name__ == '__main__':
             lambda0, 0.011), "LogNormal"),
     ]
 
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_multicurve(results, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/specular/FootprintCorrection.py b/rawEx/specular/FootprintCorrection.py
index 645d37774ae9ecfda82ee052d81533aa6e4868c6..9c20a51709db25342548351a4c53a94d78f2a196 100755
--- a/rawEx/specular/FootprintCorrection.py
+++ b/rawEx/specular/FootprintCorrection.py
@@ -11,7 +11,7 @@ sample = std_samples.alternating_layers()
 
 
 def simulate(footprint, title):
-    n = <%= sm ? 50 : 500 %>
+    n = <%= test_mode ? 50 : 500 %>
     scan = ba.AlphaScan(n, 0.6*deg/n, 0.6*deg)
     scan.setWavelength(1.54*angstrom)
     scan.setFootprint(footprint)
@@ -32,7 +32,7 @@ if __name__ == '__main__':
         simulate(None, "Without footprint"),
     ]
 
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_multicurve(results, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/specular/GaussianBeams.py b/rawEx/specular/GaussianBeams.py
index b7e27ec602eae715b405a8e0536bb9da820872b0..4eddcf8a5b275fddfc3251a699e11957719b2fd5 100755
--- a/rawEx/specular/GaussianBeams.py
+++ b/rawEx/specular/GaussianBeams.py
@@ -33,7 +33,7 @@ if __name__ == '__main__':
         simulate(sample, 0.01 * deg, "0.01 deg"),
         simulate(sample, 0.03 * deg, "0.03 deg"),
     ]
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_multicurve(results, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/specular/MagneticLayer.py b/rawEx/specular/MagneticLayer.py
index a389b70d2db9c5571ce20d7e7c2c9b015e19ee19..25f00a4c5bb911ba1144545f85bd4d72ff020dcc 100755
--- a/rawEx/specular/MagneticLayer.py
+++ b/rawEx/specular/MagneticLayer.py
@@ -35,7 +35,7 @@ def get_sample():
 
 
 def simulate(sample, polarizer_vec, analyzer_vec, title):
-    n = <%= sm ? 50 : 500 %>
+    n = <%= test_mode ? 50 : 500 %>
     scan = ba.AlphaScan(n, 5*deg/n, 5*deg)
     scan.setWavelength(1.54*angstrom)
     scan.setPolarization(polarizer_vec)
@@ -55,7 +55,7 @@ if __name__ == '__main__':
         simulate(sample, R3(0, +1, 0), R3(0, -1, 0), "$+-$"),
         simulate(sample, R3(0, -1, 0), R3(0, -1, 0), "$--$"),
     ]
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_multicurve(results, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/specular/MagneticLayerImperfect.py b/rawEx/specular/MagneticLayerImperfect.py
index 919169f1958be46ba091a3878edf4e1f729452d8..d766eb215a653cdf1007ebfda1a32a057b1b87b8 100755
--- a/rawEx/specular/MagneticLayerImperfect.py
+++ b/rawEx/specular/MagneticLayerImperfect.py
@@ -72,7 +72,7 @@ if __name__ == '__main__':
     results_mm = simulate(R3(0, -1, 0), R3(0, -1, 0), p_eff, a_eff, "$--$")
 
     results = [results_pp, results_pm, results_mp, results_mm]
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_multicurve(results, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/specular/PolarizedSpinAsymmetry.py b/rawEx/specular/PolarizedSpinAsymmetry.py
index d69bb03128c65974632ffce4bdf376d5dc98f6b9..74fbc1a196e3ac09d2c478030a7c5d4f86108bba 100755
--- a/rawEx/specular/PolarizedSpinAsymmetry.py
+++ b/rawEx/specular/PolarizedSpinAsymmetry.py
@@ -140,7 +140,7 @@ def plotData(qs, rs, exps, labels, colors):
     plt.ylabel("$R$")
 
     plt.tight_layout()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plt.close()
     <%- end -%>
 
@@ -175,7 +175,7 @@ def plotSpinAsymmetry(data_pp, data_mm, q, r_pp, r_mm):
     plt.ylabel("Spin asymmetry")
 
     plt.tight_layout()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plt.close() # hide plot
     <%- end -%>
 
@@ -229,7 +229,7 @@ if __name__ == '__main__':
              ["$++$", "$--$"], [['orange','red'], ['green','blue']])
 
     plotSpinAsymmetry(expdata_pp, expdata_mm, qzs, r_pp, r_mm)
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.export(**plotargs)
     <%- else -%>
diff --git a/rawEx/specular/RoughnessModel.py b/rawEx/specular/RoughnessModel.py
index bbb869a11e5a5913aa5efe7888e22f5cd7a487be..d90d1d0505560efbb0b72830862afd3be54fd13a 100755
--- a/rawEx/specular/RoughnessModel.py
+++ b/rawEx/specular/RoughnessModel.py
@@ -38,7 +38,7 @@ def get_sample(interlayer):
 
 
 def get_simulation(sample):
-    n = <%= sm ? 50 : 500 %>
+    n = <%= test_mode ? 50 : 500 %>
     scan = ba.AlphaScan(n, 2*deg/n, 2*deg)
     scan.setWavelength(1.54*angstrom)
 
@@ -61,7 +61,7 @@ if __name__ == '__main__':
         simulate(ba.ErfInterlayer(), "Névot-Croce"),
         simulate(ba.TanhInterlayer(), "Tanh"),
     ]
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_multicurve(results, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/specular/SpecularSimulationWithRoughness.py b/rawEx/specular/SpecularSimulationWithRoughness.py
index 90ee2b0c68294b4d62142ca1b9793839eefe995d..4567cb937ae58be784f69b27695e5dab5d1d2a86 100755
--- a/rawEx/specular/SpecularSimulationWithRoughness.py
+++ b/rawEx/specular/SpecularSimulationWithRoughness.py
@@ -38,7 +38,7 @@ def get_sample():
 
 
 def get_simulation(sample):
-    n = <%= sm ? 50 : 500 %>
+    n = <%= test_mode ? 50 : 500 %>
     scan = ba.AlphaScan(n, 2*deg/n, 2*deg)
     scan.setWavelength(1.54*angstrom)
     return ba.SpecularSimulation(scan, sample)
@@ -48,7 +48,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/specular/TOFRWithResolution.py b/rawEx/specular/TOFRWithResolution.py
index de286ecf5e406a7c7ca5f22daa38046e5f412240..41b44fa2a76ded6b92fe3190dc15e3c6f583b0ae 100755
--- a/rawEx/specular/TOFRWithResolution.py
+++ b/rawEx/specular/TOFRWithResolution.py
@@ -22,7 +22,7 @@ def get_sample():
 
 def get_simulation(sample):
     "Specular simulation with a qz-defined beam"
-    n = <%= sm ? 50 : 500 %>
+    n = <%= test_mode ? 50 : 500 %>
 
     qzs = np.linspace(0.01, 1, n)  # qz-values
     dq = 0.03*qzs
@@ -38,7 +38,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/specular/TimeOfFlightReflectometry.py b/rawEx/specular/TimeOfFlightReflectometry.py
index 3fbf6fc1f3eb0cac7103b0cf0217e03989803208..4e38940444063e4e9dcaee00708f6638524ba397 100755
--- a/rawEx/specular/TimeOfFlightReflectometry.py
+++ b/rawEx/specular/TimeOfFlightReflectometry.py
@@ -20,7 +20,7 @@ def get_sample():
 
 def get_simulation(sample):
     "Specular simulation with a qz-defined beam"
-    n = <%= sm ? 50 : 500 %>
+    n = <%= test_mode ? 50 : 500 %>
     qzs = np.linspace(0.01, 1, n)  # qz-values
     scan = ba.QzScan(qzs)
     return ba.SpecularSimulation(scan, sample)
@@ -30,7 +30,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/specular/VsGenx.py b/rawEx/specular/VsGenx.py
index 537566a2cf6a0c836ed2fc1c44814b2f6afe1ed8..549e7621adfe4fc8144ab0577d9d33b582105541 100755
--- a/rawEx/specular/VsGenx.py
+++ b/rawEx/specular/VsGenx.py
@@ -35,7 +35,7 @@ def get_simulation(sample, **kwargs):
     """
     A specular simulation with beam and detector defined.
     """
-    n = <%= sm ? 50 : 500 %>
+    n = <%= test_mode ? 50 : 500 %>
     footprint = ba.FootprintSquare(beam_sample_ratio)
     alpha_distr = ba.DistributionGaussian(0, 0.01 * deg, 25, 3.)
 
@@ -59,7 +59,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     plt.legend(['GenX', 'BornAgain'], loc='upper right')
diff --git a/rawEx/testmode.erb b/rawEx/testmode.erb
new file mode 100644
index 0000000000000000000000000000000000000000..ef70875592883a66c37443e2983c120dd233f542
--- /dev/null
+++ b/rawEx/testmode.erb
@@ -0,0 +1 @@
+<% test_mode = true; -%>
diff --git a/rawEx/varia/Depthprobe1.py b/rawEx/varia/Depthprobe1.py
index 20d0dc4d421b16e214a342dc556a04538ca56ae6..bc07f3b37e85c2750958ae3dfb360d46cd532a5a 100755
--- a/rawEx/varia/Depthprobe1.py
+++ b/rawEx/varia/Depthprobe1.py
@@ -23,7 +23,7 @@ def get_sample():
 
 
 def get_simulation(sample, flags):
-    n = <%= sm ? 50 : 500 %>
+    n = <%= test_mode ? 50 : 500 %>
 
     scan = ba.AlphaScan(n, 0*deg, 1*deg)
     scan.setWavelength(0.3*nm)
@@ -39,7 +39,7 @@ def run_example(flags=0):
     sample = get_sample()
     simulation = get_simulation(sample, flags)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/varia/MaterialProfile.py b/rawEx/varia/MaterialProfile.py
index 8ac4386c5dad3fb254cb42b8cb9eacfb3c4d8f2e..861d680c85b1065b7aa31f63fa6caf52e298b0d2 100755
--- a/rawEx/varia/MaterialProfile.py
+++ b/rawEx/varia/MaterialProfile.py
@@ -60,7 +60,7 @@ if __name__ == '__main__':
     plt.title("X magnetization")
 
     plt.tight_layout()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.export(**plotargs)
     <%- else -%>
diff --git a/rawEx/varia/MaterialProfileWithParticles.py b/rawEx/varia/MaterialProfileWithParticles.py
index 1eaadfe0c1e10e5fcd8e4d2fd75dcbb8b2a4adaf..131499e37719716f54ac7cc890adce50e4c9cdae 100755
--- a/rawEx/varia/MaterialProfileWithParticles.py
+++ b/rawEx/varia/MaterialProfileWithParticles.py
@@ -43,7 +43,7 @@ if __name__ == '__main__':
 
     plt.figure()
     plt.plot(zpoints, np.real(slds))
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.export(**plotargs)
     <%- else -%>
diff --git a/rawEx/varia/OpaqueProfile1.py b/rawEx/varia/OpaqueProfile1.py
index fe6a727f14141ada7fefc6c9441e2184827dd246..e2ae439874bc5dff733fc8e49f421988d8e44cef 100755
--- a/rawEx/varia/OpaqueProfile1.py
+++ b/rawEx/varia/OpaqueProfile1.py
@@ -57,7 +57,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_args(aspect='auto', intensity_max=1, intensity_min=1e-200)
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/varia/Resonator.py b/rawEx/varia/Resonator.py
index 68abe670ff0a2197a8c26bf4ba950fba5ba07a3e..976095498f54afb7f3366584824fef26192d6f85 100755
--- a/rawEx/varia/Resonator.py
+++ b/rawEx/varia/Resonator.py
@@ -67,8 +67,8 @@ def get_simulation(sample):
     """
     A depth-probe simulation.
     """
-    nz = <%= sm ? 20 : 500 %>
-    na = <%= sm ? 40 : 5000 %>
+    nz = <%= test_mode ? 20 : 500 %>
+    na = <%= test_mode ? 40 : 5000 %>
 
     scan = ba.AlphaScan(na, ai_min, ai_max)
     scan.setWavelength(wl)
@@ -88,7 +88,7 @@ if __name__ == '__main__':
     sample = get_sample()
     simulation = get_simulation(sample)
     result = simulation.simulate()
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_simulation_result(result, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/varia/RoughSurface.py b/rawEx/varia/RoughSurface.py
index 36d7e16894b1d9144b06e86b3c13c9f86804868c..fdbfe3c1de382e5ec2763fecfea9e455f7a86647 100755
--- a/rawEx/varia/RoughSurface.py
+++ b/rawEx/varia/RoughSurface.py
@@ -50,8 +50,8 @@ xi = 35*nm
 # sample size
 Lx = 1000*nm
 Ly = 1000*nm
-X_points = <%= sm ? 10 : 512 %>
-Y_points = <%= sm ? 10 : 512 %>
+X_points = <%= test_mode ? 10 : 512 %>
+Y_points = <%= test_mode ? 10 : 512 %>
 
 # create roughness model
 autocorr = ba.K_CorrelationModel(sigma, alpha, xi)
@@ -59,12 +59,12 @@ height_distribution = ba.ErfInterlayer()
 roughness = ba.LayerRoughness(autocorr, height_distribution)
 
 # generate roughness map
-roughness_map = ba.RoughnessMap(X_points, Y_points, Lx, Ly, roughness<%= sm ? ", 0" : "" %>)
+roughness_map = ba.RoughnessMap(X_points, Y_points, Lx, Ly, roughness<%= test_mode ? ", 0" : "" %>)
 surface = roughness_map.generate()
 
 print("rms = {:.3}".format(np.std(surface)),"nm")
 
-<%- if sm -%>
+<%- if test_mode -%>
 from bornagain import ba_plot as bp
 plotargs = bp.parse_commandline()
 bp.export(**plotargs)
diff --git a/rawEx/varia/Transmission.py b/rawEx/varia/Transmission.py
index c71c1e275c74fa8f257f0ad9d4cec0f95d7b1b31..21ad6d4c5141c90f37f0f52c7e5318e66c5afabd 100755
--- a/rawEx/varia/Transmission.py
+++ b/rawEx/varia/Transmission.py
@@ -34,7 +34,7 @@ def simulate():
     return result.valAt(0)
 
 if __name__ == '__main__':
-    <%- if sm -%>
+    <%- if test_mode -%>
     ba.check_scalar(simulate(), 0.2697579887696741, 200)
     <%- else -%>
     print(simulate())
diff --git a/rawEx/varia/TransmissionVsAlpha.py b/rawEx/varia/TransmissionVsAlpha.py
index a06875b5daa0b314c2a13f6033435b55b422ecfc..cd5511789ae770d1844671448dd25c68faa200c9 100755
--- a/rawEx/varia/TransmissionVsAlpha.py
+++ b/rawEx/varia/TransmissionVsAlpha.py
@@ -23,7 +23,7 @@ def get_sample(depth):
 
 def simulate(depth):
     sample = get_sample(depth)
-    n = <%= sm ? 20 : 500 %>
+    n = <%= test_mode ? 20 : 500 %>
     alpha_max = 0.8 * deg
     scan = ba.AlphaScan(n, alpha_max / n, alpha_max)
     scan.setWavelength(0.3*nm)
@@ -40,7 +40,7 @@ if __name__ == '__main__':
     depths = [20, 40, 60]
     results = [simulate(d) for d in depths]
     bp.plot_multicurve(results)
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_multicurve(results, **plotargs)
     bp.export(**plotargs)
diff --git a/rawEx/varia/TransmissionVsDepth.py b/rawEx/varia/TransmissionVsDepth.py
index a3cf391df0baf61b73af91e3eab738cba3b4d218..e56826358283ca526dfced33fa532caaf39854ab 100755
--- a/rawEx/varia/TransmissionVsDepth.py
+++ b/rawEx/varia/TransmissionVsDepth.py
@@ -26,7 +26,7 @@ def simulate(sample, alpha_i_deg):
     scan = ba.AlphaScan(1, alpha, alpha)
     scan.setWavelength(0.3*nm)
 
-    z_axis = ba.EquiDivision("z (nm)", <%= sm ? 20 : 500 %>, -130*nm, 30*nm)
+    z_axis = ba.EquiDivision("z (nm)", <%= test_mode ? 20 : 500 %>, -130*nm, 30*nm)
     simulation = ba.DepthprobeSimulation(scan, sample, z_axis, 0)
 
     result = simulation.simulate().flat()
@@ -38,7 +38,7 @@ if __name__ == '__main__':
     sample = get_sample()
     angles = [0.4, 0.5, 0.6, 0.65, 0.7]
     results = [simulate(sample, ai) for ai in angles]
-    <%- if sm -%>
+    <%- if test_mode -%>
     plotargs = bp.parse_commandline()
     bp.plot_multicurve(results, **plotargs)
     bp.export(**plotargs)