# Parameter Scan Parameter Scan repeats the parameterized {term}`project` from [Keyword Substitution](keyword_substitution.md) for a range of rod radii. The scan calculates the exterior energy flux for each radius. The page displays the scattering cross section. ## Define The Scan The script uses `numpy.linspace(...)` to create $41$ equally spaced radii from $0.3\,\mathrm{\mu m}$ through $0.5\,\mathrm{\mu m}$. The script then creates one set of {term}`project keys` for each radius: ```{literalinclude} ../../demos/documentation_tutorials/getting_started/parameter_scan/run.py :language: python :lines: 6-8 ``` Pass {term}`batched project keys` to {func}`solve ` to run the project for each set of project keys. The call returns a {class}`BatchSolveResult `. Batch entries retain input order. The first result corresponds to the first radius. The last result corresponds to the last radius. ## Run The Scan ```{literalinclude} ../../demos/documentation_tutorials/getting_started/parameter_scan/run.py :language: python ``` The script sets `temporary=True`. JCMsuite creates an isolated temporary working directory for each project key entry. The isolated directories prevent one solve from overwriting files from another solve. The `quiet=True` option suppresses local solver output. The first postprocess is available through {attr}`results.postprocesses[0] `. The {meth}`to_xarray() ` method combines energy-flux data for all batch entries. The script removes singleton dimensions and selects the real part. Matplotlib plots the cross section against the input radii. ```{figure} ../_static/getting_started/parameter_scan/scattering_cross_section.png :alt: Scattering cross-section plot over rod radius. Scattering cross section as a function of rod radius. ``` ## Project Files
run.py ```{literalinclude} ../../demos/documentation_tutorials/getting_started/parameter_scan/run.py :language: python ```
layout.jcmt ```{literalinclude} ../../demos/documentation_tutorials/getting_started/parameter_scan/layout.jcmt :language: jcm ```
materials.jcm ```{literalinclude} ../../demos/documentation_tutorials/getting_started/parameter_scan/materials.jcm :language: jcm ```
mie2D.jcmp ```{literalinclude} ../../demos/documentation_tutorials/getting_started/parameter_scan/mie2D.jcmp :language: jcm ```
sources.jcm ```{literalinclude} ../../demos/documentation_tutorials/getting_started/parameter_scan/sources.jcm :language: jcm ```
## Next Step Continue to [Python Code Snippets](code_snippets.md) to calculate template values inside project support files.