Skip to content

Python Usage

When using VLab4Mic as a Python library, you get full programmatic control over every step of the simulation.

First make sure you have installed VLab4Mic in your virtual environment.


Option 1 — Run Scripts from the Command Line

Write your simulation in a Python script and run it from the command line:

python vlab_script.py

Here is a minimal script that runs an imaging simulation:

vlab_script.py
from vlab4mic.experiments import image_vsample

images, noiseless, experiment = image_vsample(run_simulation=True)

For more complete examples, see the Examples page.


Option 2 — Interactive Python Interpreter

Start an interactive Python session:

python

Then use VLab4Mic interactively:

>>> from vlab4mic.experiments import image_vsample
>>> images, noiseless, experiment = image_vsample(run_simulation=True)

Getting Help

Use Python's built-in help() to explore the available parameters for any function:

from vlab4mic.experiments import image_vsample
help(image_vsample)
from vlab4mic.sweep_generator import run_parameter_sweep
help(run_parameter_sweep)

Next Steps

  • :material-function:{ .lg .middle } Methods Reference


    Detailed usage guide for image_vsample and run_parameter_sweep.

    Methods →

  • :material-table:{ .lg .middle } Parameter Reference


    Complete list of all parameters available for simulation and sweeps.

    Parameter reference →

  • :material-code-tags:{ .lg .middle } Example Scripts


    Browse ready-to-run example scripts covering common use cases.

    Examples →