cminject.setups package

Contains a collection of useful subclasses of cminject.base.Setup, to be

  • simply used in simulations, or

  • changed/extended/improved and possibly merged back into this repository via a pull request

New Setup subclasses that are useful to others will gladly be accepted via pull requests as well.

class cminject.setups.DesyatnikovPhotophoresisSetup

Bases: cminject.base.Setup

A setup simulating photophoretic effects with the model described in: A. Desyatnikov, V. Shvedov, A. Rode, W. Krolikowski, and Y. Kivshar, “Photophoretic manipulation of absorbing aerosol particles with vortex beams: theory versus experiment,” Opt. Express 17, 8201-8211 (2009).

static construct_experiment(main_args: argparse.Namespace, args: argparse.Namespace) cminject.experiment.Experiment

Constructs an Experiment instance from the arguments to the main program and this specific setup.

Parameters
  • main_args – The argparse.Namespace parsed by the main program. Contains args that are common to all setups, like the number of particles and timespan.

  • args – The argparse.Namespace parsed by this class’s parse_args method.

Returns

An Experiment instance that’s ready to be ran.

static get_parser() cminject.utils.args.SetupArgumentParser

Returns a parser for the arguments relevant to this specific setup. This parser will receive only the arguments that the main program (bin/cminject) did not recognise.

Returns

An argparse.ArgumentParser (or subclass) instance that can parse all the args relevant to this setup.

static validate_args(args: argparse.Namespace)

Validates the arguments. Useful for validation that needs to check multiple args at once, and not just one specific arg. Overriding this method is optional and only needs to be done if such validation is desired.

Parameters

args – The argparse.Namespace object that the parser constructed by get_parser() returned after being given all arguments that the main program did not recognise.

Raises

argparse.ArgumentError if validation failed

class cminject.setups.OneFlowFieldSetup

Bases: cminject.base.Setup

A setup for one fluid flow field, with a Stokes drag force and a molecular flow drag force available to choose from. Brownian motion can also be enabled for both models.

static construct_experiment(main_args: argparse.Namespace, args: argparse.Namespace) cminject.experiment.Experiment

Constructs an Experiment instance from the arguments to the main program and this specific setup.

Parameters
  • main_args – The argparse.Namespace parsed by the main program. Contains args that are common to all setups, like the number of particles and timespan.

  • args – The argparse.Namespace parsed by this class’s parse_args method.

Returns

An Experiment instance that’s ready to be ran.

static get_parser() cminject.utils.args.SetupArgumentParser

Returns a parser for the arguments relevant to this specific setup. This parser will receive only the arguments that the main program (bin/cminject) did not recognise.

Returns

An argparse.ArgumentParser (or subclass) instance that can parse all the args relevant to this setup.

static validate_args(args: argparse.Namespace)

Validates the arguments. Useful for validation that needs to check multiple args at once, and not just one specific arg. Overriding this method is optional and only needs to be done if such validation is desired.

Parameters

args – The argparse.Namespace object that the parser constructed by get_parser() returned after being given all arguments that the main program did not recognise.

Raises

argparse.ArgumentError if validation failed

Submodules

cminject.setups.desyatnikov_photophoresis module

Setups for simulating photophoretic effects with the model described in: A. Desyatnikov, V. Shvedov, A. Rode, W. Krolikowski, and Y. Kivshar, “Photophoretic manipulation of absorbing aerosol particles with vortex beams: theory versus experiment,” Opt. Express 17, 8201-8211 (2009).

class cminject.setups.desyatnikov_photophoresis.DesyatnikovPhotophoresisSetup

Bases: cminject.base.Setup

A setup simulating photophoretic effects with the model described in: A. Desyatnikov, V. Shvedov, A. Rode, W. Krolikowski, and Y. Kivshar, “Photophoretic manipulation of absorbing aerosol particles with vortex beams: theory versus experiment,” Opt. Express 17, 8201-8211 (2009).

static construct_experiment(main_args: argparse.Namespace, args: argparse.Namespace) cminject.experiment.Experiment

Constructs an Experiment instance from the arguments to the main program and this specific setup.

Parameters
  • main_args – The argparse.Namespace parsed by the main program. Contains args that are common to all setups, like the number of particles and timespan.

  • args – The argparse.Namespace parsed by this class’s parse_args method.

Returns

An Experiment instance that’s ready to be ran.

static get_parser() cminject.utils.args.SetupArgumentParser

Returns a parser for the arguments relevant to this specific setup. This parser will receive only the arguments that the main program (bin/cminject) did not recognise.

Returns

An argparse.ArgumentParser (or subclass) instance that can parse all the args relevant to this setup.

static validate_args(args: argparse.Namespace)

Validates the arguments. Useful for validation that needs to check multiple args at once, and not just one specific arg. Overriding this method is optional and only needs to be done if such validation is desired.

Parameters

args – The argparse.Namespace object that the parser constructed by get_parser() returned after being given all arguments that the main program did not recognise.

Raises

argparse.ArgumentError if validation failed

cminject.setups.gold_adl module

class cminject.setups.gold_adl.ADLStackDevice(filename, z_offset)

Bases: cminject.base.Device

class cminject.setups.gold_adl.GoldADLSetup

Bases: cminject.base.Setup

static construct_experiment(main_args: argparse.Namespace, args: argparse.Namespace) cminject.experiment.Experiment

Constructs an Experiment instance from the arguments to the main program and this specific setup.

Parameters
  • main_args – The argparse.Namespace parsed by the main program. Contains args that are common to all setups, like the number of particles and timespan.

  • args – The argparse.Namespace parsed by this class’s parse_args method.

Returns

An Experiment instance that’s ready to be ran.

static get_parser() cminject.utils.args.SetupArgumentParser

Returns a parser for the arguments relevant to this specific setup. This parser will receive only the arguments that the main program (bin/cminject) did not recognise.

Returns

An argparse.ArgumentParser (or subclass) instance that can parse all the args relevant to this setup.

class cminject.setups.gold_adl.SkimmersBoundary(first_skimmer_flow_field: cminject.fields.fluid_flow.StokesDragForceField, inter_distance: float, skimmer_length: float, tube_length: float, skimmer_min_radius: float, skimmer_max_radius: float, skimmer_min_z: float)

Bases: cminject.base.Boundary

is_particle_inside(position: numpy.array, time: float) bool

Tells whether the given position is inside this boundary at the given time.

Parameters
  • position – A spatial position to tell this for.

  • time – The time to tell this for.

Returns

True if the particle is definitely inside this Boundary, False if it is not inside this Boundary (or if this is unknown).

property z_boundary: Tuple[float, float]

Returns the Z boundary of this Z-bounded object.

Returns

A tuple of floats, the first entry being z_min, the second being z_max.

class cminject.setups.gold_adl.SkimmersDevice(filename, inter_distance: float, skimmer_length: float, tube_length: float, skimmer_min_radius: float, skimmer_max_radius: float, skimmer_min_z: float)

Bases: cminject.base.Device

cminject.setups.one_flow_field module

Setups modeling exactly one connected flowing fluid.

class cminject.setups.one_flow_field.OneFlowFieldSetup

Bases: cminject.base.Setup

A setup for one fluid flow field, with a Stokes drag force and a molecular flow drag force available to choose from. Brownian motion can also be enabled for both models.

static construct_experiment(main_args: argparse.Namespace, args: argparse.Namespace) cminject.experiment.Experiment

Constructs an Experiment instance from the arguments to the main program and this specific setup.

Parameters
  • main_args – The argparse.Namespace parsed by the main program. Contains args that are common to all setups, like the number of particles and timespan.

  • args – The argparse.Namespace parsed by this class’s parse_args method.

Returns

An Experiment instance that’s ready to be ran.

static get_parser() cminject.utils.args.SetupArgumentParser

Returns a parser for the arguments relevant to this specific setup. This parser will receive only the arguments that the main program (bin/cminject) did not recognise.

Returns

An argparse.ArgumentParser (or subclass) instance that can parse all the args relevant to this setup.

static validate_args(args: argparse.Namespace)

Validates the arguments. Useful for validation that needs to check multiple args at once, and not just one specific arg. Overriding this method is optional and only needs to be done if such validation is desired.

Parameters

args – The argparse.Namespace object that the parser constructed by get_parser() returned after being given all arguments that the main program did not recognise.

Raises

argparse.ArgumentError if validation failed

cminject.setups.example module

This file defines a simple example setup. It is, at its core, a reduced version of cminject.definitions.setups.OneFlowFieldSetup, and should only be used as an example to derive own setups from. See the Developer Guide in the Sphinx documentation for additional explanations.

class cminject.setups.example.ExampleSetup

Bases: cminject.base.Setup

A simple setup which will simulate a single flow field with particles starting from a fixed position and velocity distribution and radius. The only parameters available are the flow field filename and the density (density) of the particle material. The density is there just to show how additional arguments can be added.

static construct_experiment(main_args: argparse.Namespace, args: argparse.Namespace) cminject.experiment.Experiment

Constructs an Experiment instance from the arguments to the main program and this specific setup.

Parameters
  • main_args – The argparse.Namespace parsed by the main program. Contains args that are common to all setups, like the number of particles and timespan.

  • args – The argparse.Namespace parsed by this class’s parse_args method.

Returns

An Experiment instance that’s ready to be ran.

static get_parser() cminject.utils.args.SetupArgumentParser

Returns a parser for the arguments relevant to this specific setup. This parser will receive only the arguments that the main program (bin/cminject) did not recognise.

Returns

An argparse.ArgumentParser (or subclass) instance that can parse all the args relevant to this setup.